From 000484349b59d8c35b2227174abebbb65c71d7ee Mon Sep 17 00:00:00 2001 From: kjs Date: Wed, 11 Mar 2026 18:06:40 +0900 Subject: [PATCH] feat: enhance dynamic form service and interactive screen viewer - Updated the `DynamicFormService` to allow retrieval of both 'component' and 'v2-button-primary' types in screen layouts, improving flexibility in component handling. - Introduced a new variable to streamline button component identification, enhancing code readability and maintainability. - Modified the `InteractiveScreenViewer` to pass the `screenInfo.id` when deleting form data, ensuring accurate context during deletion operations. Made-with: Cursor --- backend-node/src/services/dynamicFormService.ts | 12 ++++++++---- .../components/screen/InteractiveScreenViewer.tsx | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend-node/src/services/dynamicFormService.ts b/backend-node/src/services/dynamicFormService.ts index 1b183074..604405c3 100644 --- a/backend-node/src/services/dynamicFormService.ts +++ b/backend-node/src/services/dynamicFormService.ts @@ -1715,8 +1715,8 @@ export class DynamicFormService { `SELECT component_id, properties FROM screen_layouts WHERE screen_id = $1 - AND component_type = $2`, - [screenId, "component"] + AND component_type IN ('component', 'v2-button-primary')`, + [screenId] ); console.log(`๐Ÿ“‹ ํ™”๋ฉด ์ปดํฌ๋„ŒํŠธ ์กฐํšŒ ๊ฒฐ๊ณผ:`, screenLayouts.length); @@ -1747,8 +1747,12 @@ export class DynamicFormService { (triggerType === "delete" && buttonActionType === "delete") || ((triggerType === "insert" || triggerType === "update") && buttonActionType === "save"); + const isButtonComponent = + properties?.componentType === "button-primary" || + properties?.componentType === "v2-button-primary"; + if ( - properties?.componentType === "button-primary" && + isButtonComponent && isMatchingAction && properties?.webTypeConfig?.enableDataflowControl === true ) { @@ -1877,7 +1881,7 @@ export class DynamicFormService { { sourceData: [savedData], dataSourceType: "formData", - buttonId: "save-button", + buttonId: `${triggerType}-button`, screenId: screenId, userId: userId, companyCode: companyCode, diff --git a/frontend/components/screen/InteractiveScreenViewer.tsx b/frontend/components/screen/InteractiveScreenViewer.tsx index 49f0f586..17fd7616 100644 --- a/frontend/components/screen/InteractiveScreenViewer.tsx +++ b/frontend/components/screen/InteractiveScreenViewer.tsx @@ -1850,7 +1850,7 @@ export const InteractiveScreenViewer: React.FC = ( try { // console.log("๐Ÿ—‘๏ธ ์‚ญ์ œ ์‹คํ–‰:", { recordId, tableName, formData }); - const result = await dynamicFormApi.deleteFormDataFromTable(recordId, tableName); + const result = await dynamicFormApi.deleteFormDataFromTable(recordId, tableName, screenInfo?.id); if (result.success) { alert("์‚ญ์ œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.");