@inseefr/lunatic 3.0.0-rc.6 → 3.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/lib/components/CheckboxGroup/CheckboxGroup.js +3 -2
  2. package/lib/components/CheckboxGroup/CustomCheckboxGroup.js +2 -3
  3. package/lib/components/CheckboxGroup/CustomCheckboxGroup.spec.js +3 -0
  4. package/lib/components/CheckboxOne/CheckboxOne.js +0 -1
  5. package/lib/components/Datepicker/Datepicker.js +0 -1
  6. package/lib/components/Dropdown/Dropdown.js +0 -17
  7. package/lib/components/Duration/Duration.js +0 -1
  8. package/lib/components/Input/Input.js +0 -1
  9. package/lib/components/InputNumber/InputNumber.js +0 -1
  10. package/lib/components/LunaticComponents.js +19 -15
  11. package/lib/components/RosterForLoop/RosterForLoop.js +0 -1
  12. package/lib/components/Roundabout/Roundabout.js +0 -1
  13. package/lib/components/Sequence/Sequence.js +0 -1
  14. package/lib/components/Subsequence/Subsequence.spec.js +1 -1
  15. package/lib/components/Suggester/CustomSuggester.js +7 -4
  16. package/lib/components/Suggester/Suggester.js +67 -4
  17. package/lib/components/Suggester/SuggesterType.js +5 -0
  18. package/lib/components/Textarea/Textarea.js +1 -2
  19. package/lib/components/shared/Button/Button.js +0 -1
  20. package/lib/components/shared/Button/IconButton.js +0 -1
  21. package/lib/components/shared/Checkbox/CheckboxOption.js +0 -1
  22. package/lib/components/shared/Combobox/Combobox.js +3 -2
  23. package/lib/components/shared/ComponentErrors/ComponentErrors.js +0 -1
  24. package/lib/components/shared/Declarations/Declarations.js +3 -4
  25. package/lib/components/shared/Declarations/Declarations.spec.js +5 -5
  26. package/lib/components/shared/Fieldset/Fieldset.js +0 -1
  27. package/lib/components/shared/Icons/lunatic-icon.js +0 -1
  28. package/lib/components/shared/Label/Label.js +0 -1
  29. package/lib/components/shared/Missing/Missing.js +0 -1
  30. package/lib/components/shared/ModalControls/ModalControls.js +0 -1
  31. package/lib/components/shared/Radio/RadioGroup.js +0 -1
  32. package/lib/components/shared/Table/Table.js +0 -1
  33. package/lib/components/shared/VariableStatus/VariableStatus.js +0 -1
  34. package/lib/components/shared/suggester-loader-widget/dragger/dragger.js +0 -1
  35. package/lib/components/shared/suggester-loader-widget/widget.js +0 -1
  36. package/lib/css/components/Button.scss +24 -0
  37. package/lib/css/components/CheckboxGroup.scss +13 -0
  38. package/lib/css/components/CheckboxOne.scss +19 -0
  39. package/lib/css/components/CheckboxOption.scss +19 -0
  40. package/lib/css/components/Combobox.scss +206 -0
  41. package/lib/css/components/ComponentErrors.scss +5 -0
  42. package/lib/css/components/Datepicker.scss +19 -0
  43. package/lib/css/components/Declarations.scss +42 -0
  44. package/lib/css/components/Dragger.scss +8 -0
  45. package/lib/css/components/Dropdown.scss +38 -0
  46. package/lib/css/components/Duration.scss +9 -0
  47. package/lib/css/components/Fieldset.scss +5 -0
  48. package/lib/css/components/IconButton.scss +38 -0
  49. package/lib/css/components/Input.scss +42 -0
  50. package/lib/css/components/InputNumber.scss +11 -0
  51. package/lib/css/components/Label.scss +6 -0
  52. package/lib/css/components/Missing.scss +27 -0
  53. package/lib/css/components/ModalControls.scss +48 -0
  54. package/lib/css/components/RadioGroup.scss +21 -0
  55. package/lib/css/components/RosterForLoop.scss +39 -0
  56. package/lib/css/components/Roundabout.scss +13 -0
  57. package/lib/css/components/Sequence.scss +10 -0
  58. package/lib/css/components/Suggester.scss +170 -0
  59. package/lib/css/components/SuggesterWidget.scss +176 -0
  60. package/lib/css/components/Table.scss +27 -0
  61. package/lib/css/components/Textarea.scss +8 -0
  62. package/lib/css/components/VariableStatus.scss +36 -0
  63. package/lib/css/main.scss +181 -0
  64. package/lib/hooks/useSuggesterInfo.js +14 -12
  65. package/lib/main.css +1063 -0
  66. package/lib/main.css.map +1 -0
  67. package/lib/src/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  68. package/lib/src/components/CheckboxOne/CheckboxOne.d.ts +0 -1
  69. package/lib/src/components/Datepicker/Datepicker.d.ts +0 -1
  70. package/lib/src/components/Dropdown/Dropdown.d.ts +0 -1
  71. package/lib/src/components/Duration/Duration.d.ts +0 -1
  72. package/lib/src/components/Input/Input.d.ts +0 -1
  73. package/lib/src/components/InputNumber/InputNumber.d.ts +0 -1
  74. package/lib/src/components/RosterForLoop/RosterForLoop.d.ts +0 -1
  75. package/lib/src/components/Roundabout/Roundabout.d.ts +0 -1
  76. package/lib/src/components/Sequence/Sequence.d.ts +1 -2
  77. package/lib/src/components/Subsequence/Subsequence.d.ts +1 -1
  78. package/lib/src/components/Suggester/CustomSuggester.d.ts +7 -3
  79. package/lib/src/components/Suggester/Suggester.d.ts +1 -2
  80. package/lib/src/components/Suggester/SuggesterType.d.ts +6 -0
  81. package/lib/src/components/Suggester/helpers.d.ts +2 -2
  82. package/lib/src/components/Textarea/Textarea.d.ts +0 -1
  83. package/lib/src/components/library.d.ts +3 -3
  84. package/lib/src/components/shared/Button/Button.d.ts +0 -1
  85. package/lib/src/components/shared/Button/IconButton.d.ts +0 -1
  86. package/lib/src/components/shared/Checkbox/CheckboxOption.d.ts +0 -1
  87. package/lib/src/components/shared/Combobox/Combobox.d.ts +1 -1
  88. package/lib/src/components/shared/ComponentErrors/ComponentErrors.d.ts +0 -1
  89. package/lib/src/components/shared/Declarations/Declarations.d.ts +2 -3
  90. package/lib/src/components/shared/Fieldset/Fieldset.d.ts +0 -1
  91. package/lib/src/components/shared/HOC/slottableComponent.d.ts +4 -0
  92. package/lib/src/components/shared/Icons/lunatic-icon.d.ts +0 -1
  93. package/lib/src/components/shared/Label/Label.d.ts +0 -1
  94. package/lib/src/components/shared/Missing/Missing.d.ts +0 -1
  95. package/lib/src/components/shared/ModalControls/ModalControls.d.ts +0 -1
  96. package/lib/src/components/shared/Radio/RadioGroup.d.ts +0 -1
  97. package/lib/src/components/shared/Table/Table.d.ts +0 -1
  98. package/lib/src/components/shared/VariableStatus/VariableStatus.d.ts +0 -1
  99. package/lib/src/components/shared/suggester-loader-widget/dragger/dragger.d.ts +0 -1
  100. package/lib/src/components/shared/suggester-loader-widget/widget.d.ts +0 -1
  101. package/lib/src/components/type.d.ts +7 -2
  102. package/lib/src/hooks/use-track-changes.d.ts +9 -1
  103. package/lib/src/hooks/useSuggesterInfo.d.ts +1 -1
  104. package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +106 -44
  105. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +87 -21
  106. package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +47 -36
  107. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +166 -46
  108. package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
  109. package/lib/src/use-lunatic/replace-component-sequence.d.ts +21 -3
  110. package/lib/src/use-lunatic/type-source.d.ts +55 -42
  111. package/lib/src/use-lunatic/type.d.ts +4 -4
  112. package/lib/src/use-lunatic/use-lunatic.d.ts +57 -15
  113. package/lib/src/utils/variables.d.ts +10 -2
  114. package/lib/stories/loop/source-roster.json +2 -2
  115. package/lib/stories/suggester/fakeReferentiel.json +12 -0
  116. package/lib/stories/suggester/source-option-responses.json +145 -0
  117. package/lib/stories/suggester/suggester.stories.js +46 -1
  118. package/lib/use-lunatic/use-lunatic.test.js +8 -7
  119. package/package.json +2 -2
  120. package/lib/components/Dropdown/DropdownWritable.js +0 -58
  121. package/lib/components/Dropdown/renderer/WritableLabelRenderer.js +0 -38
  122. package/lib/components/Dropdown/renderer/WritableOptionRenderer.js +0 -140
  123. package/lib/src/components/Dropdown/DropdownWritable.d.ts +0 -17
  124. package/lib/src/components/Dropdown/renderer/WritableLabelRenderer.d.ts +0 -8
  125. package/lib/src/components/Dropdown/renderer/WritableOptionRenderer.d.ts +0 -8
