Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Add global variables for pairwise component. `GLOBAL_PARENT1_PRENOM`, `GLOBAL_PARENT1_SEXE`, `GLOBAL_PARENT2_PRENOM`, `GLOBAL_PARENT2_SEXE`, `GLOBAL_CONJOINT_PRENOM` and `GLOBAL_ENFANTS_PRENOMS` are now available if the corresponding source variables of the pairwise component are filled in.
- Radio, Dropdown and CheckboxOne can now have options based on a variable by specifying `optionSource` and filtered through `optionFilter`.

## [3.7.7](https://github.com/InseeFr/Lunatic/releases/tag/3.7.7) - 2026-01-14

Expand Down
62 changes: 48 additions & 14 deletions lunatic-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
"rules": {
"type": "object",
"additionalProperties": {
"type": "object",
"$ref": "#/$defs/VTLExpression"
}
}
Expand All @@ -238,7 +237,6 @@
"rules": {
"type": "object",
"additionalProperties": {
"type": "object",
"$ref": "#/$defs/VTLExpression"
}
}
Expand Down Expand Up @@ -952,16 +950,21 @@
"orientation": {
"type": "string",
"enum": ["horizontal", "vertical"]
},
"options": {
"$ref": "#/$defs/OptionsWithDetail"
}
},
"required": ["componentType", "options"],
"required": ["componentType"],
"allOf": [
{
"$ref": "#/$defs/ComponentDefinitionBaseWithResponse"
}
],
"oneOf": [
{
"$ref": "#/$defs/StaticOptions"
},
{
"$ref": "#/$defs/OptionsFromVariable"
}
]
},
"ComponentDropdownDefinition": {
Expand All @@ -970,16 +973,21 @@
"componentType": {
"type": "string",
"const": "Dropdown"
},
"options": {
"$ref": "#/$defs/Options"
}
},
"required": ["componentType", "options"],
"required": ["componentType"],
"allOf": [
{
"$ref": "#/$defs/ComponentDefinitionBaseWithResponse"
}
],
"oneOf": [
{
"$ref": "#/$defs/StaticOptions"
},
{
"$ref": "#/$defs/OptionsFromVariable"
}
]
},
"ComponentQuestionDefinition": {
Expand Down Expand Up @@ -1009,16 +1017,21 @@
"componentType": {
"type": "string",
"const": "CheckboxOne"
},
"options": {
"$ref": "#/$defs/OptionsWithDetail"
}
},
"required": ["componentType", "options"],
"required": ["componentType"],
"allOf": [
{
"$ref": "#/$defs/ComponentDefinitionBaseWithResponse"
}
],
"oneOf": [
{
"$ref": "#/$defs/StaticOptions"
},
{
"$ref": "#/$defs/OptionsFromVariable"
}
]
},
"ComponentSuggesterDefinition": {
Expand Down Expand Up @@ -1391,6 +1404,27 @@
],
"type": "object"
},
"StaticOptions": {
"type": "object",
"properties": {
"options": {
"$ref": "#/$defs/OptionsWithDetail"
}
},
"required": ["options"]
},
"OptionsFromVariable": {
"type": "object",
"properties": {
"optionSource": {
"type": "string"
},
"optionFilter": {
"$ref": "#/$defs/VTLExpression"
}
},
"required": ["optionSource"]
},
"Options": {
"type": "array",
"items": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inseefr/lunatic",
"version": "3.11.2",
"version": "3.12.0-rc.ucq-options-variable.0",
"description": "Library of questionnaire components",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/stories/checkbox/checkbox.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dataFromObject } from '../../utils/object';
import {
type Orchestrator,
OrchestratorMeta,
Expand All @@ -10,6 +11,7 @@ import sourceGroupDetail from './sourceGroupDetail.json';
import sourceGroupLoop from './sourceGroupLoop.json';
import sourceOne from './sourceOne.json';
import sourceOneDetail from './sourceOneDetail.json';
import sourceOneDynamicOptions from './sourceOneDynamicOptions.json';

import { Meta } from '@storybook/react';

Expand Down Expand Up @@ -73,3 +75,14 @@ export const CheckboxOneWithDetail: OrchestratorStory = {
source: sourceOneDetail,
},
};

export const CheckboxOneDynamicOptions: OrchestratorStory = {
args: {
source: sourceOneDynamicOptions,
data: dataFromObject({
NBHAB: 3,
PRENOM: ['Verso', 'Maëlle', 'Aline'],
AGE: [30, 16, 50],
}),
},
};
Loading
Loading