@inseefr/lunatic 2.4.10 → 2.5.0-fast-forward

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 (103) hide show
  1. package/lib/components/commons/components/orchestrated-component.js +10 -30
  2. package/lib/components/commons/create-row-orchestrator.js +7 -2
  3. package/lib/components/component-set/html/component-set-components.js +16 -25
  4. package/lib/components/component-set/lunatic-component-set.js +23 -37
  5. package/lib/components/index.js +14 -0
  6. package/lib/components/loop/block-for-loop/block-for-loop.js +4 -2
  7. package/lib/components/loop/block-for-loop/row.js +4 -2
  8. package/lib/components/loop/loop.js +6 -3
  9. package/lib/components/loop/roster-for-loop/body.js +4 -2
  10. package/lib/components/loop/roster-for-loop/roster-for-loop.js +2 -0
  11. package/lib/components/loop/roster-for-loop/roster-table.js +4 -2
  12. package/lib/components/loop/roster-for-loop/row.js +3 -1
  13. package/lib/components/question-explication/html/question-explication.js +53 -0
  14. package/lib/components/question-explication/html/question-explication.scss +35 -0
  15. package/lib/components/question-explication/index.js +13 -0
  16. package/lib/components/question-explication/lunatic-question-explication.js +32 -0
  17. package/lib/components/question-explication/question-explication.spec.js +49 -0
  18. package/lib/components/roundabout/lunatic-roundabout.js +2 -4
  19. package/lib/components/subsequence/subsequence.js +0 -2
  20. package/lib/components/subsequence/subsequence.spec.js +2 -2
  21. package/lib/components/summary/html/summary-container.js +14 -0
  22. package/lib/components/summary/html/summary-responses.js +53 -0
  23. package/lib/components/summary/html/summary-title.js +20 -0
  24. package/lib/components/summary/index.js +12 -0
  25. package/lib/components/summary/lunatic-summary.js +99 -0
  26. package/lib/src/components/commons/components/orchestrated-component.d.ts +4 -5
  27. package/lib/src/components/commons/create-row-orchestrator.d.ts +3 -2
  28. package/lib/src/components/component-set/html/component-set-components.d.ts +2 -2
  29. package/lib/src/components/component-set/lunatic-component-set.d.ts +2 -1
  30. package/lib/src/components/index.d.ts +2 -0
  31. package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +3 -2
  32. package/lib/src/components/loop/block-for-loop/row.d.ts +2 -1
  33. package/lib/src/components/loop/roster-for-loop/body.d.ts +2 -2
  34. package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +3 -2
  35. package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +2 -2
  36. package/lib/src/components/loop/roster-for-loop/row.d.ts +2 -1
  37. package/lib/src/components/question-explication/html/question-explication.d.ts +7 -0
  38. package/lib/src/components/question-explication/index.d.ts +1 -0
  39. package/lib/src/components/question-explication/lunatic-question-explication.d.ts +3 -0
  40. package/lib/src/components/question-explication/question-explication.spec.d.ts +1 -0
  41. package/lib/src/components/subsequence/subsequence.d.ts +2 -2
  42. package/lib/src/components/summary/html/summary-container.d.ts +2 -0
  43. package/lib/src/components/summary/html/summary-responses.d.ts +12 -0
  44. package/lib/src/components/summary/html/summary-title.d.ts +5 -0
  45. package/lib/src/components/summary/index.d.ts +1 -0
  46. package/lib/src/components/summary/lunatic-summary.d.ts +7 -0
  47. package/lib/src/components/type.d.ts +18 -0
  48. package/lib/src/index.d.ts +1 -0
  49. package/lib/src/use-lunatic/actions.d.ts +8 -169
  50. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +137 -112
  51. package/lib/src/use-lunatic/commons/fill-components/fill-missing-response.d.ts +2 -1
  52. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +115 -94
  53. package/lib/src/use-lunatic/commons/page-navigation.d.ts +7 -0
  54. package/lib/src/use-lunatic/commons/page-navigation.spec.d.ts +1 -0
  55. package/lib/src/use-lunatic/commons/page.d.ts +11 -0
  56. package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
  57. package/lib/src/use-lunatic/reducer/commons/auto-explore-loop.d.ts +5 -0
  58. package/lib/src/use-lunatic/reducer/commons/index.d.ts +0 -1
  59. package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
  60. package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -7
  61. package/lib/src/use-lunatic/reducer/reduce-on-init.d.ts +1 -1
  62. package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -3
  63. package/lib/src/use-lunatic/type-source.d.ts +27 -13
  64. package/lib/src/use-lunatic/type.d.ts +4 -12
  65. package/lib/src/use-lunatic/use-lunatic.d.ts +475 -10
  66. package/lib/src/utils/store-tools/worker-path.d.ts +1 -0
  67. package/lib/stories/component-set/component-set.stories.js +2 -1
  68. package/lib/stories/loop/block-for-loop.stories.js +8 -1
  69. package/lib/stories/loop/roster-for-loop.stories.js +92 -2
  70. package/lib/{use-lunatic/reducer/reduce-roundabout.js → stories/question-explication/question-explication.stories.js} +21 -17
  71. package/lib/stories/question-explication/source.json +17 -0
  72. package/lib/stories/roundabout/roundabout.stories.js +2 -1
  73. package/lib/stories/suggester/source-component-set.json +67 -0
  74. package/lib/stories/suggester/suggester.stories.js +9 -1
  75. package/lib/stories/summary/data.json +32 -0
  76. package/lib/stories/summary/source.json +353 -0
  77. package/lib/stories/summary/summary.stories.js +37 -0
  78. package/lib/stories/utils/orchestrator.js +21 -6
  79. package/lib/use-lunatic/commons/check-pager.js +1 -2
  80. package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +14 -12
  81. package/lib/use-lunatic/commons/page-navigation.js +109 -0
  82. package/lib/use-lunatic/commons/page-navigation.spec.js +129 -0
  83. package/lib/use-lunatic/commons/page.js +44 -0
  84. package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +37 -0
  85. package/lib/use-lunatic/reducer/commons/index.js +0 -8
  86. package/lib/use-lunatic/reducer/reduce-go-next-page.js +25 -159
  87. package/lib/use-lunatic/reducer/reduce-go-previous-page.js +21 -127
  88. package/lib/use-lunatic/reducer/reduce-go-to-page.js +51 -55
  89. package/lib/use-lunatic/reducer/reduce-on-init.js +8 -10
  90. package/lib/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.js +1 -1
  91. package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +1 -1
  92. package/lib/use-lunatic/type-source.js +0 -2
  93. package/lib/use-lunatic/use-lunatic.js +22 -4
  94. package/lib/use-lunatic/use-lunatic.test.js +9 -7
  95. package/lib/utils/store-tools/auto-load.js +2 -2
  96. package/lib/utils/store-tools/worker-path.js +13 -0
  97. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -2
  98. package/package.json +3 -4
  99. package/lib/components/button/__snapshots__/lunatic-button.spec.jsx.snap +0 -80
  100. package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.jsx.snap +0 -81
  101. package/lib/src/use-lunatic/reducer/commons/is-empty-on-empty-page.d.ts +0 -3
  102. package/lib/src/use-lunatic/reducer/reduce-roundabout.d.ts +0 -2
  103. package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +0 -32