@@ -34,8 +34,8 @@ export type ControlType = {
34
34
  typeOfControl: 'FORMAT' | 'CONSISTENCY';
35
35
  control: LabelType;
36
36
  errorMessage: LabelType;
37
- bindingDependencies: string[];
38
- type: 'roundabout' | 'ROW' | 'simple';
37
+ bindingDependencies?: string[];
38
+ type?: 'roundabout' | 'ROW' | 'simple';
39
39
  iterations?: number;
40
40
  };
41
41
  export type ResponseType = {
@@ -52,6 +52,7 @@ export type Hierarchy = {
52
52
  };
53
53
  export type ComponentTypeBase = {
54
54
  label: LabelType;
55
+ description?: LabelType;
55
56
  declarations?: DeclarationType[];
56
57
  conditionFilter?: ConditionFilterType;
57
58
  controls?: ControlType[];
@@ -61,9 +62,7 @@ export type ComponentTypeBase = {
61
62
  mandatory?: boolean;
62
63
  page: string;
63
64
  };
64
- export type ComponentType = (ComponentTypeBase & ComponentSequenceType) | (ComponentTypeBase & ComponentSubSequenceType) | (ComponentTypeBase & ComponentRosterForLoopType) | (ComponentTypeBase & ComponentLoopType) | (ComponentTypeBase & ComponentTableType) | (ComponentTypeBase & ComponentNumberType) | (ComponentTypeBase & ComponentDatePickerType) | (ComponentTypeBase & ComponentCheckboxGroupType) | (ComponentTypeBase & ComponentCheckboxBooleanType) | (ComponentTypeBase & ComponentRadioType) | (ComponentTypeBase & ComponentFilterDescriptionType) | (ComponentTypeBase & ComponentDropdownType) | (ComponentTypeBase & ComponentPairWiseLinksType) | (ComponentTypeBase & ComponentRoundaboutType) | (ComponentTypeBase & ComponentSuggesterType) | (ComponentTypeBase & ComponentInputOrTextareaType) | (ComponentTypeBase & {
65
- componentType: 'CheckboxOne';
66
- }) | (ComponentTypeBase & ComponentQuestionType);
65
+ export type ComponentType = (ComponentTypeBase & ComponentSequenceType) | (ComponentTypeBase & ComponentSubSequenceType) | (ComponentTypeBase & ComponentRosterForLoopType) | (ComponentTypeBase & ComponentLoopType) | (ComponentTypeBase & ComponentTableType) | (ComponentTypeBase & ComponentNumberType) | (ComponentTypeBase & ComponentDatePickerType) | (ComponentTypeBase & ComponentCheckboxGroupType) | (ComponentTypeBase & ComponentCheckboxBooleanType) | (ComponentTypeBase & ComponentRadioType) | (ComponentTypeBase & ComponentFilterDescriptionType) | (ComponentTypeBase & ComponentDropdownType) | (Omit<ComponentTypeBase, 'label'> & ComponentPairWiseLinksType) | (ComponentTypeBase & ComponentRoundaboutType) | (ComponentTypeBase & ComponentSuggesterType) | (ComponentTypeBase & ComponentInputOrTextareaType) | (ComponentTypeBase & ComponentCheckboxOneType) | (ComponentTypeBase & ComponentQuestionType);
67
66
  export type ComponentTypeEnum = ComponentType['componentType'];
68
67
  export type ComponentInputOrTextareaType = {
69
68
  componentType: 'Input' | 'Textarea';
@@ -73,10 +72,10 @@ export type ComponentInputOrTextareaType = {
73
72
  };
74
73
  export type ComponentSequenceType = {
75
74
  componentType: 'Sequence';
75
+ gotoPage?: string;
76
76
  };
77
77
  export type ComponentSubSequenceType = {
78
78
  componentType: 'Subsequence';
79
- gotoPage: string;
80
79
  };
81
80
  export type ComponentRoundaboutType = {
82
81
  componentType: 'Roundabout';
@@ -92,47 +91,48 @@ export type ComponentRosterForLoopType = {
92
91
  min: LabelType;
93
92
  max: LabelType;
94
93
  };
95
- header: {
94
+ header?: {
96
95
  value: string;
97
96
  label: LabelType | string;
98
- options: {
99
- value: string;
100
- label: LabelType;
101
- }[];
97
+ options: Options;
102
98
  colspan?: number;
103
99
  rowspan?: number;
104
100
  }[];
105
- body: ({
106
- label: LabelType;
107
- colspan?: number;
108
- rowspan?: number;
109
- } | (ComponentType & {
110
- colspan?: number;
111
- rowspan?: number;
112
- }))[][];
113
101
  positioning: 'HORIZONTAL';
114
102
  };
115
- export type ComponentLoopType = {
116
- componentType: 'Loop';
117
- loopDependencies: string[];
103
+ type PaginatedLoop = {
104
+ paginatedLoop: true;
105
+ maxPage: string;
106
+ iterations: LabelType;
107
+ };
108
+ type BlockLoop = {
109
+ paginatedLoop: false;
118
110
  lines: {
119
111
  min: LabelType;
120
112
  max: LabelType;
121
113
  };
114
+ };
115
+ export type ComponentLoopType = {
116
+ componentType: 'Loop';
117
+ loopDependencies: string[];
122
118
  components: ComponentType[];
123
- iterations: LabelType;
124
- maxPage: string;
125
119
  depth: number;
126
- paginatedLoop: boolean;
127
- };
120
+ } & (PaginatedLoop | BlockLoop);
128
121
  export type ComponentTableType = {
129
122
  componentType: 'Table';
130
123
  header: ComponentRosterForLoopType['header'];
131
- body: ComponentRosterForLoopType['body'];
124
+ body: ({
125
+ label: LabelType;
126
+ colspan?: number;
127
+ rowspan?: number;
128
+ } | (ComponentType & {
129
+ colspan?: number;
130
+ rowspan?: number;
131
+ }))[][];
132
132
  };
133
133
  export type ComponentNumberType = {
134
134
  componentType: 'InputNumber';
135
- unit: string;
135
+ unit?: string;
136
136
  response: ResponseType;
137
137
  min?: number;
138
138
  max?: number;
@@ -147,8 +147,10 @@ export type ComponentDatePickerType = {
147
147
  };
148
148
  export type ComponentCheckboxGroupType = {
149
149
  componentType: 'CheckboxGroup';
150
+ description?: LabelType;
150
151
  responses: Array<{
151
152
  label: LabelType;
153
+ description?: LabelType;
152
154
  response: ResponseType;
153
155
  id: string;
154
156
  }>;
@@ -158,21 +160,26 @@ export type ComponentCheckboxBooleanType = {
158
160
  response: ResponseType;
159
161
  missingResponse?: ResponseType;
160
162
  };
163
+ type Options = {
164
+ value: string;
165
+ label: LabelType;
166
+ description?: LabelType;
167
+ }[];
168
+ export type ComponentCheckboxOneType = {
169
+ componentType: 'CheckboxOne';
170
+ response: ResponseType;
171
+ missingResponse?: ResponseType;
172
+ options: Options;
173
+ };
161
174
  export type ComponentRadioType = {
162
175
  componentType: 'Radio';
163
- options: {
164
- value: string;
165
- label: LabelType;
166
- }[];
176
+ options: Options;
167
177
  response: ResponseType;
168
178
  missingResponse?: ResponseType;
169
179
  };
170
180
  export type ComponentDropdownType = {
171
181
  componentType: 'Dropdown';
172
- options: {
173
- value: string;
174
- label: LabelType;
175
- }[];
182
+ options: Options;
176
183
  response: ResponseType;
177
184
  missingResponse?: ResponseType;
178
185
  };
@@ -185,7 +192,7 @@ export type ComponentPairWiseLinksType = {
185
192
  xAxisIterations: LabelType;
186
193
  yAxisIterations: LabelType;
187
194
  symLinks: {
188
- [variableName: string]: Record<string, string>;
195
+ [variableName: string]: Record<string, string | null>;
189
196
  };
190
197
  components: ComponentType[];
191
198
  };
@@ -197,21 +204,26 @@ export type ComponentQuestionType = {
197
204
  export type ComponentSuggesterType = {
198
205
  componentType: 'Suggester';
199
206
  storeName: string;
207
+ response: ResponseType;
208
+ optionResponses: {
209
+ name: string;
210
+ attribute: string;
211
+ };
200
212
  };
201
213
  export type SuggesterType = {
202
214
  name: string;
203
215
  fields: {
204
216
  name: string;
205
217
  min?: number;
206
- rules?: string[];
218
+ rules?: 'soft' | string[];
207
219
  language?: 'French' | 'English';
208
220
  stemmer?: boolean;
209
- synonyms: {
221
+ synonyms?: {
210
222
  source: string;
211
223
  target: string[];
212
224
  }[];
213
225
  }[];
214
- max: number;
226
+ max?: number;
215
227
  stopWords?: string;
216
228
  order?: {
217
229
  field: string;
@@ -243,7 +255,7 @@ export type Variable = {
243
255
  variableType: 'CALCULATED';
244
256
  name: string;
245
257
  expression: LabelType;
246
- bindingDependencies: string[];
258
+ bindingDependencies?: string[];
247
259
  inFilter: string;
248
260
  shapeFrom?: string;
249
261
  };
@@ -265,7 +277,7 @@ export type LunaticSource = {
265
277
  [variableName: string]: string;
266
278
  };
267
279
  };
268
- missingBlock: {
280
+ missingBlock?: {
269
281
  [variableName: string]: string[];
270
282
  };
271
283
  resizing: {
@@ -289,3 +301,4 @@ export type LunaticSource = {
289
301
  };
290
302
  };
291
303
  };
304
+ export {};
@@ -9,9 +9,9 @@ export type LunaticControl = ControlType;
9
9
  export type VTLBindings = {
10
10
  [variableName: string]: unknown;
11
11
  };
12
- export type LunaticData = Record<Exclude<VariableType, 'COLLECTED'>, Record<string, unknown>> & {
12
+ export type LunaticData = Partial<Record<Exclude<VariableType, 'COLLECTED'>, Record<string, unknown>> & {
13
13
  COLLECTED: Record<string, LunaticCollectedValue>;
14
- };
14
+ }>;
15
15
  export type LunaticValues = {
16
16
  [variableName: string]: unknown;
17
17
  };
@@ -27,13 +27,13 @@ export type LunaticExpression = {
27
27
  };
28
28
  export type TODO = unknown;
29
29
  export type LunaticVariable = Variable;
30
- export type LunaticCollectedValue = {
30
+ export type LunaticCollectedValue = Partial<{
31
31
  COLLECTED: unknown;
32
32
  EDITED: unknown;
33
33
  FORCED: unknown;
34
34
  INPUTED: unknown;
35
35
  PREVIOUS: unknown;
36
- };
36
+ }>;
37
37
  export type LunaticOverviewItem = {
38
38
  id: string;
39
39
  page: string;
@@ -1,8 +1,16 @@
1
1
  /// <reference types="react" />
2
- import type { LunaticData, LunaticState } from './type';
2
+ import type { LunaticState } from './type';
3
3
  import type { LunaticSource } from './type-source';
4
4
  import type { LunaticComponentType } from '../components/type';
5
- declare function useLunatic(source: LunaticSource, data: LunaticData | undefined, { features, preferences, savingType, onChange, management, shortcut, initialPage, lastReachedPage, autoSuggesterLoading, activeControls, getReferentiel, withOverview, missing, missingStrategy, missingShortcut, dontKnowButton, refusedButton, workersBasePath, trackChanges, }: {
5
+ declare function useLunatic(source: LunaticSource, data: Partial<Record<"EXTERNAL" | "CALCULATED", Record<string, unknown>> & {
6
+ COLLECTED: Record<string, Partial<{
7
+ COLLECTED: unknown;
8
+ EDITED: unknown;
9
+ FORCED: unknown;
10
+ INPUTED: unknown;
11
+ PREVIOUS: unknown;
12
+ }>>;
13
+ }> | undefined, { features, preferences, savingType, onChange, management, shortcut, initialPage, lastReachedPage, autoSuggesterLoading, activeControls, getReferentiel, withOverview, missing, missingStrategy, missingShortcut, dontKnowButton, refusedButton, workersBasePath, trackChanges, }: {
6
14
  features?: LunaticState['features'];
7
15
  preferences?: LunaticState['preferences'];
8
16
  savingType?: LunaticState['savingType'];
@@ -50,9 +58,9 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
50
58
  name: string;
51
59
  };
52
60
  };
53
- Sequence: Pick<import("../components/type").LunaticBaseProps<string>, "id" | "label" | "style" | "description" | "declarations">;
54
- Subsequence: Pick<import("../components/type").LunaticBaseProps<string>, "id" | "label" | "declarations">;
55
- Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "id" | "label" | "description" | "declarations"> & {
61
+ Sequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id" | "style">;
62
+ Subsequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "declarations" | "id">;
63
+ Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description" | "declarations" | "id"> & {
56
64
  components: import("./commons/fill-components/fill-components").FilledLunaticComponentProps[];
57
65
  };
58
66
  RosterForLoop: import("../components/type").LunaticBaseProps<unknown> & {
@@ -193,7 +201,6 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
193
201
  response: {
194
202
  name: string;
195
203
  };
196
- writable?: boolean | undefined;
197
204
  };
198
205
  Textarea: import("../components/type").LunaticBaseProps<string> & {
199
206
  cols?: number | undefined;
@@ -204,7 +211,7 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
204
211
  name: string;
205
212
  };
206
213
  };
207
- FilterDescription: Pick<import("../components/type").LunaticBaseProps<string>, "id" | "label">;
214
+ FilterDescription: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "id">;
208
215
  PairwiseLinks: Omit<import("../components/type").LunaticBaseProps<unknown>, "value"> & {
209
216
  components: import("./type").LunaticComponentDefinition[];
210
217
  features?: ["VTL"] | ["VTL", "MD"] | undefined;
@@ -241,6 +248,16 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
241
248
  response: {
242
249
  name: string;
243
250
  };
251
+ optionResponses?: {
252
+ name: string;
253
+ attribute: string;
254
+ }[] | undefined;
255
+ executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
256
+ iteration?: number | number[] | undefined;
257
+ bindingDependencies?: string[] | undefined;
258
+ deps?: string[] | undefined;
259
+ } | undefined) => T;
260
+ iteration: number | undefined;
244
261
  };
245
262
  Summary: import("../components/type").LunaticBaseProps<string | null> & {
246
263
  executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
@@ -283,9 +300,9 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
283
300
  name: string;
284
301
  };
285
302
  };
286
- Sequence: Pick<import("../components/type").LunaticBaseProps<string>, "id" | "label" | "style" | "description" | "declarations">;
287
- Subsequence: Pick<import("../components/type").LunaticBaseProps<string>, "id" | "label" | "declarations">;
288
- Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "id" | "label" | "description" | "declarations"> & {
303
+ Sequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id" | "style">;
304
+ Subsequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "declarations" | "id">;
305
+ Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description" | "declarations" | "id"> & {
289
306
  components: import("./commons/fill-components/fill-components").FilledLunaticComponentProps[];
290
307
  };
291
308
  RosterForLoop: import("../components/type").LunaticBaseProps<unknown> & {
@@ -426,7 +443,6 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
426
443
  response: {
427
444
  name: string;
428
445
  };
429
- writable?: boolean | undefined;
430
446
  };
431
447
  Textarea: import("../components/type").LunaticBaseProps<string> & {
432
448
  cols?: number | undefined;
@@ -437,7 +453,7 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
437
453
  name: string;
438
454
  };
439
455
  };
440
- FilterDescription: Pick<import("../components/type").LunaticBaseProps<string>, "id" | "label">;
456
+ FilterDescription: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "id">;
441
457
  PairwiseLinks: Omit<import("../components/type").LunaticBaseProps<unknown>, "value"> & {
442
458
  components: import("./type").LunaticComponentDefinition[];
443
459
  features?: ["VTL"] | ["VTL", "MD"] | undefined;
@@ -474,6 +490,16 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
474
490
  response: {
475
491
  name: string;
476
492
  };
493
+ optionResponses?: {
494
+ name: string;
495
+ attribute: string;
496
+ }[] | undefined;
497
+ executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
498
+ iteration?: number | number[] | undefined;
499
+ bindingDependencies?: string[] | undefined;
500
+ deps?: string[] | undefined;
501
+ } | undefined) => T;
502
+ iteration: number | undefined;
477
503
  };
478
504
  Summary: import("../components/type").LunaticBaseProps<string | null> & {
479
505
  executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
@@ -493,7 +519,7 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
493
519
  }[];
494
520
  };
495
521
  })[] | undefined;
496
- }) => import("./commons/fill-components/fill-components").FilledLunaticComponentProps<"CheckboxOne" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "Question">[];
522
+ }) => import("./commons/fill-components/fill-components").FilledLunaticComponentProps<"Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "CheckboxOne" | "Question">[];
497
523
  goPreviousPage: () => void;
