From 30dfe32a35aa40533c377351e5b2a20e3fbacc47 Mon Sep 17 00:00:00 2001 From: Jamal Alabdullah Date: Sun, 14 Dec 2025 22:32:25 +0100 Subject: [PATCH 1/2] hide edit button in summery 2 --- .../RepeatingGroupTableSummary.test.tsx | 17 ++++++++++++++++- .../RepeatingGroupTableSummary.tsx | 5 ++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx index 3090d287ec..d23ce5679e 100644 --- a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx +++ b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.test.tsx @@ -18,7 +18,7 @@ describe('RepeatingGroupTableSummary', () => { jest.restoreAllMocks(); }); - const layoutWithHidden = (hidden: NodeId[]): ILayoutCollection => ({ + const layoutWithHidden = (hidden: NodeId[], editButton?: boolean): ILayoutCollection => ({ FormPage1: { data: { layout: [ @@ -32,6 +32,11 @@ describe('RepeatingGroupTableSummary', () => { children: ['input1', 'input2', 'input3'], maxCount: 3, hidden: hidden.includes('repeating-group'), + ...(editButton !== undefined && { + edit: { + editButton, + }, + }), }, { id: 'input1', @@ -140,6 +145,16 @@ describe('RepeatingGroupTableSummary', () => { ); }); + test('should not render edit button when edit.editButton is false', async () => { + await render({ layout: layoutWithHidden([], false) }); + expect(screen.queryByRole('button', { name: /endre/i })).not.toBeInTheDocument(); + }); + + test('should render edit button when edit.editButton is true', async () => { + await render({ layout: layoutWithHidden([], true) }); + expect(screen.getByRole('button', { name: /endre/i })).toBeInTheDocument(); + }); + type IRenderProps = { navigate?: jest.Mock; layout?: ILayoutCollection; diff --git a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx index 47992b727b..32148004a6 100644 --- a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx +++ b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx @@ -134,6 +134,9 @@ function DataRow({ row, baseComponentId, pdfModeActive, columnSettings }: DataRo const layoutLookups = useLayoutLookups(); const ids = useTableComponentIds(baseComponentId); const children = RepGroupHooks.useChildIds(baseComponentId); + const rowWithExpressions = RepGroupHooks.useRowWithExpressions(baseComponentId, { uuid: row?.uuid ?? '' }); + const editRow = rowWithExpressions?.edit; + const hiddenEditButton = editRow?.editButton === false; if (!row) { return null; @@ -154,7 +157,7 @@ function DataRow({ row, baseComponentId, pdfModeActive, columnSettings }: DataRo /> ), )} - {!pdfModeActive && ( + {!pdfModeActive && !hiddenEditButton && ( Date: Tue, 6 Jan 2026 17:38:47 +0100 Subject: [PATCH 2/2] fixed the dividing lines --- .../RepeatingGroupTableSummary.tsx | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx index 18a12d79af..2fe7f8f9d4 100644 --- a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx +++ b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx @@ -164,17 +164,20 @@ function DataRow({ row, baseComponentId, pdfModeActive, columnSettings }: DataRo /> ), )} - {!pdfModeActive && !hiddenEditButton && ( - - - - )} + {!pdfModeActive && + (hiddenEditButton ? ( + + ) : ( + + + + ))} ); }