From 7e8ff2829e8732e85094d472aba6102f02ed3d8f Mon Sep 17 00:00:00 2001 From: samhere06 Date: Mon, 8 Jun 2026 15:37:37 +0530 Subject: [PATCH 1/3] enhancement-2535:Updated for attahcment to work with embedded data simple table --- .../SimpleTableManual/SimpleTableManual.tsx | 3 +- .../widget/Attachment/Attachment.tsx | 64 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx b/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx index aec9d130..5e7682c1 100644 --- a/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +++ b/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx @@ -226,7 +226,8 @@ export default function SimpleTableManual(props: PropsWithChildren item.name).map(item => item.name) + // Temporary filter for attachments to align with constellation payload behavior. + fieldDefs.filter(item => item.name && item.meta?.type !== 'Attachment').map(item => item.name) ); } else { // @ts-expect-error - An argument for 'fields' was not provided diff --git a/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx b/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx index 1218bd7a..b0010eb1 100644 --- a/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx +++ b/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx @@ -546,6 +546,70 @@ export default function Attachment(props: AttachmentProps) { ); + const displayOnlyFileDisplay = ( +
+ {files && + files.length > 0 && + files.map((item, index) => { + return ( +
+
+ +
+
+
{item.props.name}
+ {item.props.meta &&
{item.props.meta}
} +
+
+
+ handleClick(event, index)} + size='large' + > + + + + { + handleClose(); + onFileDownload(item.responseProps ? item.responseProps : {}); + }} + > + Download + + +
+
+
+ ); + })} +
+ ); + + if (displayMode === 'DISPLAY_ONLY') { + return ( +
+ {label} + {validatemessage !== '' ? {validatemessage} : {helperText}} + {files && files.length > 0 ?
{displayOnlyFileDisplay}
: ---} +
+ ); + } + return (
{label} From b4e972bd4c913d34aa3ad96c2f8894f954154c78 Mon Sep 17 00:00:00 2001 From: samhere06 Date: Thu, 11 Jun 2026 14:44:57 +0530 Subject: [PATCH 2/3] Modified transform attachments to create a copy of attachment instead of just passing reference --- .../widget/Attachment/Attachment.tsx | 38 +++++++++++-------- .../e2e/Digv2/FormFields/Attachment.spec.js | 4 +- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx b/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx index b0010eb1..c650eb9d 100644 --- a/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx +++ b/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx @@ -344,22 +344,26 @@ export default function Attachment(props: AttachmentProps) { return attachments; }, [attachments]); - // Prepares new structure as per Cosmos component + // Prepares new structure as per Cosmos component (immutable - does not mutate source) const transformAttachments = () => { - const transformedFiles = [...attachments]; let deleteIndex = -1; - transformedFiles.forEach(attachment => { - attachment.props.id = attachment.responseProps.ID; - attachment.props.format = attachment.props.name.split('.').pop(); - if (attachment.props.error) { - attachment.responseProps.deleteIndex = deleteIndex; + const transformedFiles = attachments.map(attachment => { + const newProps = { + ...attachment.props, + id: attachment.responseProps.ID, + format: attachment.props.name.split('.').pop() + }; + const newResponseProps = { ...attachment.responseProps }; + if (newProps.error) { + newResponseProps.deleteIndex = deleteIndex; } else { deleteIndex += 1; - attachment.responseProps.deleteIndex = deleteIndex; + newResponseProps.deleteIndex = deleteIndex; } - if (attachment.props.thumbnail) { - thumbnailURLs.current.push(attachment.props.thumbnail); + if (newProps.thumbnail) { + thumbnailURLs.current.push(newProps.thumbnail); } + return { ...attachment, props: newProps, responseProps: newResponseProps }; }); return transformedFiles; @@ -427,11 +431,15 @@ export default function Attachment(props: AttachmentProps) { isArrayDeepMerge: false, removePropertyFromChangedList: true }); - } else { - const serverFiles = transformAttachments(); - attachmentCount.current = attachments.length; - filesWithError.current = []; - setFiles(serverFiles); + } else if (filesWithError.current.length === 0) { + // Sync local state from server when attachments genuinely changed (e.g., table remount after modal submit) + const hasActiveUpload = files.some(f => f.inProgress); + if (!hasActiveUpload) { + const serverFiles = transformAttachments(); + attachmentCount.current = attachments.length; + filesWithError.current = []; + setFiles(serverFiles); + } } } }, [memoizedAttachments]); diff --git a/packages/react-sdk-components/tests/e2e/Digv2/FormFields/Attachment.spec.js b/packages/react-sdk-components/tests/e2e/Digv2/FormFields/Attachment.spec.js index 23df2d62..a5b52bb2 100644 --- a/packages/react-sdk-components/tests/e2e/Digv2/FormFields/Attachment.spec.js +++ b/packages/react-sdk-components/tests/e2e/Digv2/FormFields/Attachment.spec.js @@ -126,8 +126,8 @@ test.describe('E2E test', () => { /** Delete attachment */ await menuSelector.locator('li >> text="Delete"').click(); - await expect(page.locator('div >> text="cableinfo.jpg"')).toBeVisible(); - await expect(page.locator('div >> text="cablechat.jpg"')).toBeHidden(); + await expect(page.locator('div >> text="cableinfo.jpg"')).toBeHidden(); + await expect(page.locator('div >> text="cablechat.jpg"')).toBeVisible(); }, 10000); }); From b54c1a840521ff12f823b60a4e5c09bf5321c8a3 Mon Sep 17 00:00:00 2001 From: samhere06 Date: Tue, 16 Jun 2026 16:35:11 +0530 Subject: [PATCH 3/3] Change made in getRowValue --- .../SimpleTable/SimpleTableManual/SimpleTableManual.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx b/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx index 5e7682c1..947429bc 100644 --- a/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +++ b/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx @@ -262,7 +262,7 @@ export default function SimpleTableManual(props: PropsWithChildren