498
524
  goNextPage: (payload?: {}) => void;
499
525
  goToPage: (page: {
@@ -521,7 +547,15 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
521
547
  linksIterations?: number[] | undefined;
522
548
  };
523
549
  waiting: boolean;
524
- getData: (withRefreshedCalculated: boolean, variableNames?: string[]) => LunaticData;
550
+ getData: (withRefreshedCalculated: boolean, variableNames?: string[]) => Partial<Record<"EXTERNAL" | "CALCULATED", Record<string, unknown>> & {
551
+ COLLECTED: Record<string, Partial<{
552
+ COLLECTED: unknown;
553
+ EDITED: unknown;
554
+ FORCED: unknown;
555
+ INPUTED: unknown;
556
+ PREVIOUS: unknown;
557
+ }>>;
558
+ }>;
525
559
  Provider: import("react").FunctionComponent<{
526
560
  children?: import("react").ReactNode;
527
561
  }>;
@@ -540,7 +574,15 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
540
574
  children: import("./commons/getOverview").OverviewItem[];
541
575
  }[];
542
576
  loopVariables: string[];
543
- getChangedData: (reset?: boolean) => LunaticData;
577
+ getChangedData: (reset?: boolean) => Partial<Record<"EXTERNAL" | "CALCULATED", Record<string, unknown>> & {
578
+ COLLECTED: Record<string, Partial<{
579
+ COLLECTED: unknown;
580
+ EDITED: unknown;
581
+ FORCED: unknown;
582
+ INPUTED: unknown;
583
+ PREVIOUS: unknown;
584
+ }>>;
585
+ }>;
544
586
  resetChangedData: () => void;
