From 1506389757fadae80c2ee068c37bd54eab0c2c6d Mon Sep 17 00:00:00 2001 From: kjs Date: Tue, 9 Dec 2025 14:17:45 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=9D=BC=EB=B0=9C=EC=86=A1=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../button-primary/ButtonPrimaryComponent.tsx | 22 +++++++++- frontend/lib/utils/buttonActions.ts | 44 +++++++++++++------ 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx b/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx index 6f5c8739..1942d268 100644 --- a/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx +++ b/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx @@ -60,6 +60,9 @@ export interface ButtonPrimaryComponentProps extends ComponentRendererProps { // ๐Ÿ†• ๊ฐ™์€ ํ™”๋ฉด์˜ ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ (TableList ์ž๋™ ๊ฐ์ง€์šฉ) allComponents?: any[]; + + // ๐Ÿ†• ๋ถ€๋ชจ์ฐฝ์—์„œ ์ „๋‹ฌ๋œ ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ (๋ชจ๋‹ฌ์—์„œ ๋ถ€๋ชจ ๋ฐ์ดํ„ฐ ์ ‘๊ทผ์šฉ) + groupedData?: Record[]; } /** @@ -98,6 +101,7 @@ export const ButtonPrimaryComponent: React.FC = ({ flowSelectedData, flowSelectedStepId, allComponents, // ๐Ÿ†• ๊ฐ™์€ ํ™”๋ฉด์˜ ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ + groupedData, // ๐Ÿ†• ๋ถ€๋ชจ์ฐฝ์—์„œ ์ „๋‹ฌ๋œ ๊ทธ๋ฃน ๋ฐ์ดํ„ฐ ...props }) => { const { isPreviewMode } = useScreenPreview(); // ํ”„๋ฆฌ๋ทฐ ๋ชจ๋“œ ํ™•์ธ @@ -807,9 +811,23 @@ export const ButtonPrimaryComponent: React.FC = ({ return; } - // ๐Ÿ†• modalDataStore์—์„œ ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ (๋ถ„ํ•  ํŒจ๋„ ๋“ฑ์—์„œ ์„ ํƒํ•œ ๋ฐ์ดํ„ฐ) + // ๐Ÿ†• ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ ์šฐ์„ ์ˆœ์œ„: + // 1. selectedRowsData (ํ…Œ์ด๋ธ”์—์„œ ์ง์ ‘ ์„ ํƒ) + // 2. groupedData (๋ถ€๋ชจ์ฐฝ์—์„œ ๋ชจ๋‹ฌ๋กœ ์ „๋‹ฌ๋œ ๋ฐ์ดํ„ฐ) + // 3. modalDataStore (๋ถ„ํ•  ํŒจ๋„ ๋“ฑ์—์„œ ์„ ํƒํ•œ ๋ฐ์ดํ„ฐ) let effectiveSelectedRowsData = selectedRowsData; - if ((!selectedRowsData || selectedRowsData.length === 0) && effectiveTableName) { + + // groupedData๊ฐ€ ์žˆ์œผ๋ฉด ์šฐ์„  ์‚ฌ์šฉ (๋ชจ๋‹ฌ์—์„œ ๋ถ€๋ชจ ๋ฐ์ดํ„ฐ ์ ‘๊ทผ) + if ((!effectiveSelectedRowsData || effectiveSelectedRowsData.length === 0) && groupedData && groupedData.length > 0) { + effectiveSelectedRowsData = groupedData; + console.log("๐Ÿ”— [ButtonPrimaryComponent] groupedData์—์„œ ๋ถ€๋ชจ์ฐฝ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ด:", { + count: groupedData.length, + data: groupedData, + }); + } + + // modalDataStore์—์„œ ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ (๋ถ„ํ•  ํŒจ๋„ ๋“ฑ์—์„œ ์„ ํƒํ•œ ๋ฐ์ดํ„ฐ) + if ((!effectiveSelectedRowsData || effectiveSelectedRowsData.length === 0) && effectiveTableName) { try { const { useModalDataStore } = await import("@/stores/modalDataStore"); const dataRegistry = useModalDataStore.getState().dataRegistry; diff --git a/frontend/lib/utils/buttonActions.ts b/frontend/lib/utils/buttonActions.ts index c5e86849..b3d080b0 100644 --- a/frontend/lib/utils/buttonActions.ts +++ b/frontend/lib/utils/buttonActions.ts @@ -2460,18 +2460,22 @@ export class ButtonActionExecutor { break; case "both": - // ํผ + ํ…Œ์ด๋ธ” ์„ ํƒ - sourceData = []; - if (context.formData && Object.keys(context.formData).length > 0) { - sourceData.push(context.formData); - } + // ํผ + ํ…Œ์ด๋ธ” ์„ ํƒ (๋ฐ์ดํ„ฐ ๋ณ‘ํ•ฉ) + // ๐Ÿ”ฅ ๊ฐ selectedRowsData ํ•ญ๋ชฉ์— formData๋ฅผ ๋ณ‘ํ•ฉํ•˜์—ฌ ์ „๋‹ฌ + // ์ด๋ ‡๊ฒŒ ํ•ด์•ผ ๋ฉ”์ผ ๋ฐœ์†ก ์‹œ ๋ถ€๋ชจ ๋ฐ์ดํ„ฐ(์ƒํ’ˆ๋ช… ๋“ฑ)์™€ ํผ ๋ฐ์ดํ„ฐ(์ˆ˜์‹ ์ž ๋“ฑ)๊ฐ€ ๋ชจ๋‘ ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅ if (context.selectedRowsData && context.selectedRowsData.length > 0) { - sourceData.push(...context.selectedRowsData); + sourceData = context.selectedRowsData.map((row: any) => ({ + ...row, + ...(context.formData || {}), + })); + console.log("๐Ÿ”€ ํผ + ํ…Œ์ด๋ธ” ์„ ํƒ ๋ฐ์ดํ„ฐ ๋ณ‘ํ•ฉ:", { + dataCount: sourceData.length, + sourceData, + }); + } else if (context.formData && Object.keys(context.formData).length > 0) { + sourceData = [context.formData]; + console.log("๐Ÿ”€ ํผ ๋ฐ์ดํ„ฐ๋งŒ ์‚ฌ์šฉ (์„ ํƒ๋œ ํ–‰ ์—†์Œ):", sourceData); } - console.log("๐Ÿ”€ ํผ + ํ…Œ์ด๋ธ” ์„ ํƒ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ:", { - dataCount: sourceData.length, - sourceData, - }); break; default: @@ -2481,9 +2485,23 @@ export class ButtonActionExecutor { dataSourceType = "flow-selection"; console.log("๐ŸŒŠ [์ž๋™] ํ”Œ๋กœ์šฐ ์„ ํƒ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ"); } else if (context.selectedRowsData && context.selectedRowsData.length > 0) { - sourceData = context.selectedRowsData; - dataSourceType = "table-selection"; - console.log("๐Ÿ“Š [์ž๋™] ํ…Œ์ด๋ธ” ์„ ํƒ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ"); + // ๐Ÿ”ฅ selectedRowsData๊ฐ€ ์žˆ์œผ๋ฉด formData๋„ ํ•จ๊ป˜ ๋ณ‘ํ•ฉ + // ๋ชจ๋‹ฌ์—์„œ ๋ถ€๋ชจ ๋ฐ์ดํ„ฐ(selectedRowsData)์™€ ํผ ์ž…๋ ฅ(formData)์„ ๋ชจ๋‘ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก + if (context.formData && Object.keys(context.formData).length > 0) { + sourceData = context.selectedRowsData.map((row: any) => ({ + ...row, + ...context.formData, + })); + dataSourceType = "both"; + console.log("๐Ÿ“Š [์ž๋™] ํ…Œ์ด๋ธ” ์„ ํƒ + ํผ ๋ฐ์ดํ„ฐ ๋ณ‘ํ•ฉ ์‚ฌ์šฉ:", { + rowCount: context.selectedRowsData.length, + formDataKeys: Object.keys(context.formData), + }); + } else { + sourceData = context.selectedRowsData; + dataSourceType = "table-selection"; + console.log("๐Ÿ“Š [์ž๋™] ํ…Œ์ด๋ธ” ์„ ํƒ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ"); + } } else if (context.formData && Object.keys(context.formData).length > 0) { sourceData = [context.formData]; dataSourceType = "form";