@@ -41,6 +41,7 @@ export type ActionInit = {
41
41
  data: LunaticData;
42
42
  source: LunaticSource;
43
43
  initialPage: string;
44
+ lastReachedPage: string;
44
45
  features: LunaticState['features'];
45
46
  preferences: LunaticState['preferences'];
46
47
  savingType: LunaticState['savingType'];
@@ -48,7 +49,7 @@ export type ActionInit = {
48
49
  management: boolean;
49
50
  handleChange: LunaticState['handleChange'];
50
51
  activeControls: boolean;
51
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
52
+ goToPage: (params: ActionGoToPage['payload']) => void;
52
53
  withOverview: boolean;
53
54
  };
54
55
  };
@@ -85,135 +86,24 @@ export declare const goPreviousPage: () => {
85
86
  readonly type: ActionKind.GO_PREVIOUS_PAGE;
86
87
  readonly payload: {};
87
88
  };
88
- export declare const goNextPage: (payload: {} | {
89
- page: string;
90
- iteration?: number | undefined;
91
- nbIterations?: number | undefined;
92
- subPage?: number | undefined;
93
- roundabout?: {
94
- page: string;
95
- } | undefined;
96
- } | {
97
- response: {
98
- name: string;
99
- };
100
- value: unknown;
101
- args?: {
102
- loop?: boolean | undefined;
103
- length?: number | undefined;
104
- index?: number | undefined;
105
- linksIterations?: number[] | undefined;
106
- symLinks?: {
107
- [variableName: string]: Record<string, string>;
108
- } | undefined;
109
- paginatedLoop?: unknown;
110
- shallowIteration?: unknown;
111
- lengths?: number[] | undefined;
112
- } | undefined;
113
- } | {
114
- data: LunaticData;
115
- source: LunaticSource;
116
- initialPage: string;
117
- features: LunaticState['features'];
118
- preferences: LunaticState['preferences'];
119
- savingType: LunaticState['savingType'];
120
- shortcut: boolean;
121
- management: boolean;
122
- handleChange: LunaticState['handleChange'];
123
- activeControls: boolean;
124
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
125
- withOverview: boolean;
126
- } | {
127
- status: boolean;
128
- } | {
129
- getSuggesterStatus: (name: string) => {
130
- status: SuggesterStatus;
131
- timestamp: number;
132
- };
133
- } | {
89
+ export declare const goNextPage: (payload: {
134
90
  block?: unknown;
135
91
  }) => ActionGoNextPage & {
136
92
  type: ActionKind.GO_NEXT_PAGE;
137
93
  };
138
- export declare const goToPage: (payload: {} | {
94
+ export declare const goToPage: (payload: {
139
95
  page: string;
140
96
  iteration?: number | undefined;
141
97
  nbIterations?: number | undefined;
142
98
  subPage?: number | undefined;
143
- roundabout?: {
144
- page: string;
145
- } | undefined;
146
- } | {
147
- response: {
148
- name: string;
149
- };
150
- value: unknown;
151
- args?: {
152
- loop?: boolean | undefined;
153
- length?: number | undefined;
154
- index?: number | undefined;
155
- linksIterations?: number[] | undefined;
156
- symLinks?: {
157
- [variableName: string]: Record<string, string>;
158
- } | undefined;
159
- paginatedLoop?: unknown;
160
- shallowIteration?: unknown;
161
- lengths?: number[] | undefined;
162
- } | undefined;
163
- } | {
164
- data: LunaticData;
165
- source: LunaticSource;
166
- initialPage: string;
167
- features: LunaticState['features'];
168
- preferences: LunaticState['preferences'];
169
- savingType: LunaticState['savingType'];
170
- shortcut: boolean;
171
- management: boolean;
172
- handleChange: LunaticState['handleChange'];
173
- activeControls: boolean;
174
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
175
- withOverview: boolean;
176
- } | {
177
- status: boolean;
178
- } | {
179
- getSuggesterStatus: (name: string) => {
180
- status: SuggesterStatus;
181
- timestamp: number;
182
- };
183
- } | {
184
- block?: unknown;
185
99
  }) => ActionGoToPage & {
186
100
  type: ActionKind.GO_TO_PAGE;
187
101
  };
188
- export declare const onInit: (payload: {} | {
189
- page: string;
190
- iteration?: number | undefined;
191
- nbIterations?: number | undefined;
192
- subPage?: number | undefined;
193
- roundabout?: {
194
- page: string;
195
- } | undefined;
196
- } | {
197
- response: {
198
- name: string;
199
- };
200
- value: unknown;
201
- args?: {
202
- loop?: boolean | undefined;
203
- length?: number | undefined;
204
- index?: number | undefined;
205
- linksIterations?: number[] | undefined;
206
- symLinks?: {
207
- [variableName: string]: Record<string, string>;
208
- } | undefined;
209
- paginatedLoop?: unknown;
210
- shallowIteration?: unknown;
211
- lengths?: number[] | undefined;
212
- } | undefined;
213
- } | {
102
+ export declare const onInit: (payload: {
214
103
  data: LunaticData;
215
104
  source: LunaticSource;
216
105
  initialPage: string;
106
+ lastReachedPage: string;
217
107
  features: LunaticState['features'];
218
108
  preferences: LunaticState['preferences'];
219
109
  savingType: LunaticState['savingType'];
@@ -221,69 +111,18 @@ export declare const onInit: (payload: {} | {
221
111
  management: boolean;
222
112
  handleChange: LunaticState['handleChange'];
223
113
  activeControls: boolean;
224
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
114
+ goToPage: (params: ActionGoToPage['payload']) => void;
225
115
  withOverview: boolean;
226
- } | {
227
- status: boolean;
228
- } | {
229
- getSuggesterStatus: (name: string) => {
230
- status: SuggesterStatus;
231
- timestamp: number;
232
- };
233
- } | {
234
- block?: unknown;
235
116
  }) => ActionInit & {
236
117
  type: ActionKind.ON_INIT;
237
118
  };
238
119
  export declare const handleChange: (response: ActionHandleChange['payload']['response'], value: ActionHandleChange['payload']['value'], args: ActionHandleChange['payload']['args']) => Action;
239
120
  export declare const onSetWaiting: (status: boolean) => Action;
240
- export declare const updateState: (payload: {} | {
241
- page: string;
242
- iteration?: number | undefined;
243
- nbIterations?: number | undefined;
244
- subPage?: number | undefined;
245
- roundabout?: {
246
- page: string;
247
- } | undefined;
248
- } | {
249
- response: {
250
- name: string;
251
- };
252
- value: unknown;
253
- args?: {
254
- loop?: boolean | undefined;
255
- length?: number | undefined;
256
- index?: number | undefined;
257
- linksIterations?: number[] | undefined;
258
- symLinks?: {
259
- [variableName: string]: Record<string, string>;
260
- } | undefined;
261
- paginatedLoop?: unknown;
262
- shallowIteration?: unknown;
263
- lengths?: number[] | undefined;
264
- } | undefined;
265
- } | {
266
- data: LunaticData;
267
- source: LunaticSource;
268
- initialPage: string;
269
- features: LunaticState['features'];
270
- preferences: LunaticState['preferences'];
271
- savingType: LunaticState['savingType'];
272
- shortcut: boolean;
273
- management: boolean;
274
- handleChange: LunaticState['handleChange'];
275
- activeControls: boolean;
276
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
277
- withOverview: boolean;
278
- } | {
279
- status: boolean;
280
- } | {
121
+ export declare const updateState: (payload: {
281
122
  getSuggesterStatus: (name: string) => {
282
123
  status: SuggesterStatus;
283
124
  timestamp: number;
284
125
  };
285
- } | {
286
- block?: unknown;
287
126
  }) => ActionUpdateState & {
288
127
  type: ActionKind.UPDATE_STATE;
289
128
  };