From bf3ab8b6deac792815439f0e6e1e262a982bff22 Mon Sep 17 00:00:00 2001
From: Jonathan <395137+Grafikart@users.noreply.github.com>
Date: Mon, 8 Jan 2024 14:56:56 +0100
Subject: [PATCH] Remove "headers" for table to match Lunatic model (#843)
---
src/components/loop/roster-for-loop/roster-for-loop.tsx | 4 ++--
src/components/type.ts | 4 ++--
src/stories/loop/source-with-header.json | 2 +-
.../commons/fill-components/fill-component-expressions.ts | 1 -
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/components/loop/roster-for-loop/roster-for-loop.tsx b/src/components/loop/roster-for-loop/roster-for-loop.tsx
index c795976f1..cb0686f7f 100644
--- a/src/components/loop/roster-for-loop/roster-for-loop.tsx
+++ b/src/components/loop/roster-for-loop/roster-for-loop.tsx
@@ -31,7 +31,7 @@ export const RosterForLoop = createCustomizableLunaticField<
handleChange,
declarations,
label,
- headers,
+ header,
iterations,
id,
getComponents,
@@ -71,7 +71,7 @@ export const RosterForLoop = createCustomizableLunaticField<
-
+
{times(nbRows, (n) => {
const components = getComponents(n);
diff --git a/src/components/type.ts b/src/components/type.ts
index 21ac4cc38..5c7876726 100644
--- a/src/components/type.ts
+++ b/src/components/type.ts
@@ -94,7 +94,7 @@ type ComponentPropsByType = {
getComponents: (n: number) => FilledLunaticComponentProps[];
executeExpression: LunaticState['executeExpression'];
value: Record;
- headers?: Array<{ label: ReactNode }>;
+ header?: Array<{ label: ReactNode }>;
paginatedLoop?: boolean;
};
Loop: LunaticBaseProps & {
@@ -103,7 +103,7 @@ type ComponentPropsByType = {
getComponents: (n: number) => FilledLunaticComponentProps[];
executeExpression: LunaticState['executeExpression'];
value: Record;
- headers?: Array<{ label: ReactNode }>;
+ header?: Array<{ label: ReactNode }>;
paginatedLoop?: boolean;
};
Table: LunaticBaseProps & {
diff --git a/src/stories/loop/source-with-header.json b/src/stories/loop/source-with-header.json
index f72022ae7..fd7c342a2 100644
--- a/src/stories/loop/source-with-header.json
+++ b/src/stories/loop/source-with-header.json
@@ -14,7 +14,7 @@
{
"id": "loop-prenom",
"componentType": "RosterForLoop",
- "headers": [
+ "header": [
{ "headerCell": true, "label": "Prénom" },
{ "headerCell": true, "label": "Age" }
],
diff --git a/src/use-lunatic/commons/fill-components/fill-component-expressions.ts b/src/use-lunatic/commons/fill-components/fill-component-expressions.ts
index 4e229099b..6972daa16 100644
--- a/src/use-lunatic/commons/fill-components/fill-component-expressions.ts
+++ b/src/use-lunatic/commons/fill-components/fill-component-expressions.ts
@@ -26,7 +26,6 @@ const VTL_ATTRIBUTES = [
'xAxisIterations',
'yAxisIterations',
'conditionFilter',
- 'headers.label',
'header.label',
'disabled',
'readOnly',