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
This commit is contained in:
kjs 2026-03-11 18:06:40 +09:00
parent 62a5ae5f4b
commit 000484349b
2 changed files with 9 additions and 5 deletions

View File

@ -1715,8 +1715,8 @@ export class DynamicFormService {
`SELECT component_id, properties `SELECT component_id, properties
FROM screen_layouts FROM screen_layouts
WHERE screen_id = $1 WHERE screen_id = $1
AND component_type = $2`, AND component_type IN ('component', 'v2-button-primary')`,
[screenId, "component"] [screenId]
); );
console.log(`📋 화면 컴포넌트 조회 결과:`, screenLayouts.length); console.log(`📋 화면 컴포넌트 조회 결과:`, screenLayouts.length);
@ -1747,8 +1747,12 @@ export class DynamicFormService {
(triggerType === "delete" && buttonActionType === "delete") || (triggerType === "delete" && buttonActionType === "delete") ||
((triggerType === "insert" || triggerType === "update") && buttonActionType === "save"); ((triggerType === "insert" || triggerType === "update") && buttonActionType === "save");
const isButtonComponent =
properties?.componentType === "button-primary" ||
properties?.componentType === "v2-button-primary";
if ( if (
properties?.componentType === "button-primary" && isButtonComponent &&
isMatchingAction && isMatchingAction &&
properties?.webTypeConfig?.enableDataflowControl === true properties?.webTypeConfig?.enableDataflowControl === true
) { ) {
@ -1877,7 +1881,7 @@ export class DynamicFormService {
{ {
sourceData: [savedData], sourceData: [savedData],
dataSourceType: "formData", dataSourceType: "formData",
buttonId: "save-button", buttonId: `${triggerType}-button`,
screenId: screenId, screenId: screenId,
userId: userId, userId: userId,
companyCode: companyCode, companyCode: companyCode,

View File

@ -1850,7 +1850,7 @@ export const InteractiveScreenViewer: React.FC<InteractiveScreenViewerProps> = (
try { try {
// console.log("🗑️ 삭제 실행:", { recordId, tableName, formData }); // console.log("🗑️ 삭제 실행:", { recordId, tableName, formData });
const result = await dynamicFormApi.deleteFormDataFromTable(recordId, tableName); const result = await dynamicFormApi.deleteFormDataFromTable(recordId, tableName, screenInfo?.id);
if (result.success) { if (result.success) {
alert("삭제되었습니다."); alert("삭제되었습니다.");