545
587
  hasPageResponse: () => boolean;
546
588
  };
@@ -1,5 +1,13 @@
1
- import type { LunaticData, LunaticVariable } from '../use-lunatic/type';
1
+ import type { LunaticVariable } from '../use-lunatic/type';
2
2
  /**
3
3
  * Extract the initial value from the source.json and data.json
4
4
  */
5
- export declare function getInitialVariableValue(variable: LunaticVariable, data?: LunaticData): unknown;
5
+ export declare function getInitialVariableValue(variable: LunaticVariable, data?: Partial<Record<"EXTERNAL" | "CALCULATED", Record<string, unknown>> & {
6
+ COLLECTED: Record<string, Partial<{
7
+ COLLECTED: unknown;
8
+ EDITED: unknown;
9
+ FORCED: unknown;
10
+ INPUTED: unknown;
11
+ PREVIOUS: unknown;
12
+ }>>;
13
+ }>): unknown;
@@ -18,8 +18,8 @@
18
18
  "conditionFilter": { "value": "true", "type": "VTL" },
19
19
  "bindingDependencies": ["PRENOM"],
20
20
  "lines": {
21
- "min": { "value": 1, "type": "VTL" },
22
- "max": { "value": 10, "type": "VTL" }
21
+ "min": { "value": "1", "type": "VTL" },
22
+ "max": { "value": "10", "type": "VTL" }
23
23
  },
