diff --git a/backend-node/src/controllers/tableManagementController.ts b/backend-node/src/controllers/tableManagementController.ts index 7c84898b..83384be6 100644 --- a/backend-node/src/controllers/tableManagementController.ts +++ b/backend-node/src/controllers/tableManagementController.ts @@ -775,7 +775,8 @@ export async function getTableData( const userField = autoFilter?.userField || "companyCode"; const userValue = (req.user as any)[userField]; - if (userValue) { + // ๐Ÿ†• ์ตœ๊ณ  ๊ด€๋ฆฌ์ž(company_code = '*')๋Š” ๋ชจ๋“  ํšŒ์‚ฌ ๋ฐ์ดํ„ฐ ์กฐํšŒ ๊ฐ€๋Šฅ + if (userValue && userValue !== "*") { enhancedSearch[filterColumn] = userValue; logger.info("๐Ÿ” ํ˜„์žฌ ์‚ฌ์šฉ์ž ํ•„ํ„ฐ ์ ์šฉ:", { @@ -784,6 +785,10 @@ export async function getTableData( userValue, tableName, }); + } else if (userValue === "*") { + logger.info("๐Ÿ”“ ์ตœ๊ณ  ๊ด€๋ฆฌ์ž - ํšŒ์‚ฌ ํ•„ํ„ฐ ๋ฏธ์ ์šฉ (๋ชจ๋“  ํšŒ์‚ฌ ๋ฐ์ดํ„ฐ ์กฐํšŒ)", { + tableName, + }); } else { logger.warn("โš ๏ธ ์‚ฌ์šฉ์ž ์ •๋ณด ํ•„๋“œ ๊ฐ’ ์—†์Œ:", { userField, @@ -792,6 +797,9 @@ export async function getTableData( } } + // ๐Ÿ†• ์ตœ์ข… ๊ฒ€์ƒ‰ ์กฐ๊ฑด ๋กœ๊ทธ + logger.info(`๐Ÿ” ์ตœ์ข… ๊ฒ€์ƒ‰ ์กฐ๊ฑด (enhancedSearch):`, JSON.stringify(enhancedSearch)); + // ๋ฐ์ดํ„ฐ ์กฐํšŒ const result = await tableManagementService.getTableData(tableName, { page: parseInt(page), diff --git a/frontend/app/(main)/screens/[screenId]/page.tsx b/frontend/app/(main)/screens/[screenId]/page.tsx index dffbd75b..9e92bf2b 100644 --- a/frontend/app/(main)/screens/[screenId]/page.tsx +++ b/frontend/app/(main)/screens/[screenId]/page.tsx @@ -104,7 +104,7 @@ function ScreenViewPage() { // ํŽธ์ง‘ ๋ชจ๋‹ฌ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ๋“ฑ๋ก useEffect(() => { const handleOpenEditModal = (event: CustomEvent) => { - console.log("๐ŸŽญ ํŽธ์ง‘ ๋ชจ๋‹ฌ ์—ด๊ธฐ ์ด๋ฒคํŠธ ์ˆ˜์‹ :", event.detail); + // console.log("๐ŸŽญ ํŽธ์ง‘ ๋ชจ๋‹ฌ ์—ด๊ธฐ ์ด๋ฒคํŠธ ์ˆ˜์‹ :", event.detail); setEditModalConfig({ screenId: event.detail.screenId, diff --git a/frontend/components/common/ScreenModal.tsx b/frontend/components/common/ScreenModal.tsx index cceadae9..f41c62af 100644 --- a/frontend/components/common/ScreenModal.tsx +++ b/frontend/components/common/ScreenModal.tsx @@ -261,7 +261,7 @@ export const ScreenModal: React.FC = ({ className }) => { // dataSourceId ํŒŒ๋ผ๋ฏธํ„ฐ ์ œ๊ฑฐ currentUrl.searchParams.delete("dataSourceId"); window.history.pushState({}, "", currentUrl.toString()); - console.log("๐Ÿงน URL ํŒŒ๋ผ๋ฏธํ„ฐ ์ œ๊ฑฐ"); + // console.log("๐Ÿงน URL ํŒŒ๋ผ๋ฏธํ„ฐ ์ œ๊ฑฐ"); } setModalState({ @@ -277,7 +277,7 @@ export const ScreenModal: React.FC = ({ className }) => { setSelectedData([]); // ๐Ÿ†• ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ ์ดˆ๊ธฐํ™” setContinuousMode(false); localStorage.setItem("screenModal_continuousMode", "false"); // localStorage์— ์ €์žฅ - console.log("๐Ÿ”„ ์—ฐ์† ๋ชจ๋“œ ์ดˆ๊ธฐํ™”: false"); + // console.log("๐Ÿ”„ ์—ฐ์† ๋ชจ๋“œ ์ดˆ๊ธฐํ™”: false"); }; // ์ €์žฅ ์„ฑ๊ณต ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ (์—ฐ์† ๋“ฑ๋ก ๋ชจ๋“œ ์ง€์›) @@ -285,36 +285,36 @@ export const ScreenModal: React.FC = ({ className }) => { // ๐Ÿ†• ๋ชจ๋‹ฌ์ด ์—ด๋ฆฐ ํ›„ 500ms ์ด๋‚ด์˜ ์ €์žฅ ์„ฑ๊ณต ์ด๋ฒคํŠธ๋Š” ๋ฌด์‹œ (์ด์ „ ์ด๋ฒคํŠธ ๋ฐฉ์ง€) const timeSinceOpen = Date.now() - modalOpenedAtRef.current; if (timeSinceOpen < 500) { - console.log("โญ๏ธ [ScreenModal] ๋ชจ๋‹ฌ ์—ด๋ฆฐ ์งํ›„ ์ €์žฅ ์„ฑ๊ณต ์ด๋ฒคํŠธ ๋ฌด์‹œ:", { timeSinceOpen }); + // console.log("โญ๏ธ [ScreenModal] ๋ชจ๋‹ฌ ์—ด๋ฆฐ ์งํ›„ ์ €์žฅ ์„ฑ๊ณต ์ด๋ฒคํŠธ ๋ฌด์‹œ:", { timeSinceOpen }); return; } const isContinuousMode = continuousMode; - console.log("๐Ÿ’พ ์ €์žฅ ์„ฑ๊ณต ์ด๋ฒคํŠธ ์ˆ˜์‹ "); - console.log("๐Ÿ“Œ ํ˜„์žฌ ์—ฐ์† ๋ชจ๋“œ ์ƒํƒœ:", isContinuousMode); - console.log("๐Ÿ“Œ localStorage:", localStorage.getItem("screenModal_continuousMode")); + // console.log("๐Ÿ’พ ์ €์žฅ ์„ฑ๊ณต ์ด๋ฒคํŠธ ์ˆ˜์‹ "); + // console.log("๐Ÿ“Œ ํ˜„์žฌ ์—ฐ์† ๋ชจ๋“œ ์ƒํƒœ:", isContinuousMode); + // console.log("๐Ÿ“Œ localStorage:", localStorage.getItem("screenModal_continuousMode")); if (isContinuousMode) { // ์—ฐ์† ๋ชจ๋“œ: ํผ๋งŒ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ๋ชจ๋‹ฌ์€ ์œ ์ง€ - console.log("โœ… ์—ฐ์† ๋ชจ๋“œ ํ™œ์„ฑํ™” - ํผ ์ดˆ๊ธฐํ™” ๋ฐ ํ™”๋ฉด ๋ฆฌ์…‹"); + // console.log("โœ… ์—ฐ์† ๋ชจ๋“œ ํ™œ์„ฑํ™” - ํผ ์ดˆ๊ธฐํ™” ๋ฐ ํ™”๋ฉด ๋ฆฌ์…‹"); // 1. ํผ ๋ฐ์ดํ„ฐ ์ดˆ๊ธฐํ™” setFormData({}); // 2. ๋ฆฌ์…‹ ํ‚ค ๋ณ€๊ฒฝ (์ปดํฌ๋„ŒํŠธ ๊ฐ•์ œ ๋ฆฌ๋งˆ์šดํŠธ) setResetKey((prev) => prev + 1); - console.log("๐Ÿ”„ resetKey ์ฆ๊ฐ€ - ์ปดํฌ๋„ŒํŠธ ๋ฆฌ๋งˆ์šดํŠธ"); + // console.log("๐Ÿ”„ resetKey ์ฆ๊ฐ€ - ์ปดํฌ๋„ŒํŠธ ๋ฆฌ๋งˆ์šดํŠธ"); // 3. ํ™”๋ฉด ๋ฐ์ดํ„ฐ ๋‹ค์‹œ ๋กœ๋“œ (์ฑ„๋ฒˆ ๊ทœ์น™ ์ƒˆ๋กœ ์ƒ์„ฑ) if (modalState.screenId) { - console.log("๐Ÿ”„ ํ™”๋ฉด ๋ฐ์ดํ„ฐ ๋‹ค์‹œ ๋กœ๋“œ:", modalState.screenId); + // console.log("๐Ÿ”„ ํ™”๋ฉด ๋ฐ์ดํ„ฐ ๋‹ค์‹œ ๋กœ๋“œ:", modalState.screenId); loadScreenData(modalState.screenId); } toast.success("์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ณ„์† ์ž…๋ ฅํ•˜์„ธ์š”."); } else { // ์ผ๋ฐ˜ ๋ชจ๋“œ: ๋ชจ๋‹ฌ ๋‹ซ๊ธฐ - console.log("โŒ ์ผ๋ฐ˜ ๋ชจ๋“œ - ๋ชจ๋‹ฌ ๋‹ซ๊ธฐ"); + // console.log("โŒ ์ผ๋ฐ˜ ๋ชจ๋“œ - ๋ชจ๋‹ฌ ๋‹ซ๊ธฐ"); handleCloseModal(); } }; diff --git a/frontend/components/screen/EditModal.tsx b/frontend/components/screen/EditModal.tsx index 58149088..32451d18 100644 --- a/frontend/components/screen/EditModal.tsx +++ b/frontend/components/screen/EditModal.tsx @@ -190,14 +190,14 @@ export const EditModal: React.FC = ({ className }) => { const innerLayoutData = await screenApi.getLayout(section.screenId); saveButton = findSaveButtonInComponents(innerLayoutData?.components || []); if (saveButton) { - console.log("[EditModal] ์กฐ๊ฑด๋ถ€ ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์—์„œ ์ €์žฅ ๋ฒ„ํŠผ ๋ฐœ๊ฒฌ:", { - sectionScreenId: section.screenId, - sectionLabel: section.label, - }); + // console.log("[EditModal] ์กฐ๊ฑด๋ถ€ ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์—์„œ ์ €์žฅ ๋ฒ„ํŠผ ๋ฐœ๊ฒฌ:", { + // sectionScreenId: section.screenId, + // sectionLabel: section.label, + // }); break; } } catch (innerError) { - console.warn("[EditModal] ๋‚ด๋ถ€ ํ™”๋ฉด ๋ ˆ์ด์•„์›ƒ ์กฐํšŒ ์‹คํŒจ:", section.screenId); + // console.warn("[EditModal] ๋‚ด๋ถ€ ํ™”๋ฉด ๋ ˆ์ด์•„์›ƒ ์กฐํšŒ ์‹คํŒจ:", section.screenId); } } } @@ -207,7 +207,7 @@ export const EditModal: React.FC = ({ className }) => { } if (!saveButton) { - console.log("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Œ:", targetScreenId); + // console.log("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Œ:", targetScreenId); return null; } @@ -219,14 +219,14 @@ export const EditModal: React.FC = ({ className }) => { dataflowConfig: webTypeConfig.dataflowConfig, dataflowTiming: webTypeConfig.dataflowConfig?.flowConfig?.executionTiming || "after", }; - console.log("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ ์ œ์–ด๋กœ์ง ์„ค์ • ๋ฐœ๊ฒฌ:", config); + // console.log("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ ์ œ์–ด๋กœ์ง ์„ค์ • ๋ฐœ๊ฒฌ:", config); return config; } - console.log("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ์— ์ œ์–ด๋กœ์ง ์„ค์ • ์—†์Œ"); + // console.log("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ์— ์ œ์–ด๋กœ์ง ์„ค์ • ์—†์Œ"); return null; } catch (error) { - console.warn("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ ์„ค์ • ์กฐํšŒ ์‹คํŒจ:", error); + // console.warn("[EditModal] ์ €์žฅ ๋ฒ„ํŠผ ์„ค์ • ์กฐํšŒ ์‹คํŒจ:", error); return null; } }; @@ -309,16 +309,16 @@ export const EditModal: React.FC = ({ className }) => { // ๐Ÿ†• ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ ์กฐํšŒ ํ•จ์ˆ˜ const loadGroupData = async () => { if (!modalState.tableName || !modalState.groupByColumns || modalState.groupByColumns.length === 0) { - console.warn("ํ…Œ์ด๋ธ”๋ช… ๋˜๋Š” ๊ทธ๋ฃนํ•‘ ์ปฌ๋Ÿผ์ด ์—†์Šต๋‹ˆ๋‹ค."); + // console.warn("ํ…Œ์ด๋ธ”๋ช… ๋˜๋Š” ๊ทธ๋ฃนํ•‘ ์ปฌ๋Ÿผ์ด ์—†์Šต๋‹ˆ๋‹ค."); return; } try { - console.log("๐Ÿ” ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ ์กฐํšŒ ์‹œ์ž‘:", { - tableName: modalState.tableName, - groupByColumns: modalState.groupByColumns, - editData: modalState.editData, - }); + // console.log("๐Ÿ” ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ ์กฐํšŒ ์‹œ์ž‘:", { + // tableName: modalState.tableName, + // groupByColumns: modalState.groupByColumns, + // editData: modalState.editData, + // }); // ๊ทธ๋ฃนํ•‘ ์ปฌ๋Ÿผ ๊ฐ’ ์ถ”์ถœ (์˜ˆ: order_no = "ORD-20251124-001") const groupValues: Record = {}; @@ -329,14 +329,14 @@ export const EditModal: React.FC = ({ className }) => { }); if (Object.keys(groupValues).length === 0) { - console.warn("๊ทธ๋ฃนํ•‘ ์ปฌ๋Ÿผ ๊ฐ’์ด ์—†์Šต๋‹ˆ๋‹ค:", modalState.groupByColumns); + // console.warn("๊ทธ๋ฃนํ•‘ ์ปฌ๋Ÿผ ๊ฐ’์ด ์—†์Šต๋‹ˆ๋‹ค:", modalState.groupByColumns); return; } - console.log("๐Ÿ” ๊ทธ๋ฃน ์กฐํšŒ ์š”์ฒญ:", { - tableName: modalState.tableName, - groupValues, - }); + // console.log("๐Ÿ” ๊ทธ๋ฃน ์กฐํšŒ ์š”์ฒญ:", { + // tableName: modalState.tableName, + // groupValues, + // }); // ๊ฐ™์€ ๊ทธ๋ฃน์˜ ๋ชจ๋“  ๋ ˆ์ฝ”๋“œ ์กฐํšŒ (entityJoinApi ์‚ฌ์šฉ) const { entityJoinApi } = await import("@/lib/api/entityJoin"); @@ -347,13 +347,13 @@ export const EditModal: React.FC = ({ className }) => { enableEntityJoin: true, }); - console.log("๐Ÿ” ๊ทธ๋ฃน ์กฐํšŒ ์‘๋‹ต:", response); + // console.log("๐Ÿ” ๊ทธ๋ฃน ์กฐํšŒ ์‘๋‹ต:", response); // entityJoinApi๋Š” ๋ฐฐ์—ด ๋˜๋Š” { data: [] } ํ˜•์‹์œผ๋กœ ๋ฐ˜ํ™˜ const dataArray = Array.isArray(response) ? response : response?.data || []; if (dataArray.length > 0) { - console.log("โœ… ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ ์กฐํšŒ ์„ฑ๊ณต:", dataArray.length, "๊ฑด"); + // console.log("โœ… ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ ์กฐํšŒ ์„ฑ๊ณต:", dataArray.length, "๊ฑด"); setGroupData(dataArray); setOriginalGroupData(JSON.parse(JSON.stringify(dataArray))); // Deep copy toast.info(`${dataArray.length}๊ฐœ์˜ ๊ด€๋ จ ํ’ˆ๋ชฉ์„ ๋ถˆ๋Ÿฌ์™”์Šต๋‹ˆ๋‹ค.`); @@ -374,7 +374,7 @@ export const EditModal: React.FC = ({ className }) => { try { setLoading(true); - console.log("ํ™”๋ฉด ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ ์‹œ์ž‘:", screenId); + // console.log("ํ™”๋ฉด ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ ์‹œ์ž‘:", screenId); // ํ™”๋ฉด ์ •๋ณด์™€ ๋ ˆ์ด์•„์›ƒ ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ const [screenInfo, layoutData] = await Promise.all([ @@ -382,7 +382,7 @@ export const EditModal: React.FC = ({ className }) => { screenApi.getLayout(screenId), ]); - console.log("API ์‘๋‹ต:", { screenInfo, layoutData }); + // console.log("API ์‘๋‹ต:", { screenInfo, layoutData }); if (screenInfo && layoutData) { const components = layoutData.components || []; @@ -395,11 +395,11 @@ export const EditModal: React.FC = ({ className }) => { components, screenInfo: screenInfo, }); - console.log("ํ™”๋ฉด ๋ฐ์ดํ„ฐ ์„ค์ • ์™„๋ฃŒ:", { - componentsCount: components.length, - dimensions, - screenInfo, - }); + // console.log("ํ™”๋ฉด ๋ฐ์ดํ„ฐ ์„ค์ • ์™„๋ฃŒ:", { + // componentsCount: components.length, + // dimensions, + // screenInfo, + // }); } else { throw new Error("ํ™”๋ฉด ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค"); } diff --git a/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx b/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx index a71f6e03..86155bd6 100644 --- a/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx +++ b/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx @@ -306,11 +306,11 @@ export const ButtonPrimaryComponent: React.FC = ({ useEffect(() => { const newData = splitPanelContext?.selectedLeftData ?? null; setTrackedSelectedLeftData(newData); - console.log("๐Ÿ”„ [ButtonPrimary] selectedLeftData ๋ณ€๊ฒฝ ๊ฐ์ง€:", { - label: component.label, - hasData: !!newData, - dataKeys: newData ? Object.keys(newData) : [], - }); + // console.log("๐Ÿ”„ [ButtonPrimary] selectedLeftData ๋ณ€๊ฒฝ ๊ฐ์ง€:", { + // label: component.label, + // hasData: !!newData, + // dataKeys: newData ? Object.keys(newData) : [], + // }); }, [splitPanelContext?.selectedLeftData, component.label]); // modalDataStore ์ƒํƒœ ๊ตฌ๋… (์‹ค์‹œ๊ฐ„ ์—…๋ฐ์ดํŠธ) diff --git a/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts b/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts index 2ae71595..a118cffe 100644 --- a/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts +++ b/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts @@ -53,11 +53,11 @@ export function useEntitySearch({ limit: pagination.limit.toString(), }); - console.log("[useEntitySearch] ๊ฒ€์ƒ‰ ์‹คํ–‰:", { - tableName, - filterCondition: filterConditionRef.current, - searchText: text, - }); + // console.log("[useEntitySearch] ๊ฒ€์ƒ‰ ์‹คํ–‰:", { + // tableName, + // filterCondition: filterConditionRef.current, + // searchText: text, + // }); const response = await apiClient.get( `/entity-search/${tableName}?${params.toString()}` diff --git a/frontend/lib/registry/components/repeat-screen-modal/RepeatScreenModalRenderer.tsx b/frontend/lib/registry/components/repeat-screen-modal/RepeatScreenModalRenderer.tsx index b43722d3..814e3545 100644 --- a/frontend/lib/registry/components/repeat-screen-modal/RepeatScreenModalRenderer.tsx +++ b/frontend/lib/registry/components/repeat-screen-modal/RepeatScreenModalRenderer.tsx @@ -6,7 +6,7 @@ import { RepeatScreenModalDefinition } from "./index"; // ์ปดํฌ๋„ŒํŠธ ์ž๋™ ๋“ฑ๋ก if (typeof window !== "undefined") { ComponentRegistry.registerComponent(RepeatScreenModalDefinition); - console.log("โœ… RepeatScreenModal ์ปดํฌ๋„ŒํŠธ ๋“ฑ๋ก ์™„๋ฃŒ"); + // console.log("โœ… RepeatScreenModal ์ปดํฌ๋„ŒํŠธ ๋“ฑ๋ก ์™„๋ฃŒ"); } export {}; diff --git a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx index bfb26c90..ad7f5302 100644 --- a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx +++ b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx @@ -205,12 +205,12 @@ export const SplitPanelLayoutComponent: React.FC const splitPanelId = `split-panel-${component.id}`; // ๋””๋ฒ„๊น…: Context ์—ฐ๊ฒฐ ์ƒํƒœ ํ™•์ธ - console.log("๐Ÿ”— [SplitPanelLayout] Context ์—ฐ๊ฒฐ ์ƒํƒœ:", { - componentId: component.id, - splitPanelId, - hasRegisterFunc: typeof ctxRegisterSplitPanel === "function", - splitPanelsSize: splitPanelContext.splitPanels?.size ?? "์—†์Œ", - }); + // console.log("๐Ÿ”— [SplitPanelLayout] Context ์—ฐ๊ฒฐ ์ƒํƒœ:", { + // componentId: component.id, + // splitPanelId, + // hasRegisterFunc: typeof ctxRegisterSplitPanel === "function", + // splitPanelsSize: splitPanelContext.splitPanels?.size ?? "์—†์Œ", + // }); // Context์— ๋ถ„ํ•  ํŒจ๋„ ๋“ฑ๋ก (์ขŒํ‘œ ์ •๋ณด ํฌํ•จ) - ๋งˆ์šดํŠธ ์‹œ 1ํšŒ๋งŒ ์‹คํ–‰ const ctxRegisterRef = useRef(ctxRegisterSplitPanel); @@ -235,15 +235,15 @@ export const SplitPanelLayoutComponent: React.FC isDragging: false, }; - console.log("๐Ÿ“ฆ [SplitPanelLayout] Context์— ๋ถ„ํ•  ํŒจ๋„ ๋“ฑ๋ก:", { - splitPanelId, - panelInfo, - }); + // console.log("๐Ÿ“ฆ [SplitPanelLayout] Context์— ๋ถ„ํ•  ํŒจ๋„ ๋“ฑ๋ก:", { + // splitPanelId, + // panelInfo, + // }); ctxRegisterRef.current(splitPanelId, panelInfo); return () => { - console.log("๐Ÿ“ฆ [SplitPanelLayout] Context์—์„œ ๋ถ„ํ•  ํŒจ๋„ ํ•ด์ œ:", splitPanelId); + // console.log("๐Ÿ“ฆ [SplitPanelLayout] Context์—์„œ ๋ถ„ํ•  ํŒจ๋„ ํ•ด์ œ:", splitPanelId); ctxUnregisterRef.current(splitPanelId); }; // ๋งˆ์šดํŠธ/์–ธ๋งˆ์šดํŠธ ์‹œ์—๋งŒ ์‹คํ–‰, ์œ„์น˜/ํฌ๊ธฐ ๋ณ€๊ฒฝ์€ ๋ณ„๋„ ์—…๋ฐ์ดํŠธ๋กœ ์ฒ˜๋ฆฌ @@ -311,11 +311,11 @@ export const SplitPanelLayoutComponent: React.FC // ๐Ÿ†• ๊ทธ๋ฃน๋ณ„ ํ•ฉ์‚ฐ๋œ ๋ฐ์ดํ„ฐ ๊ณ„์‚ฐ const summedLeftData = useMemo(() => { - console.log("๐Ÿ” [๊ทธ๋ฃนํ•ฉ์‚ฐ] leftGroupSumConfig:", leftGroupSumConfig); + // console.log("๐Ÿ” [๊ทธ๋ฃนํ•ฉ์‚ฐ] leftGroupSumConfig:", leftGroupSumConfig); // ๊ทธ๋ฃนํ•‘์ด ๋น„ํ™œ์„ฑํ™”๋˜์—ˆ๊ฑฐ๋‚˜ ๊ทธ๋ฃน ๊ธฐ์ค€ ์ปฌ๋Ÿผ์ด ์—†์œผ๋ฉด ์›๋ณธ ๋ฐ์ดํ„ฐ ๋ฐ˜ํ™˜ if (!leftGroupSumConfig?.enabled || !leftGroupSumConfig?.groupByColumn) { - console.log("๐Ÿ” [๊ทธ๋ฃนํ•ฉ์‚ฐ] ๊ทธ๋ฃนํ•‘ ๋น„ํ™œ์„ฑํ™” - ์›๋ณธ ๋ฐ์ดํ„ฐ ๋ฐ˜ํ™˜"); + // console.log("๐Ÿ” [๊ทธ๋ฃนํ•ฉ์‚ฐ] ๊ทธ๋ฃนํ•‘ ๋น„ํ™œ์„ฑํ™” - ์›๋ณธ ๋ฐ์ดํ„ฐ ๋ฐ˜ํ™˜"); return leftData; } @@ -756,8 +756,8 @@ export const SplitPanelLayoutComponent: React.FC } }); - console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] additionalJoinColumns:", additionalJoinColumns); - console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] configuredColumns:", configuredColumns); + // console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] additionalJoinColumns:", additionalJoinColumns); + // console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] configuredColumns:", configuredColumns); const result = await entityJoinApi.getTableDataWithJoins(leftTableName, { page: 1, @@ -769,10 +769,10 @@ export const SplitPanelLayoutComponent: React.FC }); // ๐Ÿ” ๋””๋ฒ„๊น…: API ์‘๋‹ต ๋ฐ์ดํ„ฐ์˜ ํ‚ค ํ™•์ธ - if (result.data && result.data.length > 0) { - console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] API ์‘๋‹ต ์ฒซ ๋ฒˆ์งธ ๋ฐ์ดํ„ฐ ํ‚ค:", Object.keys(result.data[0])); - console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] API ์‘๋‹ต ์ฒซ ๋ฒˆ์งธ ๋ฐ์ดํ„ฐ:", result.data[0]); - } + // if (result.data && result.data.length > 0) { + // console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] API ์‘๋‹ต ์ฒซ ๋ฒˆ์งธ ๋ฐ์ดํ„ฐ ํ‚ค:", Object.keys(result.data[0])); + // console.log("๐Ÿ”— [๋ถ„ํ• ํŒจ๋„] API ์‘๋‹ต ์ฒซ ๋ฒˆ์งธ ๋ฐ์ดํ„ฐ:", result.data[0]); + // } // ๊ฐ€๋‚˜๋‹ค์ˆœ ์ •๋ ฌ (์ขŒ์ธก ํŒจ๋„์˜ ํ‘œ์‹œ ์ปฌ๋Ÿผ ๊ธฐ์ค€) const leftColumn = componentConfig.rightPanel?.relation?.leftColumn; @@ -1000,7 +1000,7 @@ export const SplitPanelLayoutComponent: React.FC if (leftTableName && !isDesignMode) { import("@/stores/modalDataStore").then(({ useModalDataStore }) => { useModalDataStore.getState().setData(leftTableName, [item]); - console.log(`โœ… ๋ถ„ํ•  ํŒจ๋„ ์ขŒ์ธก ์„ ํƒ: ${leftTableName}`, item); + // console.log(`โœ… ๋ถ„ํ•  ํŒจ๋„ ์ขŒ์ธก ์„ ํƒ: ${leftTableName}`, item); }); } }, @@ -1198,7 +1198,7 @@ export const SplitPanelLayoutComponent: React.FC } }); setLeftColumnLabels(labels); - console.log("โœ… ์ขŒ์ธก ์ปฌ๋Ÿผ ๋ผ๋ฒจ ๋กœ๋“œ:", labels); + // console.log("โœ… ์ขŒ์ธก ์ปฌ๋Ÿผ ๋ผ๋ฒจ ๋กœ๋“œ:", labels); } catch (error) { console.error("์ขŒ์ธก ํ…Œ์ด๋ธ” ์ปฌ๋Ÿผ ๋ผ๋ฒจ ๋กœ๋“œ ์‹คํŒจ:", error); } @@ -1227,7 +1227,7 @@ export const SplitPanelLayoutComponent: React.FC } }); setRightColumnLabels(labels); - console.log("โœ… ์šฐ์ธก ์ปฌ๋Ÿผ ๋ผ๋ฒจ ๋กœ๋“œ:", labels); + // console.log("โœ… ์šฐ์ธก ์ปฌ๋Ÿผ ๋ผ๋ฒจ ๋กœ๋“œ:", labels); } catch (error) { console.error("์šฐ์ธก ํ…Œ์ด๋ธ” ์ปฌ๋Ÿผ ์ •๋ณด ๋กœ๋“œ ์‹คํŒจ:", error); } @@ -1269,7 +1269,7 @@ export const SplitPanelLayoutComponent: React.FC }; }); mappings[columnName] = valueMap; - console.log(`โœ… ์ขŒ์ธก ์นดํ…Œ๊ณ ๋ฆฌ ๋งคํ•‘ ๋กœ๋“œ [${columnName}]:`, valueMap); + // console.log(`โœ… ์ขŒ์ธก ์นดํ…Œ๊ณ ๋ฆฌ ๋งคํ•‘ ๋กœ๋“œ [${columnName}]:`, valueMap); } } catch (error) { console.error(`์ขŒ์ธก ์นดํ…Œ๊ณ ๋ฆฌ ๊ฐ’ ์กฐํšŒ ์‹คํŒจ [${columnName}]:`, error); @@ -1307,7 +1307,7 @@ export const SplitPanelLayoutComponent: React.FC } }); - console.log("๐Ÿ” ์šฐ์ธก ํŒจ๋„ ์นดํ…Œ๊ณ ๋ฆฌ ๋กœ๋“œ ๋Œ€์ƒ ํ…Œ์ด๋ธ”:", Array.from(tablesToLoad)); + // console.log("๐Ÿ” ์šฐ์ธก ํŒจ๋„ ์นดํ…Œ๊ณ ๋ฆฌ ๋กœ๋“œ ๋Œ€์ƒ ํ…Œ์ด๋ธ”:", Array.from(tablesToLoad)); // ๊ฐ ํ…Œ์ด๋ธ”์— ๋Œ€ํ•ด ์นดํ…Œ๊ณ ๋ฆฌ ๋งคํ•‘ ๋กœ๋“œ for (const tableName of tablesToLoad) { @@ -1940,7 +1940,7 @@ export const SplitPanelLayoutComponent: React.FC useEffect(() => { const handleRefreshTable = () => { if (!isDesignMode) { - console.log("๐Ÿ”„ [SplitPanel] refreshTable ์ด๋ฒคํŠธ ์ˆ˜์‹  - ๋ฐ์ดํ„ฐ ์ƒˆ๋กœ๊ณ ์นจ"); + // console.log("๐Ÿ”„ [SplitPanel] refreshTable ์ด๋ฒคํŠธ ์ˆ˜์‹  - ๋ฐ์ดํ„ฐ ์ƒˆ๋กœ๊ณ ์นจ"); loadLeftData(); // ์„ ํƒ๋œ ํ•ญ๋ชฉ์ด ์žˆ์œผ๋ฉด ์šฐ์ธก ํŒจ๋„๋„ ์ƒˆ๋กœ๊ณ ์นจ if (selectedLeftItem) { @@ -2104,12 +2104,12 @@ export const SplitPanelLayoutComponent: React.FC (() => { // ๐Ÿ†• ๊ทธ๋ฃน๋ณ„ ํ•ฉ์‚ฐ๋œ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ const dataSource = summedLeftData; - console.log( - "๐Ÿ” [ํ…Œ์ด๋ธ”๋ชจ๋“œ ๋ Œ๋”๋ง] dataSource ๊ฐœ์ˆ˜:", - dataSource.length, - "leftGroupSumConfig:", - leftGroupSumConfig, - ); + // console.log( + // "๐Ÿ” [ํ…Œ์ด๋ธ”๋ชจ๋“œ ๋ Œ๋”๋ง] dataSource ๊ฐœ์ˆ˜:", + // dataSource.length, + // "leftGroupSumConfig:", + // leftGroupSumConfig, + // ); // ๐Ÿ”ง ๋กœ์ปฌ ๊ฒ€์ƒ‰ ํ•„ํ„ฐ ์ ์šฉ const filteredData = leftSearchQuery diff --git a/frontend/lib/registry/components/universal-form-modal/TableSectionRenderer.tsx b/frontend/lib/registry/components/universal-form-modal/TableSectionRenderer.tsx index fb1b2ea3..9c238b47 100644 --- a/frontend/lib/registry/components/universal-form-modal/TableSectionRenderer.tsx +++ b/frontend/lib/registry/components/universal-form-modal/TableSectionRenderer.tsx @@ -816,13 +816,22 @@ export function TableSectionRenderer({ // ์ด๋ฏธ ์ดˆ๊ธฐํ™”๋˜์—ˆ์œผ๋ฉด ์Šคํ‚ต if (initialDataLoadedRef.current) return; - const tableSectionKey = `_tableSection_${sectionId}`; + const tableSectionKey = `__tableSection_${sectionId}`; const initialData = formData[tableSectionKey]; + console.log("[TableSectionRenderer] ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ ํ™•์ธ:", { + sectionId, + tableSectionKey, + hasInitialData: !!initialData, + initialDataLength: Array.isArray(initialData) ? initialData.length : 0, + formDataKeys: Object.keys(formData).filter(k => k.startsWith("__tableSection_")), + }); + if (Array.isArray(initialData) && initialData.length > 0) { console.log("[TableSectionRenderer] ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ ๋กœ๋“œ:", { sectionId, itemCount: initialData.length, + firstItem: initialData[0], }); setTableData(initialData); initialDataLoadedRef.current = true; @@ -1327,7 +1336,7 @@ export function TableSectionRenderer({ } } } - console.log("[TableSectionRenderer] baseFilterCondition:", condition, "preFilters:", filters?.preFilters); + // console.log("[TableSectionRenderer] baseFilterCondition:", condition, "preFilters:", filters?.preFilters); return condition; }, [filters?.preFilters]); diff --git a/frontend/lib/registry/components/universal-form-modal/UniversalFormModalComponent.tsx b/frontend/lib/registry/components/universal-form-modal/UniversalFormModalComponent.tsx index 312c3de6..cebd8aa6 100644 --- a/frontend/lib/registry/components/universal-form-modal/UniversalFormModalComponent.tsx +++ b/frontend/lib/registry/components/universal-form-modal/UniversalFormModalComponent.tsx @@ -220,47 +220,46 @@ export function UniversalFormModalComponent({ // ์ดˆ๊ธฐํ™” - ์ตœ์ดˆ ๋งˆ์šดํŠธ ์‹œ ๋˜๋Š” initialData๊ฐ€ ๋ณ€๊ฒฝ๋˜์—ˆ์„ ๋•Œ ์‹คํ–‰ useEffect(() => { - console.log("[UniversalFormModal] useEffect ์‹œ์ž‘", { - initialData, - hasInitialized: hasInitialized.current, - lastInitializedId: lastInitializedId.current, - }); - + // console.log("[UniversalFormModal] useEffect ์‹œ์ž‘", { + // initialData, + // hasInitialized: hasInitialized.current, + // lastInitializedId: lastInitializedId.current, + // }); + // initialData์—์„œ ID ๊ฐ’ ์ถ”์ถœ (id, ID, objid ๋“ฑ) const currentId = initialData?.id || initialData?.ID || initialData?.objid; const currentIdString = currentId !== undefined ? String(currentId) : undefined; - + // ์ƒ์„ฑ ๋ชจ๋“œ์—์„œ ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ ์ „๋‹ฌ๋ฐ›์€ ๋ฐ์ดํ„ฐ ํ•ด์‹œ (ID๊ฐ€ ์—†์„ ๋•Œ๋งŒ) - const createModeDataHash = !currentIdString && initialData && Object.keys(initialData).length > 0 - ? JSON.stringify(initialData) - : undefined; + const createModeDataHash = + !currentIdString && initialData && Object.keys(initialData).length > 0 ? JSON.stringify(initialData) : undefined; // ์ด๋ฏธ ์ดˆ๊ธฐํ™”๋˜์—ˆ๊ณ , ID๊ฐ€ ๋™์ผํ•˜๊ณ , ์ƒ์„ฑ ๋ชจ๋“œ ๋ฐ์ดํ„ฐ๋„ ๋™์ผํ•˜๋ฉด ์Šคํ‚ต if (hasInitialized.current && lastInitializedId.current === currentIdString) { // ์ƒ์„ฑ ๋ชจ๋“œ์—์„œ ๋ฐ์ดํ„ฐ๊ฐ€ ์ƒˆ๋กœ ์ „๋‹ฌ๋œ ๊ฒฝ์šฐ๋Š” ์žฌ์ดˆ๊ธฐํ™” ํ•„์š” if (!createModeDataHash || capturedInitialData.current) { - console.log("[UniversalFormModal] ์ดˆ๊ธฐํ™” ์Šคํ‚ต - ์ด๋ฏธ ์ดˆ๊ธฐํ™”๋จ"); + // console.log("[UniversalFormModal] ์ดˆ๊ธฐํ™” ์Šคํ‚ต - ์ด๋ฏธ ์ดˆ๊ธฐํ™”๋จ"); // ๐Ÿ†• ์ฑ„๋ฒˆ ํ”Œ๋ž˜๊ทธ๊ฐ€ true์ธ๋ฐ formData์— ๊ฐ’์ด ์—†์œผ๋ฉด ์žฌ์ƒ์„ฑ ํ•„์š” // (์ปดํฌ๋„ŒํŠธ remount๋กœ ์ธํ•ด state๊ฐ€ ์ดˆ๊ธฐํ™”๋œ ๊ฒฝ์šฐ) return; } } - + // ๐Ÿ†• ์ปดํฌ๋„ŒํŠธ remount ๊ฐ์ง€: hasInitialized๊ฐ€ true์ธ๋ฐ formData๊ฐ€ ๋น„์–ด์žˆ์œผ๋ฉด ์žฌ์ดˆ๊ธฐํ™” // (React์˜ Strict Mode๋‚˜ EmbeddedScreen ๋ฆฌ๋ Œ๋”๋ง์œผ๋กœ ์ธํ•œ remount) if (hasInitialized.current && !currentIdString) { - console.log("[UniversalFormModal] ์ปดํฌ๋„ŒํŠธ remount ๊ฐ์ง€ - ์ฑ„๋ฒˆ ํ”Œ๋ž˜๊ทธ ์ดˆ๊ธฐํ™”"); + // console.log("[UniversalFormModal] ์ปดํฌ๋„ŒํŠธ remount ๊ฐ์ง€ - ์ฑ„๋ฒˆ ํ”Œ๋ž˜๊ทธ ์ดˆ๊ธฐํ™”"); numberingGeneratedRef.current = false; isGeneratingRef.current = false; } // ๐Ÿ†• ์ˆ˜์ • ๋ชจ๋“œ: initialData์— ๋ฐ์ดํ„ฐ๊ฐ€ ์žˆ์œผ๋ฉด์„œ ID๊ฐ€ ๋ณ€๊ฒฝ๋œ ๊ฒฝ์šฐ ์žฌ์ดˆ๊ธฐํ™” if (hasInitialized.current && currentIdString && lastInitializedId.current !== currentIdString) { - console.log("[UniversalFormModal] ID ๋ณ€๊ฒฝ ๊ฐ์ง€ - ์žฌ์ดˆ๊ธฐํ™”:", { - prevId: lastInitializedId.current, - newId: currentIdString, - initialData: initialData, - }); + // console.log("[UniversalFormModal] ID ๋ณ€๊ฒฝ ๊ฐ์ง€ - ์žฌ์ดˆ๊ธฐํ™”:", { + // prevId: lastInitializedId.current, + // newId: currentIdString, + // initialData: initialData, + // }); // ์ฑ„๋ฒˆ ํ”Œ๋ž˜๊ทธ ์ดˆ๊ธฐํ™” (์ƒˆ ํ•ญ๋ชฉ์ด๋ฏ€๋กœ) numberingGeneratedRef.current = false; isGeneratingRef.current = false; @@ -270,10 +269,10 @@ export function UniversalFormModalComponent({ if (initialData && Object.keys(initialData).length > 0) { capturedInitialData.current = JSON.parse(JSON.stringify(initialData)); // ๊นŠ์€ ๋ณต์‚ฌ lastInitializedId.current = currentIdString; - console.log("[UniversalFormModal] ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ ์บก์ฒ˜:", capturedInitialData.current); + // console.log("[UniversalFormModal] ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ ์บก์ฒ˜:", capturedInitialData.current); } - console.log("[UniversalFormModal] initializeForm ํ˜ธ์ถœ ์˜ˆ์ •"); + // console.log("[UniversalFormModal] initializeForm ํ˜ธ์ถœ ์˜ˆ์ •"); hasInitialized.current = true; initializeForm(); // eslint-disable-next-line react-hooks/exhaustive-deps @@ -283,7 +282,7 @@ export function UniversalFormModalComponent({ useEffect(() => { if (!hasInitialized.current) return; // ์ตœ์ดˆ ์ดˆ๊ธฐํ™” ์ „์ด๋ฉด ์Šคํ‚ต - console.log("[useEffect config ๋ณ€๊ฒฝ] ์žฌ์ดˆ๊ธฐํ™” ์Šคํ‚ต (์ฑ„๋ฒˆ ์ค‘๋ณต ๋ฐฉ์ง€)"); + // console.log("[useEffect config ๋ณ€๊ฒฝ] ์žฌ์ดˆ๊ธฐํ™” ์Šคํ‚ต (์ฑ„๋ฒˆ ์ค‘๋ณต ๋ฐฉ์ง€)"); // initializeForm(); // ์ฃผ์„ ์ฒ˜๋ฆฌ - config ๋ณ€๊ฒฝ ์‹œ ์žฌ์ดˆ๊ธฐํ™” ์•ˆ ํ•จ (์ฑ„๋ฒˆ ์ค‘๋ณต ๋ฐฉ์ง€) // eslint-disable-next-line react-hooks/exhaustive-deps }, [config]); @@ -291,7 +290,7 @@ export function UniversalFormModalComponent({ // ์ปดํฌ๋„ŒํŠธ unmount ์‹œ ์ฑ„๋ฒˆ ํ”Œ๋ž˜๊ทธ ์ดˆ๊ธฐํ™” useEffect(() => { return () => { - console.log("[์ฑ„๋ฒˆ] ์ปดํฌ๋„ŒํŠธ unmount - ํ”Œ๋ž˜๊ทธ ์ดˆ๊ธฐํ™”"); + // console.log("[์ฑ„๋ฒˆ] ์ปดํฌ๋„ŒํŠธ unmount - ํ”Œ๋ž˜๊ทธ ์ดˆ๊ธฐํ™”"); numberingGeneratedRef.current = false; isGeneratingRef.current = false; }; @@ -363,14 +362,14 @@ export function UniversalFormModalComponent({ // ํ…Œ์ด๋ธ” ํƒ€์ž… ์„น์…˜ ์ฐพ๊ธฐ const tableSection = config.sections.find((s) => s.type === "table"); if (!tableSection) { - console.log("[UniversalFormModal] ํ…Œ์ด๋ธ” ์„น์…˜ ์—†์Œ - _groupedData ๋ฌด์‹œ"); + // console.log("[UniversalFormModal] ํ…Œ์ด๋ธ” ์„น์…˜ ์—†์Œ - _groupedData ๋ฌด์‹œ"); return; } - console.log("[UniversalFormModal] ์ˆ˜์ • ๋ชจ๋“œ - ํ…Œ์ด๋ธ” ์„น์…˜ ์ดˆ๊ธฐํ™”:", { - sectionId: tableSection.id, - itemCount: _groupedData.length, - }); + // console.log("[UniversalFormModal] ์ˆ˜์ • ๋ชจ๋“œ - ํ…Œ์ด๋ธ” ์„น์…˜ ์ดˆ๊ธฐํ™”:", { + // sectionId: tableSection.id, + // itemCount: _groupedData.length, + // }); // ์›๋ณธ ๋ฐ์ดํ„ฐ ์ €์žฅ (์ˆ˜์ •/์‚ญ์ œ ์ถ”์ ์šฉ) setOriginalGroupedData(JSON.parse(JSON.stringify(_groupedData))); @@ -425,31 +424,31 @@ export function UniversalFormModalComponent({ } if (isGeneratingRef.current) { - console.log("[์ฑ„๋ฒˆ] ์ƒ์„ฑ ์ง„ํ–‰ ์ค‘ - ์Šคํ‚ต"); + // console.log("[์ฑ„๋ฒˆ] ์ƒ์„ฑ ์ง„ํ–‰ ์ค‘ - ์Šคํ‚ต"); return; } isGeneratingRef.current = true; // ์ง„ํ–‰ ์ค‘ ํ‘œ์‹œ - console.log("[์ฑ„๋ฒˆ] ์ƒ์„ฑ ์‹œ์ž‘", { sectionsCount: config.sections.length }); + // console.log("[์ฑ„๋ฒˆ] ์ƒ์„ฑ ์‹œ์ž‘", { sectionsCount: config.sections.length }); const updatedData = { ...currentFormData }; let hasChanges = false; for (const section of config.sections) { - console.log("[์ฑ„๋ฒˆ] ์„น์…˜ ๊ฒ€์‚ฌ:", section.title, { type: section.type, repeatable: section.repeatable, fieldsCount: section.fields?.length }); + // console.log("[์ฑ„๋ฒˆ] ์„น์…˜ ๊ฒ€์‚ฌ:", section.title, { type: section.type, repeatable: section.repeatable, fieldsCount: section.fields?.length }); if (section.repeatable || section.type === "table") continue; - for (const field of (section.fields || [])) { + for (const field of section.fields || []) { // generateOnOpen์€ ๊ธฐ๋ณธ๊ฐ’ true (undefined์ผ ๊ฒฝ์šฐ true๋กœ ์ฒ˜๋ฆฌ) const shouldGenerateOnOpen = field.numberingRule?.generateOnOpen !== false; - console.log("[์ฑ„๋ฒˆ] ํ•„๋“œ ๊ฒ€์‚ฌ:", field.columnName, { - hasNumberingRule: !!field.numberingRule, - enabled: field.numberingRule?.enabled, - generateOnOpen: field.numberingRule?.generateOnOpen, - shouldGenerateOnOpen, - ruleId: field.numberingRule?.ruleId, - currentValue: updatedData[field.columnName], - }); + // console.log("[์ฑ„๋ฒˆ] ํ•„๋“œ ๊ฒ€์‚ฌ:", field.columnName, { + // hasNumberingRule: !!field.numberingRule, + // enabled: field.numberingRule?.enabled, + // generateOnOpen: field.numberingRule?.generateOnOpen, + // shouldGenerateOnOpen, + // ruleId: field.numberingRule?.ruleId, + // currentValue: updatedData[field.columnName], + // }); if ( field.numberingRule?.enabled && shouldGenerateOnOpen && @@ -457,7 +456,7 @@ export function UniversalFormModalComponent({ !updatedData[field.columnName] ) { try { - console.log(`[์ฑ„๋ฒˆ ๋ฏธ๋ฆฌ๋ณด๊ธฐ API ํ˜ธ์ถœ] ${field.columnName}, ruleId: ${field.numberingRule.ruleId}`); + // console.log(`[์ฑ„๋ฒˆ ๋ฏธ๋ฆฌ๋ณด๊ธฐ API ํ˜ธ์ถœ] ${field.columnName}, ruleId: ${field.numberingRule.ruleId}`); // generateOnOpen: ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋งŒ ํ‘œ์‹œ (DB ์‹œํ€€์Šค ์ฆ๊ฐ€ ์•ˆ ํ•จ) const response = await previewNumberingCode(field.numberingRule.ruleId); if (response.success && response.data?.generatedCode) { @@ -476,10 +475,10 @@ export function UniversalFormModalComponent({ hasChanges = true; numberingGeneratedRef.current = true; // ์ƒ์„ฑ ์™„๋ฃŒ ํ‘œ์‹œ - console.log( - `[์ฑ„๋ฒˆ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์™„๋ฃŒ] ${field.columnName} = ${generatedCode} (์ €์žฅ ์‹œ ์‹ค์ œ ํ• ๋‹น)`, - ); - console.log(`[์ฑ„๋ฒˆ ๊ทœ์น™ ID ์ €์žฅ] ${ruleIdKey} = ${field.numberingRule.ruleId}`); + // console.log( + // `[์ฑ„๋ฒˆ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์™„๋ฃŒ] ${field.columnName} = ${response.data.generatedCode} (์ €์žฅ ์‹œ ์‹ค์ œ ํ• ๋‹น)`, + // ); + // console.log(`[์ฑ„๋ฒˆ ๊ทœ์น™ ID ์ €์žฅ] ${ruleIdKey} = ${field.numberingRule.ruleId}`); // ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ์—๋„ ruleId ์ „๋‹ฌ (ModalRepeaterTable โ†’ ScreenModal) if (onChange) { @@ -487,7 +486,7 @@ export function UniversalFormModalComponent({ ...updatedData, [ruleIdKey]: field.numberingRule.ruleId, }); - console.log(`[์ฑ„๋ฒˆ] ๋ถ€๋ชจ์—๊ฒŒ ruleId ์ „๋‹ฌ: ${ruleIdKey}`); + // console.log(`[์ฑ„๋ฒˆ] ๋ถ€๋ชจ์—๊ฒŒ ruleId ์ „๋‹ฌ: ${ruleIdKey}`); } } } catch (error) { @@ -508,17 +507,17 @@ export function UniversalFormModalComponent({ // ํผ ์ดˆ๊ธฐํ™” const initializeForm = useCallback(async () => { - console.log("[initializeForm] ์‹œ์ž‘"); + // console.log("[initializeForm] ์‹œ์ž‘"); // ์บก์ฒ˜๋œ initialData ์‚ฌ์šฉ (props๋กœ ์ „๋‹ฌ๋œ initialData๊ฐ€ ์•„๋‹Œ) const effectiveInitialData = capturedInitialData.current || initialData; - console.log("[initializeForm] ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ:", { - capturedInitialData: capturedInitialData.current, - initialData: initialData, - effectiveInitialData: effectiveInitialData, - hasData: effectiveInitialData && Object.keys(effectiveInitialData).length > 0, - }); + // console.log("[initializeForm] ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ:", { + // capturedInitialData: capturedInitialData.current, + // initialData: initialData, + // effectiveInitialData: effectiveInitialData, + // hasData: effectiveInitialData && Object.keys(effectiveInitialData).length > 0, + // }); const newFormData: FormDataState = {}; const newRepeatSections: { [sectionId: string]: RepeatSectionItem[] } = {}; @@ -545,7 +544,7 @@ export function UniversalFormModalComponent({ continue; } else { // ์ผ๋ฐ˜ ์„น์…˜ ํ•„๋“œ ์ดˆ๊ธฐํ™” - for (const field of (section.fields || [])) { + for (const field of section.fields || []) { // ๊ธฐ๋ณธ๊ฐ’ ์„ค์ • let value = field.defaultValue ?? ""; @@ -567,14 +566,16 @@ export function UniversalFormModalComponent({ if (section.optionalFieldGroups) { for (const group of section.optionalFieldGroups) { const key = `${section.id}-${group.id}`; - + // ์ˆ˜์ • ๋ชจ๋“œ: triggerField ๊ฐ’์ด triggerValueOnAdd์™€ ์ผ์น˜ํ•˜๋ฉด ๊ทธ๋ฃน ์ž๋™ ํ™œ์„ฑํ™” if (effectiveInitialData && group.triggerField && group.triggerValueOnAdd !== undefined) { const triggerValue = effectiveInitialData[group.triggerField]; if (triggerValue === group.triggerValueOnAdd) { newActivatedGroups.add(key); - console.log(`[initializeForm] ์˜ต์…”๋„ ๊ทธ๋ฃน ์ž๋™ ํ™œ์„ฑํ™”: ${key}, triggerField=${group.triggerField}, value=${triggerValue}`); - + console.log( + `[initializeForm] ์˜ต์…”๋„ ๊ทธ๋ฃน ์ž๋™ ํ™œ์„ฑํ™”: ${key}, triggerField=${group.triggerField}, value=${triggerValue}`, + ); + // ํ™œ์„ฑํ™”๋œ ๊ทธ๋ฃน์˜ ํ•„๋“œ๊ฐ’๋„ ์ดˆ๊ธฐํ™” for (const field of group.fields || []) { let value = field.defaultValue ?? ""; @@ -586,7 +587,7 @@ export function UniversalFormModalComponent({ } } } - + // ์‹ ๊ทœ ๋“ฑ๋ก ๋ชจ๋“œ: triggerValueOnRemove๋ฅผ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์„ค์ • if (group.triggerField && group.triggerValueOnRemove !== undefined) { // effectiveInitialData์— ํ•ด๋‹น ๊ฐ’์ด ์—†๋Š” ๊ฒฝ์šฐ์—๋งŒ ๊ธฐ๋ณธ๊ฐ’ ์„ค์ • @@ -599,6 +600,244 @@ export function UniversalFormModalComponent({ } } + // ๐Ÿ†• ํ…Œ์ด๋ธ” ์„น์…˜(type: "table") ๋””ํ…Œ์ผ ๋ฐ์ดํ„ฐ ๋กœ๋“œ (๋งˆ์Šคํ„ฐ-๋””ํ…Œ์ผ ๊ตฌ์กฐ) + // ์ˆ˜์ • ๋ชจ๋“œ์ผ ๋•Œ ๋””ํ…Œ์ผ ํ…Œ์ด๋ธ”์—์„œ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ + if (effectiveInitialData) { + console.log("[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ๋””ํ…Œ์ผ ๋กœ๋“œ ์‹œ์ž‘", { + sectionsCount: config.sections.length, + effectiveInitialDataKeys: Object.keys(effectiveInitialData), + }); + + for (const section of config.sections) { + if (section.type !== "table" || !section.tableConfig) { + continue; + } + + const tableConfig = section.tableConfig; + const editConfig = tableConfig.editConfig; + const saveConfig = tableConfig.saveConfig; + + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id} ๊ฒ€์‚ฌ:`, { + hasEditConfig: !!editConfig, + loadOnEdit: editConfig?.loadOnEdit, + hasSaveConfig: !!saveConfig, + targetTable: saveConfig?.targetTable, + linkColumn: editConfig?.linkColumn, + }); + + // ์ˆ˜์ • ๋ชจ๋“œ ๋กœ๋“œ ์„ค์ • ํ™•์ธ (๊ธฐ๋ณธ๊ฐ’: true) + if (editConfig?.loadOnEdit === false) { + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: loadOnEdit=false, ์Šคํ‚ต`); + continue; + } + + // ๋””ํ…Œ์ผ ํ…Œ์ด๋ธ”๊ณผ ์—ฐ๊ฒฐ ์ •๋ณด ํ™•์ธ + const detailTable = saveConfig?.targetTable; + let linkColumn = editConfig?.linkColumn; + + if (!detailTable) { + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: saveConfig.targetTable ๋ฏธ์„ค์ •, ์Šคํ‚ต`); + continue; + } + + // linkColumn์ด ์„ค์ •๋˜์ง€ ์•Š์•˜์œผ๋ฉด, ๋””ํ…Œ์ผ ํ…Œ์ด๋ธ” ์ปฌ๋Ÿผ ์ •๋ณด ์กฐํšŒํ•˜์—ฌ ์ž๋™ ๊ฐ์ง€ + if (!linkColumn?.masterField || !linkColumn?.detailField) { + try { + // ๋งˆ์Šคํ„ฐ ํ…Œ์ด๋ธ”๋ช… ํ™•์ธ (saveConfig์—์„œ) + // 1. customApiSave.multiTable.mainTable.tableName (๋‹ค์ค‘ ํ…Œ์ด๋ธ” ์ €์žฅ) + // 2. saveConfig.tableName (๋‹จ์ผ ํ…Œ์ด๋ธ” ์ €์žฅ) + const masterTable = + config.saveConfig?.customApiSave?.multiTable?.mainTable?.tableName || config.saveConfig?.tableName; + + // ๋””ํ…Œ์ผ ํ…Œ์ด๋ธ”์˜ ์ปฌ๋Ÿผ ๋ชฉ๋ก ์กฐํšŒ + const columnsResponse = await apiClient.get(`/table-management/tables/${detailTable}/columns`); + + if (columnsResponse.data?.success && columnsResponse.data?.data) { + // API ์‘๋‹ต ๊ตฌ์กฐ: { success, data: { columns: [...], total, page, ... } } + const columnsArray = columnsResponse.data.data.columns || columnsResponse.data.data || []; + const detailColumnsData = Array.isArray(columnsArray) ? columnsArray : []; + const detailColumns = detailColumnsData.map((col: any) => col.column_name || col.columnName); + const masterKeys = Object.keys(effectiveInitialData); + + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ์—ฐ๊ฒฐ ํ•„๋“œ ์ž๋™ ๊ฐ์ง€`, { + masterTable, + detailTable, + detailColumnsCount: detailColumnsData.length, + }); + + // ๋ฐฉ๋ฒ• 1: ์—”ํ‹ฐํ‹ฐ ๊ด€๊ณ„ ๊ธฐ๋ฐ˜ ๊ฐ์ง€ (์ •ํ™•) + // ๋””ํ…Œ์ผ ํ…Œ์ด๋ธ”์—์„œ ๋งˆ์Šคํ„ฐ ํ…Œ์ด๋ธ”์„ ์ฐธ์กฐํ•˜๋Š” ์—”ํ‹ฐํ‹ฐ ์ปฌ๋Ÿผ ์ฐพ๊ธฐ + if (masterTable) { + for (const col of detailColumnsData) { + const colName = col.column_name || col.columnName; + const inputType = col.input_type || col.inputType; + + // ์—”ํ‹ฐํ‹ฐ ํƒ€์ž… ์ปฌ๋Ÿผ ํ™•์ธ + if (inputType === "entity") { + // reference_table ๋˜๋Š” detail_settings์—์„œ ์ฐธ์กฐ ํ…Œ์ด๋ธ” ํ™•์ธ + let refTable = col.reference_table || col.referenceTable; + + // detail_settings์—์„œ referenceTable ํ™•์ธ + if (!refTable && col.detail_settings) { + try { + const settings = + typeof col.detail_settings === "string" + ? JSON.parse(col.detail_settings) + : col.detail_settings; + refTable = settings.referenceTable; + } catch { + // JSON ํŒŒ์‹ฑ ์‹คํŒจ ๋ฌด์‹œ + } + } + + // ๋งˆ์Šคํ„ฐ ํ…Œ์ด๋ธ”์„ ์ฐธ์กฐํ•˜๋Š” ์ปฌ๋Ÿผ ๋ฐœ๊ฒฌ + if (refTable === masterTable) { + // ์ฐธ์กฐ ์ปฌ๋Ÿผ ํ™•์ธ (๋งˆ์Šคํ„ฐ ํ…Œ์ด๋ธ”์˜ ์–ด๋–ค ์ปฌ๋Ÿผ์„ ์ฐธ์กฐํ•˜๋Š”์ง€) + let refColumn = col.reference_column || col.referenceColumn; + if (!refColumn && col.detail_settings) { + try { + const settings = + typeof col.detail_settings === "string" + ? JSON.parse(col.detail_settings) + : col.detail_settings; + refColumn = settings.referenceColumn; + } catch { + // JSON ํŒŒ์‹ฑ ์‹คํŒจ ๋ฌด์‹œ + } + } + + // ๋งˆ์Šคํ„ฐ ๋ฐ์ดํ„ฐ์— ํ•ด๋‹น ์ปฌ๋Ÿผ ๊ฐ’์ด ์žˆ๋Š”์ง€ ํ™•์ธ + if (refColumn && effectiveInitialData[refColumn]) { + console.log( + `[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ์—”ํ‹ฐํ‹ฐ ๊ด€๊ณ„ ๊ฐ์ง€ - ${colName} โ†’ ${masterTable}.${refColumn}`, + ); + linkColumn = { masterField: refColumn, detailField: colName }; + break; + } + } + } + } + } + + // ๋ฐฉ๋ฒ• 2: ๊ณตํ†ต ์ปฌ๋Ÿผ ํŒจํ„ด ๊ธฐ๋ฐ˜ ๊ฐ์ง€ (ํด๋ฐฑ) + // ์—”ํ‹ฐํ‹ฐ ๊ด€๊ณ„๊ฐ€ ์—†์œผ๋ฉด ๊ณตํ†ต ์ปฌ๋Ÿผ๋ช… ํŒจํ„ด์œผ๋กœ ์ฐพ๊ธฐ + if (!linkColumn) { + const priorityPatterns = ["_no", "_number", "_code", "_id"]; + + for (const pattern of priorityPatterns) { + for (const masterKey of masterKeys) { + if ( + masterKey.endsWith(pattern) && + detailColumns.includes(masterKey) && + effectiveInitialData[masterKey] && + masterKey !== "id" && + masterKey !== "company_code" + ) { + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ๊ณตํ†ต ์ปฌ๋Ÿผ ํŒจํ„ด ๊ฐ์ง€ - ${masterKey}`); + linkColumn = { masterField: masterKey, detailField: masterKey }; + break; + } + } + if (linkColumn) break; + } + } + + // ๋ฐฉ๋ฒ• 3: ์ผ๋ฐ˜ ๊ณตํ†ต ์ปฌ๋Ÿผ (๋งˆ์ง€๋ง‰ ํด๋ฐฑ) + if (!linkColumn) { + for (const masterKey of masterKeys) { + if ( + detailColumns.includes(masterKey) && + effectiveInitialData[masterKey] && + masterKey !== "id" && + masterKey !== "company_code" && + !masterKey.startsWith("__") + ) { + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ๊ณตํ†ต ์ปฌ๋Ÿผ ๊ฐ์ง€ - ${masterKey}`); + linkColumn = { masterField: masterKey, detailField: masterKey }; + break; + } + } + } + } + } catch (error) { + console.warn(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ์ปฌ๋Ÿผ ์ •๋ณด ์กฐํšŒ ์‹คํŒจ`, error); + } + } + + if (!linkColumn?.masterField || !linkColumn?.detailField) { + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: linkColumn ๋ฏธ์„ค์ • ๋ฐ ์ž๋™ ๊ฐ์ง€ ์‹คํŒจ, ์Šคํ‚ต`); + continue; + } + + // ๋งˆ์Šคํ„ฐ ํ…Œ์ด๋ธ”์˜ ์—ฐ๊ฒฐ ํ•„๋“œ ๊ฐ’ ๊ฐ€์ ธ์˜ค๊ธฐ + const masterValue = effectiveInitialData[linkColumn.masterField]; + if (!masterValue) { + console.log( + `[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: masterField(${linkColumn.masterField}) ๊ฐ’ ์—†์Œ, ์Šคํ‚ต`, + ); + continue; + } + + try { + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ๋””ํ…Œ์ผ ๋ฐ์ดํ„ฐ ๋กœ๋“œ ์‹œ์ž‘`, { + detailTable, + linkColumn, + masterValue, + }); + + // ๋””ํ…Œ์ผ ํ…Œ์ด๋ธ”์—์„œ ๋ฐ์ดํ„ฐ ์กฐํšŒ + // operator: "equals"๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ •ํ™•ํžˆ ์ผ์น˜ํ•˜๋Š” ๊ฐ’๋งŒ ๊ฒ€์ƒ‰ (์—”ํ‹ฐํ‹ฐ ํƒ€์ž… ์ปฌ๋Ÿผ์—์„œ ์ค‘์š”) + const searchCondition: Record = { + [linkColumn.detailField]: { value: masterValue, operator: "equals" }, + }; + + console.log( + `[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: API ์š”์ฒญ - URL: /table-management/tables/${detailTable}/data`, + ); + console.log( + `[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: API ์š”์ฒญ - search:`, + JSON.stringify(searchCondition), + ); + + const response = await apiClient.post(`/table-management/tables/${detailTable}/data`, { + search: searchCondition, // filters๊ฐ€ ์•„๋‹Œ search๋กœ ์ „๋‹ฌ + page: 1, + size: 1000, // pageSize๊ฐ€ ์•„๋‹Œ size๋กœ ์ „๋‹ฌ + autoFilter: { enabled: true }, // ๋ฉ€ํ‹ฐํ…Œ๋„Œ์‹œ ํ•„ํ„ฐ ์ ์šฉ + }); + + console.log( + `[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: API ์‘๋‹ต - success: ${response.data?.success}, total: ${response.data?.data?.total}, dataLength: ${response.data?.data?.data?.length}`, + ); + + if (response.data?.success) { + // ๋‹ค์–‘ํ•œ ์‘๋‹ต ๊ตฌ์กฐ ์ฒ˜๋ฆฌ + let items: any[] = []; + const data = response.data.data; + + if (Array.isArray(data)) { + items = data; + } else if (data?.items && Array.isArray(data.items)) { + items = data.items; + } else if (data?.rows && Array.isArray(data.rows)) { + items = data.rows; + } else if (data?.data && Array.isArray(data.data)) { + items = data.data; + } + + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ${items.length}๊ฑด ๋กœ๋“œ๋จ`, items); + + // ํ…Œ์ด๋ธ” ์„น์…˜ ๋ฐ์ดํ„ฐ๋ฅผ formData์— ์ €์žฅ (TableSectionRenderer์—์„œ ์‚ฌ์šฉ) + const tableSectionKey = `__tableSection_${section.id}`; + newFormData[tableSectionKey] = items; + console.log(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: formData[${tableSectionKey}]์— ์ €์žฅ๋จ`); + } + } catch (error) { + console.error(`[initializeForm] ํ…Œ์ด๋ธ” ์„น์…˜ ${section.id}: ๋””ํ…Œ์ผ ๋ฐ์ดํ„ฐ ๋กœ๋“œ ์‹คํŒจ`, error); + } + } + } + setFormData(newFormData); setRepeatSections(newRepeatSections); setCollapsedSections(newCollapsed); @@ -610,35 +849,35 @@ export function UniversalFormModalComponent({ if (multiTable && effectiveInitialData) { const pkColumn = multiTable.mainTable?.primaryKeyColumn; const pkValue = effectiveInitialData[pkColumn]; - + // PK ๊ฐ’์ด ์žˆ์œผ๋ฉด ์ˆ˜์ • ๋ชจ๋“œ๋กœ ํŒ๋‹จ if (pkValue) { console.log("[initializeForm] ์ˆ˜์ • ๋ชจ๋“œ - ์„œ๋ธŒ ํ…Œ์ด๋ธ” ๋ฐ์ดํ„ฐ ๋กœ๋“œ ์‹œ์ž‘"); - + for (const subTableConfig of multiTable.subTables || []) { // loadOnEdit ์˜ต์…˜์ด ํ™œ์„ฑํ™”๋œ ๊ฒฝ์šฐ์—๋งŒ ๋กœ๋“œ if (!subTableConfig.enabled || !subTableConfig.options?.loadOnEdit) { continue; } - + const { tableName, linkColumn, repeatSectionId, fieldMappings, options } = subTableConfig; if (!tableName || !linkColumn?.subColumn || !repeatSectionId) { continue; } - + try { // ์„œ๋ธŒ ํ…Œ์ด๋ธ”์—์„œ ๋ฐ์ดํ„ฐ ์กฐํšŒ const filters: Record = { [linkColumn.subColumn]: pkValue, }; - + // ์„œ๋ธŒ ํ•ญ๋ชฉ๋งŒ ๋กœ๋“œ (๋ฉ”์ธ ํ•ญ๋ชฉ ์ œ์™ธ) if (options?.loadOnlySubItems && options?.mainMarkerColumn) { filters[options.mainMarkerColumn] = options.subMarkerValue ?? false; } - + console.log(`[initializeForm] ์„œ๋ธŒ ํ…Œ์ด๋ธ” ${tableName} ์กฐํšŒ:`, filters); - + const response = await apiClient.get(`/table-management/tables/${tableName}/data`, { params: { filters: JSON.stringify(filters), @@ -646,11 +885,11 @@ export function UniversalFormModalComponent({ pageSize: 100, }, }); - + if (response.data?.success && response.data?.data?.items) { const subItems = response.data.data.items; console.log(`[initializeForm] ์„œ๋ธŒ ํ…Œ์ด๋ธ” ${tableName} ๋ฐ์ดํ„ฐ ${subItems.length}๊ฑด ๋กœ๋“œ๋จ`); - + // ์—ญ๋งคํ•‘: ์„œ๋ธŒ ํ…Œ์ด๋ธ” ๋ฐ์ดํ„ฐ โ†’ ๋ฐ˜๋ณต ์„น์…˜ ๋ฐ์ดํ„ฐ const repeatItems: RepeatSectionItem[] = subItems.map((item: any, index: number) => { const repeatItem: RepeatSectionItem = { @@ -658,17 +897,17 @@ export function UniversalFormModalComponent({ _index: index, _originalData: item, // ์›๋ณธ ๋ฐ์ดํ„ฐ ๋ณด๊ด€ (์ˆ˜์ • ์‹œ ํ•„์š”) }; - + // ํ•„๋“œ ๋งคํ•‘ ์—ญ๋ณ€ํ™˜ (targetColumn โ†’ formField) for (const mapping of fieldMappings || []) { if (mapping.formField && mapping.targetColumn) { repeatItem[mapping.formField] = item[mapping.targetColumn]; } } - + return repeatItem; }); - + // ๋ฐ˜๋ณต ์„น์…˜์— ๋ฐ์ดํ„ฐ ์„ค์ • newRepeatSections[repeatSectionId] = repeatItems; setRepeatSections({ ...newRepeatSections }); @@ -682,9 +921,9 @@ export function UniversalFormModalComponent({ } // ์ฑ„๋ฒˆ๊ทœ์น™ ์ž๋™ ์ƒ์„ฑ - console.log("[initializeForm] generateNumberingValues ํ˜ธ์ถœ"); + // console.log("[initializeForm] generateNumberingValues ํ˜ธ์ถœ"); await generateNumberingValues(newFormData); - console.log("[initializeForm] ์™„๋ฃŒ"); + // console.log("[initializeForm] ์™„๋ฃŒ"); // eslint-disable-next-line react-hooks/exhaustive-deps }, [config]); // initialData๋Š” ์˜์กด์„ฑ์—์„œ ์ œ๊ฑฐ (capturedInitialData.current ์‚ฌ์šฉ) @@ -695,7 +934,7 @@ export function UniversalFormModalComponent({ _index: index, }; - for (const field of (section.fields || [])) { + for (const field of section.fields || []) { item[field.columnName] = field.defaultValue ?? ""; } @@ -708,7 +947,7 @@ export function UniversalFormModalComponent({ // ์ฑ„๋ฒˆ๊ทœ์น™ ํ•„๋“œ์˜ ์ˆ˜๋™ ๋ชจ๋“œ ๊ฐ์ง€ const originalNumberingValue = numberingOriginalValues[columnName]; const ruleIdKey = `${columnName}_numberingRuleId`; - + // ํ•ด๋‹น ํ•„๋“œ์˜ ์ฑ„๋ฒˆ๊ทœ์น™ ์„ค์ • ์ฐพ๊ธฐ let fieldConfig: FormFieldConfig | undefined; for (const section of config.sections) { @@ -722,16 +961,12 @@ export function UniversalFormModalComponent({ } if (fieldConfig) break; } - + setFormData((prev) => { const newData = { ...prev, [columnName]: value }; - + // ์ฑ„๋ฒˆ๊ทœ์น™์ด ํ™œ์„ฑํ™”๋œ ํ•„๋“œ์ด๊ณ , "์‚ฌ์šฉ์ž ์ˆ˜์ • ๊ฐ€๋Šฅ"์ด ON์ธ ๊ฒฝ์šฐ - if ( - fieldConfig?.numberingRule?.enabled && - fieldConfig?.numberingRule?.editable && - originalNumberingValue - ) { + if (fieldConfig?.numberingRule?.enabled && fieldConfig?.numberingRule?.editable && originalNumberingValue) { // ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ’์„ ์ˆ˜์ •ํ–ˆ์œผ๋ฉด (์›๋ณธ๊ณผ ๋‹ค๋ฅด๋ฉด) ruleId ์ œ๊ฑฐ โ†’ ์ˆ˜๋™ ๋ชจ๋“œ if (value !== originalNumberingValue) { delete newData[ruleIdKey]; @@ -744,7 +979,7 @@ export function UniversalFormModalComponent({ } } } - + // onChange๋Š” ๋ Œ๋”๋ง ์™ธ๋ถ€์—์„œ ํ˜ธ์ถœํ•ด์•ผ ํ•จ (setTimeout ์‚ฌ์šฉ) if (onChange) { setTimeout(() => onChange(newData), 0); @@ -825,47 +1060,53 @@ export function UniversalFormModalComponent({ }, []); // ์˜ต์…”๋„ ํ•„๋“œ ๊ทธ๋ฃน ํ™œ์„ฑํ™” - const activateOptionalFieldGroup = useCallback((sectionId: string, groupId: string) => { - const section = config.sections.find((s) => s.id === sectionId); - const group = section?.optionalFieldGroups?.find((g) => g.id === groupId); - if (!group) return; + const activateOptionalFieldGroup = useCallback( + (sectionId: string, groupId: string) => { + const section = config.sections.find((s) => s.id === sectionId); + const group = section?.optionalFieldGroups?.find((g) => g.id === groupId); + if (!group) return; - const key = `${sectionId}-${groupId}`; - setActivatedOptionalFieldGroups((prev) => { - const newSet = new Set(prev); - newSet.add(key); - return newSet; - }); + const key = `${sectionId}-${groupId}`; + setActivatedOptionalFieldGroups((prev) => { + const newSet = new Set(prev); + newSet.add(key); + return newSet; + }); - // ์—ฐ๋™ ํ•„๋“œ ๊ฐ’ ๋ณ€๊ฒฝ (์ถ”๊ฐ€ ์‹œ) - if (group.triggerField && group.triggerValueOnAdd !== undefined) { - handleFieldChange(group.triggerField, group.triggerValueOnAdd); - } - }, [config, handleFieldChange]); + // ์—ฐ๋™ ํ•„๋“œ ๊ฐ’ ๋ณ€๊ฒฝ (์ถ”๊ฐ€ ์‹œ) + if (group.triggerField && group.triggerValueOnAdd !== undefined) { + handleFieldChange(group.triggerField, group.triggerValueOnAdd); + } + }, + [config, handleFieldChange], + ); // ์˜ต์…”๋„ ํ•„๋“œ ๊ทธ๋ฃน ๋น„ํ™œ์„ฑํ™” - const deactivateOptionalFieldGroup = useCallback((sectionId: string, groupId: string) => { - const section = config.sections.find((s) => s.id === sectionId); - const group = section?.optionalFieldGroups?.find((g) => g.id === groupId); - if (!group) return; + const deactivateOptionalFieldGroup = useCallback( + (sectionId: string, groupId: string) => { + const section = config.sections.find((s) => s.id === sectionId); + const group = section?.optionalFieldGroups?.find((g) => g.id === groupId); + if (!group) return; - const key = `${sectionId}-${groupId}`; - setActivatedOptionalFieldGroups((prev) => { - const newSet = new Set(prev); - newSet.delete(key); - return newSet; - }); + const key = `${sectionId}-${groupId}`; + setActivatedOptionalFieldGroups((prev) => { + const newSet = new Set(prev); + newSet.delete(key); + return newSet; + }); - // ์—ฐ๋™ ํ•„๋“œ ๊ฐ’ ๋ณ€๊ฒฝ (์ œ๊ฑฐ ์‹œ) - if (group.triggerField && group.triggerValueOnRemove !== undefined) { - handleFieldChange(group.triggerField, group.triggerValueOnRemove); - } + // ์—ฐ๋™ ํ•„๋“œ ๊ฐ’ ๋ณ€๊ฒฝ (์ œ๊ฑฐ ์‹œ) + if (group.triggerField && group.triggerValueOnRemove !== undefined) { + handleFieldChange(group.triggerField, group.triggerValueOnRemove); + } - // ์˜ต์…”๋„ ํ•„๋“œ ๊ทธ๋ฃน ํ•„๋“œ ๊ฐ’ ์ดˆ๊ธฐํ™” - (group.fields || []).forEach((field) => { - handleFieldChange(field.columnName, field.defaultValue || ""); - }); - }, [config, handleFieldChange]); + // ์˜ต์…”๋„ ํ•„๋“œ ๊ทธ๋ฃน ํ•„๋“œ ๊ฐ’ ์ดˆ๊ธฐํ™” + (group.fields || []).forEach((field) => { + handleFieldChange(field.columnName, field.defaultValue || ""); + }); + }, + [config, handleFieldChange], + ); // Select ์˜ต์…˜ ๋กœ๋“œ const loadSelectOptions = useCallback( @@ -911,9 +1152,7 @@ export function UniversalFormModalComponent({ // categoryKey ํ˜•์‹: "tableName.columnName" const [categoryTable, categoryColumn] = optionConfig.categoryKey.split("."); if (categoryTable && categoryColumn) { - const response = await apiClient.get( - `/table-categories/${categoryTable}/${categoryColumn}/values` - ); + const response = await apiClient.get(`/table-categories/${categoryTable}/${categoryColumn}/values`); if (response.data?.success && response.data?.data) { // ์ฝ”๋“œ๊ฐ’์„ DB์— ์ €์žฅํ•˜๊ณ  ๋ผ๋ฒจ๊ฐ’์„ ํ™”๋ฉด์— ํ‘œ์‹œ options = response.data.data.map((item: any) => ({ @@ -992,7 +1231,7 @@ export function UniversalFormModalComponent({ for (const section of config.sections) { if (section.repeatable || section.type === "table") continue; // ๋ฐ˜๋ณต ์„น์…˜ ๋ฐ ํ…Œ์ด๋ธ” ์„น์…˜์€ ๋ณ„๋„ ๊ฒ€์ฆ - for (const field of (section.fields || [])) { + for (const field of section.fields || []) { if (field.required && !field.hidden && !field.numberingRule?.hidden) { const value = formData[field.columnName]; if (value === undefined || value === null || value === "") { @@ -1008,7 +1247,7 @@ export function UniversalFormModalComponent({ // ๋‹จ์ผ ํ–‰ ์ €์žฅ const saveSingleRow = useCallback(async () => { const dataToSave = { ...formData }; - + // ํ…Œ์ด๋ธ” ์„น์…˜ ๋ฐ์ดํ„ฐ ์ถ”์ถœ (๋ณ„๋„ ์ €์žฅ์šฉ) const tableSectionData: Record = {}; @@ -1028,8 +1267,8 @@ export function UniversalFormModalComponent({ for (const section of config.sections) { // ํ…Œ์ด๋ธ” ํƒ€์ž… ์„น์…˜์€ ๊ฑด๋„ˆ๋›ฐ๊ธฐ if (section.type === "table") continue; - - for (const field of (section.fields || [])) { + + for (const field of section.fields || []) { if (field.numberingRule?.enabled && field.numberingRule?.ruleId) { const ruleIdKey = `${field.columnName}_numberingRuleId`; const hasRuleId = dataToSave[ruleIdKey]; // ์‚ฌ์šฉ์ž๊ฐ€ ์ˆ˜์ •ํ•˜์ง€ ์•Š์•˜์œผ๋ฉด ruleId ์œ ์ง€๋จ @@ -1070,22 +1309,30 @@ export function UniversalFormModalComponent({ // ๋ณ„๋„ ํ…Œ์ด๋ธ”์— ์ €์žฅํ•ด์•ผ ํ•˜๋Š” ํ…Œ์ด๋ธ” ์„น์…˜ ๋ชฉ๋ก const tableSectionsForSeparateTable = config.sections.filter( - (s) => s.type === "table" && - s.tableConfig?.saveConfig?.targetTable && - s.tableConfig.saveConfig.targetTable !== config.saveConfig.tableName + (s) => + s.type === "table" && + s.tableConfig?.saveConfig?.targetTable && + s.tableConfig.saveConfig.targetTable !== config.saveConfig.tableName, ); - + // ํ…Œ์ด๋ธ” ์„น์…˜์ด ์žˆ๊ณ  ๋ฉ”์ธ ํ…Œ์ด๋ธ”์— ํ’ˆ๋ชฉ๋ณ„๋กœ ์ €์žฅํ•˜๋Š” ๊ฒฝ์šฐ (๊ณตํ†ต + ๊ฐœ๋ณ„ ๋ณ‘ํ•ฉ ์ €์žฅ) // targetTable์ด ์—†๊ฑฐ๋‚˜ ๋ฉ”์ธ ํ…Œ์ด๋ธ”๊ณผ ๊ฐ™์€ ๊ฒฝ์šฐ const tableSectionsForMainTable = config.sections.filter( - (s) => s.type === "table" && - (!s.tableConfig?.saveConfig?.targetTable || - s.tableConfig.saveConfig.targetTable === config.saveConfig.tableName) + (s) => + s.type === "table" && + (!s.tableConfig?.saveConfig?.targetTable || + s.tableConfig.saveConfig.targetTable === config.saveConfig.tableName), ); console.log("[saveSingleRow] ๋ฉ”์ธ ํ…Œ์ด๋ธ”:", config.saveConfig.tableName); - console.log("[saveSingleRow] ๋ฉ”์ธ ํ…Œ์ด๋ธ”์— ์ €์žฅํ•  ํ…Œ์ด๋ธ” ์„น์…˜:", tableSectionsForMainTable.map(s => s.id)); - console.log("[saveSingleRow] ๋ณ„๋„ ํ…Œ์ด๋ธ”์— ์ €์žฅํ•  ํ…Œ์ด๋ธ” ์„น์…˜:", tableSectionsForSeparateTable.map(s => s.id)); + console.log( + "[saveSingleRow] ๋ฉ”์ธ ํ…Œ์ด๋ธ”์— ์ €์žฅํ•  ํ…Œ์ด๋ธ” ์„น์…˜:", + tableSectionsForMainTable.map((s) => s.id), + ); + console.log( + "[saveSingleRow] ๋ณ„๋„ ํ…Œ์ด๋ธ”์— ์ €์žฅํ•  ํ…Œ์ด๋ธ” ์„น์…˜:", + tableSectionsForSeparateTable.map((s) => s.id), + ); console.log("[saveSingleRow] ํ…Œ์ด๋ธ” ์„น์…˜ ๋ฐ์ดํ„ฐ ํ‚ค:", Object.keys(tableSectionData)); console.log("[saveSingleRow] dataToSave ํ‚ค:", Object.keys(dataToSave)); @@ -1093,58 +1340,58 @@ export function UniversalFormModalComponent({ // ๊ณตํ†ต ์ €์žฅ ํ•„๋“œ ์ˆ˜์ง‘ (sectionSaveModes ์„ค์ •์— ๋”ฐ๋ผ) const commonFieldsData: Record = {}; const { sectionSaveModes } = config.saveConfig; - + // ํ•„๋“œ ํƒ€์ž… ์„น์…˜์—์„œ ๊ณตํ†ต ์ €์žฅ ํ•„๋“œ ์ˆ˜์ง‘ for (const section of config.sections) { if (section.type === "table") continue; - + const sectionMode = sectionSaveModes?.find((s) => s.sectionId === section.id); const defaultMode = "common"; // ํ•„๋“œ ํƒ€์ž… ์„น์…˜์˜ ๊ธฐ๋ณธ๊ฐ’์€ ๊ณตํ†ต ์ €์žฅ const sectionSaveMode = sectionMode?.saveMode || defaultMode; - + if (section.fields) { for (const field of section.fields) { const fieldOverride = sectionMode?.fieldOverrides?.find((f) => f.fieldName === field.columnName); const fieldSaveMode = fieldOverride?.saveMode || sectionSaveMode; - + if (fieldSaveMode === "common" && dataToSave[field.columnName] !== undefined) { commonFieldsData[field.columnName] = dataToSave[field.columnName]; } } } } - + // ๊ฐ ํ…Œ์ด๋ธ” ์„น์…˜์˜ ํ’ˆ๋ชฉ ๋ฐ์ดํ„ฐ์— ๊ณตํ†ต ํ•„๋“œ ๋ณ‘ํ•ฉํ•˜์—ฌ ์ €์žฅ for (const tableSection of tableSectionsForMainTable) { const sectionData = tableSectionData[tableSection.id] || []; - + if (sectionData.length > 0) { // ํ’ˆ๋ชฉ๋ณ„๋กœ ํ–‰ ์ €์žฅ for (const item of sectionData) { const rowToSave = { ...commonFieldsData, ...item }; - + // _sourceData ๋“ฑ ๋‚ด๋ถ€ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์ œ๊ฑฐ Object.keys(rowToSave).forEach((key) => { if (key.startsWith("_")) { delete rowToSave[key]; } }); - + const response = await apiClient.post( `/table-management/tables/${config.saveConfig.tableName}/add`, - rowToSave + rowToSave, ); - + if (!response.data?.success) { throw new Error(response.data?.message || "ํ’ˆ๋ชฉ ์ €์žฅ ์‹คํŒจ"); } } - + // ์ด๋ฏธ ์ €์žฅํ–ˆ์œผ๋ฏ€๋กœ ์•„๋ž˜ ๋กœ์ง์—์„œ ๋‹ค์‹œ ์ €์žฅํ•˜์ง€ ์•Š๋„๋ก ์ œ๊ฑฐ delete tableSectionData[tableSection.id]; } } - + // ํ’ˆ๋ชฉ์ด ์—†์œผ๋ฉด ๊ณตํ†ต ๋ฐ์ดํ„ฐ๋งŒ ์ €์žฅํ•˜์ง€ ์•Š์Œ (ํ’ˆ๋ชฉ์ด ํ•„์š”ํ•œ ํ™”๋ฉด์ด๋ฏ€๋กœ) // ๋‹ค๋ฅธ ํ…Œ์ด๋ธ” ์„น์…˜์ด ์žˆ๋Š” ๊ฒฝ์šฐ์—๋งŒ ๋ฉ”์ธ ๋ฐ์ดํ„ฐ ์ €์žฅ const hasOtherTableSections = Object.keys(tableSectionData).length > 0; @@ -1159,7 +1406,7 @@ export function UniversalFormModalComponent({ if (!response.data?.success) { throw new Error(response.data?.message || "์ €์žฅ ์‹คํŒจ"); } - + // ํ…Œ์ด๋ธ” ์„น์…˜ ๋ฐ์ดํ„ฐ ์ €์žฅ (๋ณ„๋„ ํ…Œ์ด๋ธ”์—) for (const section of config.sections) { if (section.type === "table" && section.tableConfig?.saveConfig?.targetTable) { @@ -1167,35 +1414,35 @@ export function UniversalFormModalComponent({ if (sectionData && sectionData.length > 0) { // ๋ฉ”์ธ ๋ ˆ์ฝ”๋“œ ID๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ (response.data์—์„œ ๊ฐ€์ ธ์˜ค๊ธฐ) const mainRecordId = response.data?.data?.id; - + // ๊ณตํ†ต ์ €์žฅ ํ•„๋“œ ์ˆ˜์ง‘: ๋‹ค๋ฅธ ์„น์…˜(ํ•„๋“œ ํƒ€์ž…)์—์„œ ๊ณตํ†ต ์ €์žฅ์œผ๋กœ ์„ค์ •๋œ ํ•„๋“œ ๊ฐ’ // ๊ธฐ๋ณธ๊ฐ’: ํ•„๋“œ ํƒ€์ž… ์„น์…˜์€ 'common', ํ…Œ์ด๋ธ” ํƒ€์ž… ์„น์…˜์€ 'individual' const commonFieldsData: Record = {}; const { sectionSaveModes } = config.saveConfig; - + // ๋‹ค๋ฅธ ์„น์…˜์—์„œ ๊ณตํ†ต ์ €์žฅ์œผ๋กœ ์„ค์ •๋œ ํ•„๋“œ ๊ฐ’ ์ˆ˜์ง‘ for (const otherSection of config.sections) { if (otherSection.id === section.id) continue; // ํ˜„์žฌ ํ…Œ์ด๋ธ” ์„น์…˜์€ ๊ฑด๋„ˆ๋›ฐ๊ธฐ - + const sectionMode = sectionSaveModes?.find((s) => s.sectionId === otherSection.id); // ๊ธฐ๋ณธ๊ฐ’: ํ•„๋“œ ํƒ€์ž… ์„น์…˜์€ 'common', ํ…Œ์ด๋ธ” ํƒ€์ž… ์„น์…˜์€ 'individual' const defaultMode = otherSection.type === "table" ? "individual" : "common"; const sectionSaveMode = sectionMode?.saveMode || defaultMode; - + // ํ•„๋“œ ํƒ€์ž… ์„น์…˜์˜ ํ•„๋“œ๋“ค ์ฒ˜๋ฆฌ if (otherSection.type !== "table" && otherSection.fields) { for (const field of otherSection.fields) { // ํ•„๋“œ๋ณ„ ์˜ค๋ฒ„๋ผ์ด๋“œ ํ™•์ธ const fieldOverride = sectionMode?.fieldOverrides?.find((f) => f.fieldName === field.columnName); const fieldSaveMode = fieldOverride?.saveMode || sectionSaveMode; - + // ๊ณตํ†ต ์ €์žฅ์ด๋ฉด formData์—์„œ ๊ฐ’์„ ๊ฐ€์ ธ์™€ ๋ชจ๋“  ํ’ˆ๋ชฉ์— ์ ์šฉ if (fieldSaveMode === "common" && formData[field.columnName] !== undefined) { commonFieldsData[field.columnName] = formData[field.columnName]; } } } - + // ๐Ÿ†• ์„ ํƒ์  ํ•„๋“œ ๊ทธ๋ฃน (optionalFieldGroups)๋„ ์ฒ˜๋ฆฌ if (otherSection.optionalFieldGroups && otherSection.optionalFieldGroups.length > 0) { for (const optGroup of otherSection.optionalFieldGroups) { @@ -1210,13 +1457,13 @@ export function UniversalFormModalComponent({ } } } - + console.log("[saveSingleRow] ๋ณ„๋„ ํ…Œ์ด๋ธ” ์ €์žฅ - ๊ณตํ†ต ํ•„๋“œ:", Object.keys(commonFieldsData)); - + for (const item of sectionData) { // ๊ณตํ†ต ํ•„๋“œ ๋ณ‘ํ•ฉ + ๊ฐœ๋ณ„ ํ’ˆ๋ชฉ ๋ฐ์ดํ„ฐ const itemToSave = { ...commonFieldsData, ...item }; - + // saveToTarget: false์ธ ์ปฌ๋Ÿผ์€ ์ €์žฅ์—์„œ ์ œ์™ธ const columns = section.tableConfig?.columns || []; for (const col of columns) { @@ -1224,24 +1471,24 @@ export function UniversalFormModalComponent({ delete itemToSave[col.field]; } } - + // _sourceData ๋“ฑ ๋‚ด๋ถ€ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์ œ๊ฑฐ Object.keys(itemToSave).forEach((key) => { if (key.startsWith("_")) { delete itemToSave[key]; } }); - + // ๋ฉ”์ธ ๋ ˆ์ฝ”๋“œ์™€ ์—ฐ๊ฒฐ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ if (mainRecordId && config.saveConfig.primaryKeyColumn) { itemToSave[config.saveConfig.primaryKeyColumn] = mainRecordId; } - + const saveResponse = await apiClient.post( `/table-management/tables/${section.tableConfig.saveConfig.targetTable}/add`, - itemToSave + itemToSave, ); - + if (!saveResponse.data?.success) { throw new Error(saveResponse.data?.message || `${section.title || "ํ…Œ์ด๋ธ” ์„น์…˜"} ์ €์žฅ ์‹คํŒจ`); } @@ -1249,7 +1496,13 @@ export function UniversalFormModalComponent({ } } } - }, [config.sections, config.saveConfig.tableName, config.saveConfig.primaryKeyColumn, config.saveConfig.sectionSaveModes, formData]); + }, [ + config.sections, + config.saveConfig.tableName, + config.saveConfig.primaryKeyColumn, + config.saveConfig.sectionSaveModes, + formData, + ]); // ๋‹ค์ค‘ ํ–‰ ์ €์žฅ (๊ฒธ์ง ๋“ฑ) const saveMultipleRows = useCallback(async () => { @@ -1325,7 +1578,7 @@ export function UniversalFormModalComponent({ for (const section of config.sections) { if (section.repeatable || section.type === "table") continue; - for (const field of (section.fields || [])) { + for (const field of section.fields || []) { if (field.numberingRule?.enabled && field.numberingRule?.ruleId) { // generateOnSave ๋˜๋Š” generateOnOpen ๋ชจ๋‘ ์ €์žฅ ์‹œ ์‹ค์ œ ์ˆœ๋ฒˆ ํ• ๋‹น const shouldAllocate = field.numberingRule.generateOnSave || field.numberingRule.generateOnOpen; @@ -1381,7 +1634,7 @@ export function UniversalFormModalComponent({ } }); }); - + // 1-0. receiveFromParent ํ•„๋“œ ๊ฐ’๋„ mainData์— ์ถ”๊ฐ€ (์„œ๋ธŒ ํ…Œ์ด๋ธ” ์ €์žฅ์šฉ) // ์ด ํ•„๋“œ๋“ค์€ ๋ฉ”์ธ ํ…Œ์ด๋ธ”์—๋Š” ์ €์žฅ๋˜์ง€ ์•Š์ง€๋งŒ, ์„œ๋ธŒ ํ…Œ์ด๋ธ” ์ €์žฅ ์‹œ ํ•„์š”ํ•  ์ˆ˜ ์žˆ์Œ config.sections.forEach((section) => { @@ -1400,7 +1653,7 @@ export function UniversalFormModalComponent({ for (const section of config.sections) { if (section.repeatable || section.type === "table") continue; - for (const field of (section.fields || [])) { + for (const field of section.fields || []) { // ์ฑ„๋ฒˆ๊ทœ์น™์ด ํ™œ์„ฑํ™”๋œ ํ•„๋“œ ์ฒ˜๋ฆฌ if (field.numberingRule?.enabled && field.numberingRule?.ruleId) { // ์‹ ๊ทœ ์ƒ์„ฑ์ด๊ฑฐ๋‚˜ ๊ฐ’์ด ์—†๋Š” ๊ฒฝ์šฐ์—๋งŒ ์ฑ„๋ฒˆ @@ -1445,7 +1698,7 @@ export function UniversalFormModalComponent({ } const subItems: Record[] = []; - + // ๋ฐ˜๋ณต ์„น์…˜์ด ์žˆ๋Š” ๊ฒฝ์šฐ์—๋งŒ ๋ฐ˜๋ณต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ if (subTableConfig.repeatSectionId) { const repeatData = repeatSections[subTableConfig.repeatSectionId] || []; @@ -1758,10 +2011,8 @@ export function UniversalFormModalComponent({ // ๋ฉ”์ธ ํ‘œ์‹œ ์ปฌ๋Ÿผ (displayColumn) const mainDisplayVal = row[lfg.displayColumn || ""] || ""; // ์„œ๋ธŒ ํ‘œ์‹œ ์ปฌ๋Ÿผ (subDisplayColumn์ด ์žˆ์œผ๋ฉด ์‚ฌ์šฉ, ์—†์œผ๋ฉด valueColumn ์‚ฌ์šฉ) - const subDisplayVal = lfg.subDisplayColumn - ? (row[lfg.subDisplayColumn] || "") - : (row[valueColumn] || ""); - + const subDisplayVal = lfg.subDisplayColumn ? row[lfg.subDisplayColumn] || "" : row[valueColumn] || ""; + switch (lfg.displayFormat) { case "code_name": // ์„œ๋ธŒ - ๋ฉ”์ธ ํ˜•์‹ @@ -1779,7 +2030,10 @@ export function UniversalFormModalComponent({ matches.forEach((match) => { const columnName = match.slice(1, -1); // { } ์ œ๊ฑฐ const columnValue = row[columnName]; - result = result.replace(match, columnValue !== undefined && columnValue !== null ? String(columnValue) : ""); + result = result.replace( + match, + columnValue !== undefined && columnValue !== null ? String(columnValue) : "", + ); }); } return result; @@ -1836,7 +2090,12 @@ export function UniversalFormModalComponent({ {sourceData.length > 0 ? ( sourceData - .filter((row) => row[valueColumn] !== null && row[valueColumn] !== undefined && String(row[valueColumn]) !== "") + .filter( + (row) => + row[valueColumn] !== null && + row[valueColumn] !== undefined && + String(row[valueColumn]) !== "", + ) .map((row, index) => ( {getDisplayText(row)} @@ -2096,13 +2355,11 @@ export function UniversalFormModalComponent({ ), )} - + {/* ์˜ต์…”๋„ ํ•„๋“œ ๊ทธ๋ฃน ๋ Œ๋”๋ง */} {section.optionalFieldGroups && section.optionalFieldGroups.length > 0 && (
- {section.optionalFieldGroups.map((group) => - renderOptionalFieldGroup(section, group, sectionColumns) - )} + {section.optionalFieldGroups.map((group) => renderOptionalFieldGroup(section, group, sectionColumns))}
)} @@ -2130,7 +2387,7 @@ export function UniversalFormModalComponent({ const renderOptionalFieldGroup = ( section: FormSectionConfig, group: OptionalFieldGroupConfig, - sectionColumns: number + sectionColumns: number, ) => { const key = `${section.id}-${group.id}`; const isActivated = activatedOptionalFieldGroups.has(key); @@ -2149,9 +2406,7 @@ export function UniversalFormModalComponent({

{group.title}

- {group.description && ( -

{group.description}

- )} + {group.description &&

{group.description}

}
@@ -2229,8 +2478,8 @@ export function UniversalFormModalComponent({ formData[field.columnName], (value) => handleFieldChange(field.columnName, value), `${section.id}-${group.id}-${field.id}`, - groupColumns - ) + groupColumns, + ), )}
@@ -2244,9 +2493,7 @@ export function UniversalFormModalComponent({

{group.title}

- {group.description && ( -

{group.description}

- )} + {group.description &&

{group.description}

}
@@ -2402,7 +2649,8 @@ export function UniversalFormModalComponent({

{config.modal.title || "๋ฒ”์šฉ ํผ ๋ชจ๋‹ฌ"}

- {config.sections.length}๊ฐœ ์„น์…˜ |{config.sections.reduce((acc, s) => acc + (s.fields?.length || 0), 0)}๊ฐœ ํ•„๋“œ + {config.sections.length}๊ฐœ ์„น์…˜ |{config.sections.reduce((acc, s) => acc + (s.fields?.length || 0), 0)}๊ฐœ + ํ•„๋“œ

์ €์žฅ ํ…Œ์ด๋ธ”: {config.saveConfig.tableName || "(๋ฏธ์„ค์ •)"}

diff --git a/frontend/lib/utils/buttonActions.ts b/frontend/lib/utils/buttonActions.ts index 681e9a3f..53373d41 100644 --- a/frontend/lib/utils/buttonActions.ts +++ b/frontend/lib/utils/buttonActions.ts @@ -3022,11 +3022,11 @@ export class ButtonActionExecutor { comp.componentType === "split-panel-layout", ); } - console.log("๐Ÿ” [openEditModal] ๋ถ„ํ•  ํŒจ๋„ ํ™•์ธ:", { - targetScreenId: config.targetScreenId, - hasSplitPanel, - componentTypes: layoutData?.components?.map((c: any) => c.type || c.componentType) || [], - }); + // console.log("๐Ÿ” [openEditModal] ๋ถ„ํ•  ํŒจ๋„ ํ™•์ธ:", { + // targetScreenId: config.targetScreenId, + // hasSplitPanel, + // componentTypes: layoutData?.components?.map((c: any) => c.type || c.componentType) || [], + // }); } catch (error) { console.warn("๋ ˆ์ด์•„์›ƒ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค:", error); } diff --git a/frontend/stores/modalDataStore.ts b/frontend/stores/modalDataStore.ts index eb6a2d11..6b2b0f70 100644 --- a/frontend/stores/modalDataStore.ts +++ b/frontend/stores/modalDataStore.ts @@ -77,7 +77,7 @@ export const useModalDataStore = create()( dataRegistry: {}, setData: (sourceId, items) => { - console.log("๐Ÿ“ฆ [ModalDataStore] ๋ฐ์ดํ„ฐ ์ €์žฅ:", { sourceId, itemCount: items.length, items }); + // console.log("๐Ÿ“ฆ [ModalDataStore] ๋ฐ์ดํ„ฐ ์ €์žฅ:", { sourceId, itemCount: items.length, items }); set((state) => ({ dataRegistry: { ...state.dataRegistry,