24
24
  "page": "1",
25
25
  "components": [
@@ -0,0 +1,12 @@
1
+ [
2
+ {
3
+ "id": "brosse",
4
+ "label": "Brosse à cheveux",
5
+ "price": 20
6
+ },
7
+ {
8
+ "id": "balle",
9
+ "label": "Balle rebondissante",
10
+ "price": 10
11
+ }
12
+ ]
@@ -0,0 +1,145 @@
1
+ {
2
+ "suggesters": [
3
+ {
4
+ "name": "products",
5
+ "fields": [
6
+ {
7
+ "name": "label",
8
+ "rules": ["[\\w]+"],
9
+ "language": "French",
10
+ "min": 3,
11
+ "stemmer": false
12
+ }
13
+ ],
14
+ "queryParser": {
15
+ "type": "tokenized",
16
+ "params": {
17
+ "language": "French",
18
+ "pattern": "[\\w.]+",
19
+ "min": 3,
20
+ "stemmer": false
21
+ }
22
+ },
23
+ "version": "1"
24
+ }
25
+ ],
26
+ "components": [
27
+ {
28
+ "componentType": "Suggester",
29
+ "response": {
30
+ "name": "PRODUCT"
31
+ },
32
+ "optionResponses": [
33
+ {
34
+ "name": "PRODUCT_NAME",
35
+ "attribute": "label"
36
+ },
37
+ {
38
+ "name": "PRODUCT_PRICE",
39
+ "attribute": "price"
40
+ }
41
+ ],
42
+ "storeName": "products",
43
+ "conditionFilter": {
44
+ "type": "VTL",
45
+ "value": "true"
46
+ },
47
+ "id": "lt4ezymk",
48
+ "page": "1",
49
+ "label": {
50
+ "type": "VTL|MD",
51
+ "value": "\"➡ 1. \" || \"Quel est votre produit préféré ?\""
52
+ },
53
+ "mandatory": false,
54
+ "maxLength": 249
55
+ },
56
+ {
57
+ "componentType": "Input",
58
+ "response": {
59
+ "name": "NOM"
60
+ },
61
+ "conditionFilter": {
62
+ "type": "VTL",
63
+ "value": "true"
64
+ },
65
+ "id": "prenom",
66
+ "page": "2",
67
+ "label": {
68
+ "type": "VTL|MD",
69
+ "value": "\"➡ 2. Vous aimez \" || PRODUCT_NAME || \" à \" || cast(PRODUCT_PRICE, string) || \"€ mais quel est votre prénom ?\""
70
+ },
71
+ "mandatory": false,
72
+ "maxLength": 249
73
+ }
74
+ ],
75
+ "pagination": "question",
76
+ "resizing": {},
77
+ "label": {
78
+ "type": "VTL|MD",
79
+ "value": "Suggester"
80
+ },
81
+ "lunaticModelVersion": "2.5.0",
82
+ "modele": "SUGGESTER",
83
+ "enoCoreVersion": "2.7.1",
84
+ "generatingDate": "27-02-2024 13:43:43",
85
+ "missing": false,
86
+ "id": "lt4f6mib",
87
+ "maxPage": "2",
88
+ "variables": [
89
+ {
90
+ "variableType": "COLLECTED",
91
+ "values": {
92
+ "COLLECTED": null,
93
+ "EDITED": null,
94
+ "INPUTED": null,
95
+ "FORCED": null,
96
+ "PREVIOUS": null
97
+ },
98
+ "name": "PRODUCT"
99
+ },
100
+ {
101
+ "variableType": "COLLECTED",
102
+ "values": {
103
+ "COLLECTED": null,
104
+ "EDITED": null,
105
+ "INPUTED": null,
106
+ "FORCED": null,
107
+ "PREVIOUS": null
108
+ },
109
+ "name": "PRODUCT_PRICE"
110
+ },
111
+ {
112
+ "variableType": "COLLECTED",
113
+ "values": {
114
+ "COLLECTED": null,
115
+ "EDITED": null,
116
+ "INPUTED": null,
117
+ "FORCED": null,
118
+ "PREVIOUS": null
119
+ },
120
+ "name": "PRODUCT_NAME"
121
+ },
122
+ {
123
+ "variableType": "COLLECTED",
124
+ "values": {
125
+ "COLLECTED": null,
126
+ "EDITED": null,
127
+ "INPUTED": null,
128
+ "FORCED": null,
129
+ "PREVIOUS": null
130
+ },
131
+ "name": "PRODUCT_PRICE"
132
+ },
133
+ {
134
+ "variableType": "COLLECTED",
135
+ "values": {
136
+ "COLLECTED": null,
137
+ "EDITED": null,
138
+ "INPUTED": null,
139
+ "FORCED": null,
140
+ "PREVIOUS": null
141
+ },
142
+ "name": "PRENOM"
143
+ }
144
+ ]
145
+ }