@inseefr/lunatic 3.0.0-rc.25 → 3.0.0-rc.27

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 (184) hide show
  1. package/lib/components/Loop/Loop.js +6 -1
  2. package/lib/components/Loop/Loop.js.map +1 -1
  3. package/lib/components/LunaticComponents.d.ts +7 -11
  4. package/lib/components/LunaticComponents.js +4 -1
  5. package/lib/components/LunaticComponents.js.map +1 -1
  6. package/lib/components/RosterForLoop/RosterForLoop.js +4 -3
  7. package/lib/components/RosterForLoop/RosterForLoop.js.map +1 -1
  8. package/lib/components/Table/Table.js +1 -1
  9. package/lib/components/Table/Table.js.map +1 -1
  10. package/lib/components/library.d.ts +1 -1
  11. package/lib/components/shared/HOC/slottableComponent.d.ts +2 -2
  12. package/lib/components/shared/MDLabel/MDLabel.js +4 -1
  13. package/lib/components/shared/MDLabel/MDLabel.js.map +1 -1
  14. package/lib/components/shared/MDLabel/MDLabel.spec.js +4 -1
  15. package/lib/components/shared/MDLabel/MDLabel.spec.js.map +1 -1
  16. package/lib/components/shared/Table/Table.js +1 -1
  17. package/lib/components/shared/Table/Table.js.map +1 -1
  18. package/lib/components/shared/Table/TableHeader.d.ts +1 -1
  19. package/lib/components/shared/Table/TableHeader.js +3 -3
  20. package/lib/components/shared/Table/TableHeader.js.map +1 -1
  21. package/lib/components/shared/Table/Tbody.d.ts +0 -1
  22. package/lib/components/shared/Table/Tbody.js +2 -2
  23. package/lib/components/shared/Table/Tbody.js.map +1 -1
  24. package/lib/components/shared/Table/Tbody.spec.js +1 -2
  25. package/lib/components/shared/Table/Tbody.spec.js.map +1 -1
  26. package/lib/components/shared/Table/Td.d.ts +0 -1
  27. package/lib/components/shared/Table/Td.js +2 -2
  28. package/lib/components/shared/Table/Td.js.map +1 -1
  29. package/lib/components/shared/Table/Td.spec.js +1 -2
  30. package/lib/components/shared/Table/Td.spec.js.map +1 -1
  31. package/lib/components/shared/Table/Th.d.ts +0 -1
  32. package/lib/components/shared/Table/Th.js +2 -2
  33. package/lib/components/shared/Table/Th.js.map +1 -1
  34. package/lib/components/shared/Table/Th.spec.js +0 -2
  35. package/lib/components/shared/Table/Th.spec.js.map +1 -1
  36. package/lib/components/shared/Table/Thead.d.ts +0 -1
  37. package/lib/components/shared/Table/Thead.js +2 -2
  38. package/lib/components/shared/Table/Thead.js.map +1 -1
  39. package/lib/components/shared/Table/Thead.spec.js +1 -6
  40. package/lib/components/shared/Table/Thead.spec.js.map +1 -1
  41. package/lib/components/shared/Table/Tr.d.ts +0 -1
  42. package/lib/components/shared/Table/Tr.js +2 -2
  43. package/lib/components/shared/Table/Tr.js.map +1 -1
  44. package/lib/components/shared/Table/Tr.spec.js +2 -3
  45. package/lib/components/shared/Table/Tr.spec.js.map +1 -1
  46. package/lib/components/type.d.ts +10 -10
  47. package/lib/index.d.ts +1 -1
  48. package/lib/use-lunatic/actions.d.ts +3 -52
  49. package/lib/use-lunatic/actions.js +0 -7
  50. package/lib/use-lunatic/actions.js.map +1 -1
  51. package/lib/use-lunatic/commons/check-loops.d.ts +2 -2
  52. package/lib/use-lunatic/commons/check-loops.js.map +1 -1
  53. package/lib/use-lunatic/commons/compile-controls.d.ts +2 -2
  54. package/lib/use-lunatic/commons/compile-controls.js +5 -3
  55. package/lib/use-lunatic/commons/compile-controls.js.map +1 -1
  56. package/lib/use-lunatic/commons/create-map-pages.d.ts +2 -2
  57. package/lib/use-lunatic/commons/create-map-pages.js.map +1 -1
  58. package/lib/use-lunatic/commons/execute-condition-filter.d.ts +2 -2
  59. package/lib/use-lunatic/commons/execute-condition-filter.js +3 -4
  60. package/lib/use-lunatic/commons/execute-condition-filter.js.map +1 -1
  61. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +614 -6
  62. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +6 -13
  63. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  64. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js +1 -1
  65. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js.map +1 -1
  66. package/lib/use-lunatic/commons/fill-components/fill-components.d.ts +19 -17
  67. package/lib/use-lunatic/commons/fill-components/fill-components.js +29 -29
  68. package/lib/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
  69. package/lib/use-lunatic/commons/get-components-from-state.d.ts +2 -3
  70. package/lib/use-lunatic/commons/get-components-from-state.js +1 -2
  71. package/lib/use-lunatic/commons/get-components-from-state.js.map +1 -1
  72. package/lib/use-lunatic/commons/index.d.ts +0 -3
  73. package/lib/use-lunatic/commons/index.js +0 -3
  74. package/lib/use-lunatic/commons/index.js.map +1 -1
  75. package/lib/use-lunatic/commons/page.d.ts +2 -2
  76. package/lib/use-lunatic/commons/page.js +2 -1
  77. package/lib/use-lunatic/commons/page.js.map +1 -1
  78. package/lib/use-lunatic/hooks/use-loop-variables.d.ts +2 -2
  79. package/lib/use-lunatic/hooks/use-loop-variables.js.map +1 -1
  80. package/lib/use-lunatic/hooks/use-page-has-response.d.ts +2 -2
  81. package/lib/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  82. package/lib/use-lunatic/hooks/useOverview.d.ts +2 -2
  83. package/lib/use-lunatic/hooks/useOverview.js.map +1 -1
  84. package/lib/use-lunatic/props/propComponentType.d.ts +9 -0
  85. package/lib/use-lunatic/{commons/fill-components/fill-specific-expression.js → props/propComponentType.js} +21 -27
  86. package/lib/use-lunatic/props/propComponentType.js.map +1 -0
  87. package/lib/use-lunatic/props/propIterations.d.ts +7 -0
  88. package/lib/use-lunatic/props/propIterations.js +26 -0
  89. package/lib/use-lunatic/props/propIterations.js.map +1 -0
  90. package/lib/use-lunatic/props/propMissingResponse.d.ts +9 -0
  91. package/lib/use-lunatic/props/propMissingResponse.js +13 -0
  92. package/lib/use-lunatic/props/propMissingResponse.js.map +1 -0
  93. package/lib/use-lunatic/props/propValue.d.ts +6 -0
  94. package/lib/use-lunatic/props/propValue.js +28 -0
  95. package/lib/use-lunatic/props/propValue.js.map +1 -0
  96. package/lib/use-lunatic/{commons/fill-components/fill-component-value.spec.js → props/propValue.spec.js} +6 -6
  97. package/lib/use-lunatic/props/propValue.spec.js.map +1 -0
  98. package/lib/use-lunatic/reducer/commons/auto-explore-loop.d.ts +2 -2
  99. package/lib/use-lunatic/reducer/commons/auto-explore-loop.js.map +1 -1
  100. package/lib/use-lunatic/reducer/commons/validate-condition-filter.d.ts +2 -2
  101. package/lib/use-lunatic/reducer/commons/validate-condition-filter.js.map +1 -1
  102. package/lib/use-lunatic/reducer/controls/check-base-control.d.ts +2 -2
  103. package/lib/use-lunatic/reducer/controls/check-base-control.js.map +1 -1
  104. package/lib/use-lunatic/reducer/controls/check-roundabout-control.d.ts +2 -2
  105. package/lib/use-lunatic/reducer/controls/check-roundabout-control.js.map +1 -1
  106. package/lib/use-lunatic/reducer/overview/overviewOnInit.d.ts +4 -105
  107. package/lib/use-lunatic/reducer/overview/overviewOnInit.js +1 -12
  108. package/lib/use-lunatic/reducer/overview/overviewOnInit.js.map +1 -1
  109. package/lib/use-lunatic/reducer/reduce-go-next-page.d.ts +2 -2
  110. package/lib/use-lunatic/reducer/reduce-go-next-page.js.map +1 -1
  111. package/lib/use-lunatic/reducer/reduce-go-previous-page.d.ts +2 -3
  112. package/lib/use-lunatic/reducer/reduce-go-previous-page.js +1 -2
  113. package/lib/use-lunatic/reducer/reduce-go-previous-page.js.map +1 -1
  114. package/lib/use-lunatic/reducer/reduce-go-to-page.d.ts +2 -3
  115. package/lib/use-lunatic/reducer/reduce-go-to-page.js +1 -2
  116. package/lib/use-lunatic/reducer/reduce-go-to-page.js.map +1 -1
  117. package/lib/use-lunatic/reducer/reduce-handle-change.d.ts +2 -2
  118. package/lib/use-lunatic/reducer/reduce-handle-change.js.map +1 -1
  119. package/lib/use-lunatic/reducer/reducer.d.ts +2 -3
  120. package/lib/use-lunatic/reducer/reducer.js +3 -10
  121. package/lib/use-lunatic/reducer/reducer.js.map +1 -1
  122. package/lib/use-lunatic/reducer/reducerInitializer.d.ts +10 -0
  123. package/lib/use-lunatic/reducer/{reduce-on-init.js → reducerInitializer.js} +70 -72
  124. package/lib/use-lunatic/reducer/reducerInitializer.js.map +1 -0
  125. package/lib/use-lunatic/type.d.ts +77 -49
  126. package/lib/use-lunatic/use-lunatic.d.ts +23 -69
  127. package/lib/use-lunatic/use-lunatic.js +69 -74
  128. package/lib/use-lunatic/use-lunatic.js.map +1 -1
  129. package/lib/utils/object.d.ts +1 -0
  130. package/lib/utils/object.js +6 -0
  131. package/lib/utils/object.js.map +1 -1
  132. package/package.json +2 -1
  133. package/lib/stories/behaviour/cleaning/source-loop.json +0 -130
  134. package/lib/stories/behaviour/resizing/source-resizing-cleaning.json +0 -171
  135. package/lib/stories/overview/dataLoop.json +0 -189
  136. package/lib/stories/overview/source.json +0 -28
  137. package/lib/stories/overview/sourceLoop.json +0 -1423
  138. package/lib/stories/questionnaires/logement/source.json +0 -31762
  139. package/lib/stories/questionnaires2023/simpsons/source.json +0 -4728
  140. package/lib/use-lunatic/commons/fill-components/fill-component-required.d.ts +0 -442
  141. package/lib/use-lunatic/commons/fill-components/fill-component-required.js +0 -13
  142. package/lib/use-lunatic/commons/fill-components/fill-component-required.js.map +0 -1
  143. package/lib/use-lunatic/commons/fill-components/fill-component-value.d.ts +0 -5
  144. package/lib/use-lunatic/commons/fill-components/fill-component-value.js +0 -34
  145. package/lib/use-lunatic/commons/fill-components/fill-component-value.js.map +0 -1
  146. package/lib/use-lunatic/commons/fill-components/fill-component-value.spec.js.map +0 -1
  147. package/lib/use-lunatic/commons/fill-components/fill-from-state.d.ts +0 -770
  148. package/lib/use-lunatic/commons/fill-components/fill-from-state.js +0 -18
  149. package/lib/use-lunatic/commons/fill-components/fill-from-state.js.map +0 -1
  150. package/lib/use-lunatic/commons/fill-components/fill-iterations.d.ts +0 -124
  151. package/lib/use-lunatic/commons/fill-components/fill-iterations.js +0 -36
  152. package/lib/use-lunatic/commons/fill-components/fill-iterations.js.map +0 -1
  153. package/lib/use-lunatic/commons/fill-components/fill-management.d.ts +0 -6
  154. package/lib/use-lunatic/commons/fill-components/fill-management.js +0 -9
  155. package/lib/use-lunatic/commons/fill-components/fill-management.js.map +0 -1
  156. package/lib/use-lunatic/commons/fill-components/fill-missing-response.d.ts +0 -12
  157. package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +0 -20
  158. package/lib/use-lunatic/commons/fill-components/fill-missing-response.js.map +0 -1
  159. package/lib/use-lunatic/commons/fill-components/fill-pagination.d.ts +0 -9
  160. package/lib/use-lunatic/commons/fill-components/fill-pagination.js +0 -10
  161. package/lib/use-lunatic/commons/fill-components/fill-pagination.js.map +0 -1
  162. package/lib/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +0 -1268
  163. package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js.map +0 -1
  164. package/lib/use-lunatic/commons/fill-components/index.d.ts +0 -1
  165. package/lib/use-lunatic/commons/fill-components/index.js +0 -2
  166. package/lib/use-lunatic/commons/fill-components/index.js.map +0 -1
  167. package/lib/use-lunatic/commons/use-components-from-state.d.ts +0 -4
  168. package/lib/use-lunatic/commons/use-components-from-state.js +0 -15
  169. package/lib/use-lunatic/commons/use-components-from-state.js.map +0 -1
  170. package/lib/use-lunatic/initial-state.d.ts +0 -3
  171. package/lib/use-lunatic/initial-state.js +0 -39
  172. package/lib/use-lunatic/initial-state.js.map +0 -1
  173. package/lib/use-lunatic/reducer/index.d.ts +0 -1
  174. package/lib/use-lunatic/reducer/index.js +0 -2
  175. package/lib/use-lunatic/reducer/index.js.map +0 -1
  176. package/lib/use-lunatic/reducer/reduce-on-init.d.ts +0 -4
  177. package/lib/use-lunatic/reducer/reduce-on-init.js.map +0 -1
  178. package/lib/use-lunatic/reducer/reduce-on-set-waiting.d.ts +0 -4
  179. package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +0 -8
  180. package/lib/use-lunatic/reducer/reduce-on-set-waiting.js.map +0 -1
  181. package/lib/use-lunatic/use-lunatic.test.d.ts +0 -1
  182. package/lib/use-lunatic/use-lunatic.test.js +0 -280
  183. package/lib/use-lunatic/use-lunatic.test.js.map +0 -1
  184. /package/lib/use-lunatic/{commons/fill-components/fill-component-value.spec.d.ts → props/propValue.spec.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"fill-component-expressions.spec.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-component-expressions.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,wBAAwB,MAAM,8BAA8B,CAAC;AAEpE,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG;QACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;KAClD,CAAC;IAEF,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACzC,MAAM,UAAU,GAAG,wBAAwB,CAAC,SAAgB,EAAE;YAC7D,iBAAiB,EAAE,CAAC,UAAe,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK;YACxD,KAAK,EAAE;gBACN,SAAS,EAAE,CAAC;gBACZ,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;aACvB;SACD,CAAC,CAAC;QACH,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YAC1B,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;SACxC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"fill-component-expressions.spec.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-component-expressions.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG;QACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;KAClD,CAAC;IAEF,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACzC,MAAM,UAAU,GAAG,wBAAwB,CAAC,SAAgB,EAAE;YAC7D,iBAAiB,EAAE,CAAC,UAAe,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK;YACxD,KAAK,EAAE;gBACN,SAAS,EAAE,CAAC;gBACZ,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;aACvB;SACD,CAAC,CAAC;QACH,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YAC1B,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;SACxC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,23 +1,25 @@
1
- import type { LunaticComponentDefinition, LunaticState } from '../../type';
2
- import { type DeepTranslateExpression } from './fill-component-expressions';
3
- import { type FilledProps as FilledValueProps } from './fill-component-value';
4
- import { type FilledProps as FilledHandlersProps } from './fill-from-state';
5
- import { type FilledProps as FilledManagementProps } from './fill-management';
6
- import { type FilledProps as FilledMissingResponseProps } from './fill-missing-response';
7
- import { type FilledProps as FilledPaginationProps } from './fill-pagination';
8
- export type FilledLunaticComponentProps<T = LunaticComponentDefinition['componentType']> = DeepTranslateExpression<LunaticComponentDefinition & {
9
- componentType: T;
10
- }> & FilledManagementProps & FilledValueProps & FilledMissingResponseProps & FilledHandlersProps & FilledPaginationProps & {
11
- conditionFilter?: boolean;
1
+ import type { LunaticChangeHandler, LunaticComponentDefinition, LunaticOptions, LunaticReducerState, LunaticState } from '../../type';
2
+ import type { LunaticComponentProps } from '../../../components/type';
3
+ type FillComponentArgs = {
4
+ handleChange: LunaticChangeHandler;
5
+ executeExpression: LunaticReducerState['executeExpression'];
6
+ goToPage: LunaticState['goToPage'];
7
+ goNextPage: LunaticState['goNextPage'];
8
+ goPreviousPage: LunaticState['goPreviousPage'];
9
+ shortcut: LunaticOptions['shortcut'];
10
+ management: LunaticOptions['management'];
11
+ preferences: LunaticOptions['preferences'];
12
+ pager: LunaticReducerState['pager'];
13
+ variables: LunaticReducerState['variables'];
12
14
  };
13
15
  /**
14
- * Fill component with elements from the state
15
- *
16
- * Force typing for this function since it's doo dynamic
16
+ * To make this work with TypeScript we need to call function in succession, we prefer expressiveness here over generalized approache
17
17
  */
18
- export declare const fillComponent: (component: LunaticComponentDefinition, state: LunaticState) => FilledLunaticComponentProps;
18
+ export declare const fillComponent: (component: LunaticComponentDefinition, state: FillComponentArgs) => LunaticComponentProps & {
19
+ conditionFilter?: boolean;
20
+ };
19
21
  /**
20
22
  * Fill components with values coming from the state, and interpret VTL expression
21
23
  */
22
- declare function fillComponents(components: LunaticComponentDefinition[], state: LunaticState): FilledLunaticComponentProps[];
23
- export default fillComponents;
24
+ export declare function fillComponents(components: LunaticComponentDefinition[], state: FillComponentArgs): LunaticComponentProps[];
25
+ export {};
@@ -1,38 +1,38 @@
1
- import fillComponentExpressions, {} from './fill-component-expressions';
2
- import { fillComponentValue, } from './fill-component-value';
3
- import fillFromState, {} from './fill-from-state';
4
- import fillManagement, {} from './fill-management';
5
- import fillMissingResponse, {} from './fill-missing-response';
6
- import fillPagination, {} from './fill-pagination';
7
- import fillSpecificExpressions from './fill-specific-expression';
8
- import { fillComponentRequired } from './fill-component-required';
9
- import { fillIterations } from './fill-iterations';
1
+ import { fillComponentExpressions } from './fill-component-expressions';
2
+ import { getComponentTypeProps } from '../../props/propComponentType';
3
+ import { getMissingResponseProp } from '../../props/propMissingResponse';
4
+ import { getValueProp } from '../../props/propValue';
5
+ import { getIterationsProp } from '../../props/propIterations';
10
6
  /**
11
- * Compose multiple methods together to create a new method
12
- *
13
- * This function is too dynamic for typescript, allow any
7
+ * To make this work with TypeScript we need to call function in succession, we prefer expressiveness here over generalized approache
14
8
  */
15
- function compose(...fill) {
16
- return fill.reduce(function (a, b) {
17
- return (cmp, state) => b(a(cmp, state), state);
18
- }, (c) => c);
19
- }
20
- /**
21
- * Fill component with elements from the state
22
- *
23
- * Force typing for this function since it's doo dynamic
24
- */
25
- export const fillComponent = compose(fillFromState, fillComponentExpressions, fillPagination, fillComponentValue, fillMissingResponse, fillComponentRequired, fillManagement, fillIterations, fillSpecificExpressions);
9
+ export const fillComponent = (component, state) => {
10
+ const interpretedProps = fillComponentExpressions(component, state);
11
+ return {
12
+ ...interpretedProps,
13
+ handleChange: state.handleChange,
14
+ executeExpression: state.executeExpression,
15
+ preferences: state.preferences,
16
+ goToPage: state.goToPage,
17
+ shortcut: state.shortcut,
18
+ goNextPage: state.goNextPage,
19
+ goPreviousPage: state.goPreviousPage,
20
+ iteration: state.pager.iteration,
21
+ required: component.mandatory,
22
+ value: getValueProp(component, state),
23
+ missingResponse: getMissingResponseProp(component, state),
24
+ management: state.management,
25
+ iterations: getIterationsProp(component, state),
26
+ ...getComponentTypeProps(interpretedProps, state),
27
+ // This is too dynamic to be typed correctly, so we allow any here
28
+ };
29
+ };
26
30
  /**
27
31
  * Fill components with values coming from the state, and interpret VTL expression
28
32
  */
29
- function fillComponents(components, state) {
33
+ export function fillComponents(components, state) {
30
34
  return components
31
35
  .map((component) => fillComponent(component, state))
32
- .filter(matchConditionFilter);
33
- }
34
- function matchConditionFilter({ conditionFilter, }) {
35
- return conditionFilter !== undefined ? conditionFilter : true;
36
+ .filter(({ conditionFilter }) => conditionFilter ?? true);
36
37
  }
37
- export default fillComponents;
38
38
  //# sourceMappingURL=fill-components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fill-components.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-components.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,EAAE,EAEhC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,kBAAkB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,aAAa,EAAE,EAErB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,cAAc,EAAE,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,mBAAmB,EAAE,EAE3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,cAAc,EAAE,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAanD;;;;GAIG;AACH,SAAS,OAAO,CAAC,GAAG,IAAgB;IACnC,OAAO,IAAI,CAAC,MAAM,CACjB,UAAU,CAAM,EAAE,CAAM;QACvB,OAAO,CAAC,GAA+B,EAAE,KAAmB,EAAE,EAAE,CAC/D,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC,EACD,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CACb,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CACnC,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,uBAAuB,CAIQ,CAAC;AAEjC;;GAEG;AACH,SAAS,cAAc,CACtB,UAAwC,EACxC,KAAmB;IAEnB,OAAO,UAAU;SACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SACnD,MAAM,CAAC,oBAAoB,CAAkC,CAAC;AACjE,CAAC;AAED,SAAS,oBAAoB,CAAC,EAC7B,eAAe,GAGf;IACA,OAAO,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"fill-components.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAe/D;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,SAAqC,EACrC,KAAwB,EACgC,EAAE;IAC1D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACpE,OAAO;QACN,GAAG,gBAAgB;QACnB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;QAChC,QAAQ,EAAE,SAAS,CAAC,SAAS;QAC7B,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;QACrC,eAAe,EAAE,sBAAsB,CAAC,SAAS,EAAE,KAAK,CAAC;QACzD,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,UAAU,EAAE,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC;QAC/C,GAAG,qBAAqB,CAAC,gBAAgB,EAAE,KAAK,CAAC;QACjD,kEAAkE;KAC3D,CAAC;AACV,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAC7B,UAAwC,EACxC,KAAwB;IAExB,OAAO,UAAU;SACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SACnD,MAAM,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC;AAC5D,CAAC"}
@@ -1,6 +1,5 @@
1
- import type { LunaticState, LunaticComponentDefinition } from '../type';
1
+ import type { LunaticComponentDefinition, LunaticReducerState } from '../type';
2
2
  /**
3
3
  * Extract the list of components to display for the current page
4
4
  */
5
- declare function getComponentsFromState(state: Pick<LunaticState, 'pager' | 'pages' | 'isInLoop'>): LunaticComponentDefinition[];
6
- export default getComponentsFromState;
5
+ export declare function getComponentsFromState(state: Pick<LunaticReducerState, 'pager' | 'pages' | 'isInLoop'>): LunaticComponentDefinition[];
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Extract the list of components to display for the current page
3
3
  */
4
- function getComponentsFromState(state) {
4
+ export function getComponentsFromState(state) {
5
5
  const { pager, pages, isInLoop } = state;
6
6
  const { page, subPage } = pager;
7
7
  if (page && pages && page in pages) {
@@ -32,5 +32,4 @@ function filterComponentsInPage(components) {
32
32
  }
33
33
  return components.filter((c) => c.componentType === 'FilterDescription' ? c.filterDescription : true);
34
34
  }
35
- export default getComponentsFromState;
36
35
  //# sourceMappingURL=get-components-from-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-components-from-state.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/get-components-from-state.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,SAAS,sBAAsB,CAC9B,KAAyD;IAEzD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAChC,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAClC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;YAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;YAC1C,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;gBACvB,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACvC,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC;gBACtC,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC/B,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAC,UAAwC;IACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,CAAC,aAAa,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CACpE,CAAC;AACH,CAAC;AAED,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"get-components-from-state.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/get-components-from-state.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACrC,KAAgE;IAEhE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAChC,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAClC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;YAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;YAC1C,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;gBACvB,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACvC,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC;gBACtC,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC/B,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAC,UAAwC;IACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,CAAC,aAAa,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CACpE,CAAC;AACH,CAAC"}
@@ -1,9 +1,6 @@
1
1
  export { default as checkLoops } from './check-loops';
2
2
  export { default as createMapPages } from './create-map-pages';
3
3
  export { default as executeConditionFilter } from './execute-condition-filter';
4
- export { default as fillComponentExpressions } from './fill-components/fill-component-expressions';
5
4
  export { default as getCompatibleVTLExpression } from './get-compatible-vtl-expression';
6
- export { default as getComponentsFromState } from './get-components-from-state';
7
5
  export { default as isFirstLastPage } from './is-First-last-page';
8
6
  export { getNewReachedPage, getPageTag, isNewReachedPage } from './page-tag';
9
- export { default as useComponentsFromState } from './use-components-from-state';
@@ -1,10 +1,7 @@
1
1
  export { default as checkLoops } from './check-loops';
2
2
  export { default as createMapPages } from './create-map-pages';
3
3
  export { default as executeConditionFilter } from './execute-condition-filter';
4
- export { default as fillComponentExpressions } from './fill-components/fill-component-expressions';
5
4
  export { default as getCompatibleVTLExpression } from './get-compatible-vtl-expression';
6
- export { default as getComponentsFromState } from './get-components-from-state';
7
5
  export { default as isFirstLastPage } from './is-First-last-page';
8
6
  export { getNewReachedPage, getPageTag, isNewReachedPage } from './page-tag';
9
- export { default as useComponentsFromState } from './use-components-from-state';
10
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { LunaticState } from '../type';
1
+ import type { LunaticState, LunaticReducerState } from '../type';
2
2
  export declare function getPageId({ subPage, page, }: Pick<LunaticState['pager'], 'page' | 'subPage'>): string | number;
3
3
  /**
4
4
  * Converts a page number (3.1.2) to an array of numbers [3, 1, 2]
@@ -8,4 +8,4 @@ export declare function pageStringToNumbers(page: string): number[];
8
8
  * Check if we are on an empty page
9
9
  * if no components can be displayed on this page (using filter)
10
10
  */
11
- export declare function isPageEmpty(state: LunaticState, isMovingBackward?: boolean): boolean;
11
+ export declare function isPageEmpty(state: LunaticReducerState, isMovingBackward?: boolean): boolean;
@@ -1,4 +1,5 @@
1
- import { executeConditionFilter, getComponentsFromState } from './index';
1
+ import { getComponentsFromState } from './get-components-from-state';
2
+ import executeConditionFilter from './execute-condition-filter';
2
3
  export function getPageId({ subPage, page, }) {
3
4
  if (subPage === undefined) {
4
5
  return page;
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEzE,MAAM,UAAU,SAAS,CAAC,EACzB,OAAO,EACP,IAAI,GAC6C;IACjD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,GAAG,IAAI,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAC1B,KAAmB,EACnB,gBAAgB,GAAG,KAAK;IAExB,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG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AK,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,SAAS;QAC9D,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;QACtC,IAAI,eAAe,EAAE,CAAC;YACrB,OAAO,sBAAsB,CAC5B,eAAe,EACf,iBAAiB,EACjB,SAAS,CACT,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;IAEH,6CAA6C;IAC7C,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { LunaticState } from '../type';
1
+ import type { LunaticReducerState } from '../type';
2
2
  /**
3
3
  * Extract the list of variables used for the current loop
4
4
  */
5
- export declare function useLoopVariables(pager: LunaticState['pager'], pages: LunaticState['pages']): string[];
5
+ export declare function useLoopVariables(pager: LunaticReducerState['pager'], pages: LunaticReducerState['pages']): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"use-loop-variables.js","sourceRoot":"","sources":["../../../src/use-lunatic/hooks/use-loop-variables.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,KAA4B,EAC5B,KAA4B;IAE5B,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC;IAC5C,OAAO,OAAO,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,4CAA4C;QAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,MAAM,CACiB,CAAC;QACpD,OAAO,IAAI,EAAE,gBAAgB,IAAI,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"use-loop-variables.js","sourceRoot":"","sources":["../../../src/use-lunatic/hooks/use-loop-variables.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,KAAmC,EACnC,KAAmC;IAEnC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC;IAC5C,OAAO,OAAO,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,4CAA4C;QAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,MAAM,CACiB,CAAC;QACpD,OAAO,IAAI,EAAE,gBAAgB,IAAI,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAChC,CAAC"}
@@ -1,6 +1,6 @@
1
- import type { LunaticState } from '../type';
1
+ import type { LunaticReducerState } from '../type';
2
2
  import type { LunaticComponentProps } from '../../components/type';
3
3
  /**
4
4
  * Check if a page has one response (value is filled for at least one field)
5
5
  */
6
- export declare function usePageHasResponse(components: LunaticComponentProps[], executeExpression: LunaticState['executeExpression']): () => boolean;
6
+ export declare function usePageHasResponse(components: LunaticComponentProps[], executeExpression: LunaticReducerState['executeExpression']): () => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"use-page-has-response.js","sourceRoot":"","sources":["../../../src/use-lunatic/hooks/use-page-has-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CACjC,UAAmC,EACnC,iBAAoD;IAEpD,OAAO,WAAW,CAAC,GAAG,EAAE;QACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC;QACb,CAAC;QAED,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACpC,wDAAwD;YACxD,+DAA+D;YAC/D,IACC,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,QAAQ,CAClE,SAAS,CAAC,aAAa,IAAI,EAAE,CAC7B,EACA,CAAC;gBACF,OAAO,IAAI,CAAC;YACb,CAAC;YAED,gDAAgD;YAChD,IACC,iBAAiB,IAAI,SAAS;gBAC9B,SAAS,CAAC,eAAe;gBACzB,SAAS,CAAC,eAAe,CAAC,KAAK,EAC9B,CAAC;gBACF,OAAO,IAAI,CAAC;YACb,CAAC;YAED,iGAAiG;YACjG,IAAI,SAAS,CAAC,aAAa,KAAK,OAAO,EAAE,CAAC;gBACzC,iGAAiG;gBACjG,MAAM,iBAAiB,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;oBAC1D,MAAM,eAAe,GAAG,GAAG,CAAC,MAAM,CACjC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,eAAe,IAAI,IAAI,CACnD,CAA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,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { LunaticState, PageTag } from '../type';
1
+ import type { LunaticReducerState, PageTag } from '../type';
2
2
  import { type DependencyList, type ReactNode } from 'react';
3
3
  export type InterpretedLunaticOverviewItem = {
4
4
  id: string;
@@ -13,4 +13,4 @@ export type InterpretedLunaticOverviewItem = {
13
13
  /**
14
14
  * Hook to build a filled overview everytime the deps change
15
15
  */
16
- export declare const useOverview: ({ overview, executeExpression, pager, }: Pick<LunaticState, 'executeExpression' | 'overview' | 'pager'>, deps: DependencyList) => InterpretedLunaticOverviewItem[];
16
+ export declare const useOverview: ({ overview, executeExpression, pager, }: Pick<LunaticReducerState, 'executeExpression' | 'overview' | 'pager'>, deps: DependencyList) => InterpretedLunaticOverviewItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"useOverview.js","sourceRoot":"","sources":["../../../src/use-lunatic/hooks/useOverview.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,OAAO,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAapE;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAC1B,EACC,QAAQ,EACR,iBAAiB,EACjB,KAAK,GAC2D,EACjE,IAAoB,EACnB,EAAE;IACH,OAAO,OAAO,CACb,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,KAAK,CAAC;IAC3D,uDAAuD;IACvD,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,CACnB,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,iBAAiB,GAAG,CACzB,aAAoC,EACpC,iBAAoD,EACpD,KAA6B,EAC5B,EAAE;IACH,iCAAiC;IACjC,IAAI,KAAK,GAAG,aAAa,CAAC,MAAM,CAC/B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,IAAI,EAAE,iBAAi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,EAAE,CAAC;QACrC,gBAAgB,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { LunaticComponentDefinition } from '../type';
2
+ import { type DeepTranslateExpression } from '../commons/fill-components/fill-component-expressions';
3
+ import { fillComponent } from '../commons/fill-components/fill-components';
4
+ type State = Parameters<typeof fillComponent>[1];
5
+ /**
6
+ * Get component specific props (RoundAbout for instance)
7
+ */
8
+ export declare function getComponentTypeProps(component: DeepTranslateExpression<LunaticComponentDefinition>, state: State): {};
9
+ export {};
@@ -1,12 +1,12 @@
1
- import {} from './fill-component-expressions';
2
- import fillComponents, { fillComponent } from './fill-components';
3
- import { hasComponentType } from '../component';
4
- import { getVTLCompatibleValue } from '../../../utils/vtl';
1
+ import {} from '../commons/fill-components/fill-component-expressions';
2
+ import { hasComponentType } from '../commons/component';
3
+ import { getVTLCompatibleValue } from '../../utils/vtl';
4
+ import { fillComponent, fillComponents, } from '../commons/fill-components/fill-components';
5
5
  /**
6
6
  * Fill props for roundabout
7
7
  * - expressions, VTL that states the level of completion for each iteration
8
8
  */
9
- function fillRoundaboutProps(component, state) {
9
+ function getRoundaboutProps(component, state) {
10
10
  const iterations = component.iterations; // iterations is the result of an expression but we know it's a number
11
11
  const compiled = Object.entries(component.expressions).reduce(function (result, [name, expression]) {
12
12
  const values = new Array(iterations).fill(null).map((_, iteration) => {
@@ -16,23 +16,21 @@ function fillRoundaboutProps(component, state) {
16
16
  });
17
17
  return { ...result, [name]: values };
18
18
  }, {});
19
- return { ...component, expressions: compiled };
19
+ return { expressions: compiled };
20
20
  }
21
21
  /**
22
22
  * Fill child components for nested component type
23
23
  */
24
- function fillChildComponents(component, state) {
24
+ function getChildComponents(component, state) {
25
25
  return {
26
- ...component,
27
26
  components: fillComponents(component.components, state),
28
27
  };
29
28
  }
30
29
  /**
31
30
  * For loops, inject a method to retrieve component at a specific iteration
32
31
  */
33
- function fillChildComponentsWithIteration(component, state) {
32
+ function getChildComponentsWithIteration(component, state) {
34
33
  return {
35
- ...component,
36
34
  getComponents: (iteration) => fillComponents(component.components, {
37
35
  ...state,
38
36
  handleChange: createChangeHandlerForIteration(state.handleChange, iteration),
@@ -65,9 +63,8 @@ function createChangeHandlerForIteration(handleChange, iteration) {
65
63
  /**
66
64
  * For pairwise, inject a method to retrieve component at a specific iteration combination
67
65
  */
68
- function fillPairwise(component, state) {
66
+ function getPairwiseProps(component, state) {
69
67
  return {
70
- ...component,
71
68
  getComponents: (x, y) => {
72
69
  if (x === y) {
73
70
  return [];
@@ -94,9 +91,8 @@ function fillPairwise(component, state) {
94
91
  /**
95
92
  * For pairwise, inject a method to retrieve component at a specific iteration combination
96
93
  */
97
- function fillTable(component, state) {
94
+ function getTableProps(component, state) {
98
95
  return {
99
- ...component,
100
96
  body: component.body.map((row) => row.map((component) => {
101
97
  if (hasComponentType(component)) {
102
98
  return fillComponent(component, state);
@@ -112,38 +108,36 @@ function fillTable(component, state) {
112
108
  /**
113
109
  * For suggester, inject the arbitrary value if necessary
114
110
  */
115
- function fillSuggester(component, state) {
111
+ function getSuggesterProps(component, state) {
116
112
  if (!component.arbitrary) {
117
113
  return component;
118
114
  }
119
115
  return {
120
- ...component,
121
116
  arbitraryValue: state.executeExpression(component.arbitrary.response.name, {
122
117
  iteration: state.pager.iteration,
123
118
  }),
124
119
  };
125
120
  }
126
121
  /**
127
- * Fill component specific props (RoundAbout for instance)
122
+ * Get component specific props (RoundAbout for instance)
128
123
  */
129
- function fillSpecificExpressions(component, state) {
124
+ export function getComponentTypeProps(component, state) {
130
125
  switch (component.componentType) {
131
126
  case 'Roundabout':
132
- return fillRoundaboutProps(component, state);
127
+ return getRoundaboutProps(component, state);
133
128
  case 'Question':
134
- return fillChildComponents(component, state);
129
+ return getChildComponents(component, state);
135
130
  case 'Loop':
136
131
  case 'RosterForLoop':
137
- return fillChildComponentsWithIteration(component, state);
132
+ return getChildComponentsWithIteration(component, state);
138
133
  case 'PairwiseLinks':
139
- return fillPairwise(component, state);
134
+ return getPairwiseProps(component, state);
140
135
  case 'Table':
141
- return fillTable(component, state);
136
+ return getTableProps(component, state);
142
137
  case 'Suggester':
143
- return fillSuggester(component, state);
138
+ return getSuggesterProps(component, state);
144
139
  default:
145
- return component;
140
+ return {};
146
141
  }
147
142
  }
148
- export default fillSpecificExpressions;
149
- //# sourceMappingURL=fill-specific-expression.js.map
143
+ //# sourceMappingURL=propComponentType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propComponentType.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propComponentType.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgC,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACN,aAAa,EACb,cAAc,GACd,MAAM,4CAA4C,CAAC;AAIpD;;;GAGG;AACH,SAAS,kBAAkB,CAC1B,SAA4E,EAC5E,KAAY;IAEZ,MAAM,UAAU,GAAG,SAAS,CAAC,UAAoB,CAAC,CAAC,sEAAsE;IACzH,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,UAC7D,MAAM,EACN,CAAC,IAAI,EAAE,UAAU,CAAC;QAElB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE;YACpE,OAAO,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE;gBAC1C,SAAS;aACT,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC,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AS,EAAE,KAAK,CAAC,CAAC;QAC5C;YACC,OAAO,EAAE,CAAC;IACZ,CAAC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { LunaticComponentDefinition, LunaticPager, LunaticReducerState } from '../type';
2
+ import type { LunaticVariablesStore } from '../commons/variables/lunatic-variables-store';
3
+ export declare function getIterationsProp(definition: LunaticComponentDefinition, state: {
4
+ pager: LunaticPager;
5
+ variables: LunaticVariablesStore;
6
+ executeExpression: LunaticReducerState['executeExpression'];
7
+ }): number | undefined;
@@ -0,0 +1,26 @@
1
+ import { forceInt, isNumber } from '../../utils/number';
2
+ import { hasResponse } from '../commons/component';
3
+ export function getIterationsProp(definition, state) {
4
+ if ('iterations' in definition && definition.iterations) {
5
+ return forceInt(state.executeExpression(definition.iterations, {
6
+ iteration: state.pager.iteration,
7
+ }));
8
+ }
9
+ if (definition.componentType !== 'RosterForLoop' &&
10
+ definition.componentType !== 'Loop') {
11
+ return undefined;
12
+ }
13
+ // Iterations expression is not present on the component definition
14
+ // infer it from the value of child components
15
+ return definition.components.reduce((acc, component) => {
16
+ if (!hasResponse(component)) {
17
+ return acc;
18
+ }
19
+ const value = state.variables.get(component.response.name, isNumber(state.pager.iteration) ? [state.pager.iteration] : undefined);
20
+ if (Array.isArray(value) && value.length > acc) {
21
+ return value.length;
22
+ }
23
+ return acc;
24
+ }, 0);
25
+ }
26
+ //# sourceMappingURL=propIterations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propIterations.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propIterations.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,iBAAiB,CAChC,UAAsC,EACtC,KAIC;IAED,IAAI,YAAY,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QACzD,OAAO,QAAQ,CACd,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,UAAU,EAAE;YAC9C,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;SAChC,CAAC,CACF,CAAC;IACH,CAAC;IAED,IACC,UAAU,CAAC,aAAa,KAAK,eAAe;QAC5C,UAAU,CAAC,aAAa,KAAK,MAAM,EAClC,CAAC;QACF,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,mEAAmE;IACnE,8CAA8C;IAC9C,OAAO,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;QACtD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,GAAG,CAAC;QACZ,CAAC;QACD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAChC,SAAS,CAAC,QAAQ,CAAC,IAAI,EACvB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CACrE,CAAC;QACF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAChD,OAAO,KAAK,CAAC,MAAM,CAAC;QACrB,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { LunaticComponentDefinition, LunaticPager } from '../type';
2
+ import type { LunaticVariablesStore } from '../commons/variables/lunatic-variables-store';
3
+ export declare function getMissingResponseProp(component: LunaticComponentDefinition, { pager, variables, }: {
4
+ pager: LunaticPager;
5
+ variables: LunaticVariablesStore;
6
+ }): {
7
+ value: unknown;
8
+ name: string;
9
+ } | undefined;
@@ -0,0 +1,13 @@
1
+ import { isNumber } from '../../utils/number';
2
+ export function getMissingResponseProp(component, { pager, variables, }) {
3
+ // Component does not have a missing response
4
+ if (!('missingResponse' in component) || !component.missingResponse) {
5
+ return undefined;
6
+ }
7
+ const missingResponse = component.missingResponse;
8
+ return {
9
+ ...missingResponse,
10
+ value: variables.get(missingResponse.name, isNumber(pager.iteration) ? [pager.iteration] : undefined),
11
+ };
12
+ }
13
+ //# sourceMappingURL=propMissingResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propMissingResponse.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propMissingResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,MAAM,UAAU,sBAAsB,CACrC,SAAqC,EACrC,EACC,KAAK,EACL,SAAS,GAIT;IAED,6CAA6C;IAC7C,IAAI,CAAC,CAAC,iBAAiB,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC;IAClD,OAAO;QACN,GAAG,eAAe;QAClB,KAAK,EAAE,SAAS,CAAC,GAAG,CACnB,eAAe,CAAC,IAAI,EACpB,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CACzD;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { LunaticComponentDefinition, LunaticPager } from '../type';
2
+ import type { LunaticVariablesStore } from '../commons/variables/lunatic-variables-store';
3
+ export declare function getValueProp(component: LunaticComponentDefinition, args: {
4
+ pager: LunaticPager;
5
+ variables: LunaticVariablesStore;
6
+ }): unknown;
@@ -0,0 +1,28 @@
1
+ import { isNumber } from '../../utils/number';
2
+ import { hasResponse, hasResponses } from '../commons/component';
3
+ export function getValueProp(component, args) {
4
+ let iteration = isNumber(args.pager.iteration)
5
+ ? [args.pager.iteration]
6
+ : undefined;
7
+ if (args.pager.linksIterations) {
8
+ iteration = args.pager.linksIterations;
9
+ }
10
+ if (hasResponses(component)) {
11
+ return Object.fromEntries(component.responses?.map(({ response }) => [
12
+ response.name,
13
+ args.variables.get(response.name, iteration),
14
+ ]) ?? []);
15
+ }
16
+ if (hasResponse(component)) {
17
+ return args.variables.get(component.response.name, iteration);
18
+ }
19
+ // For loop, value will be a map of child component values
20
+ if ('components' in component) {
21
+ return Object.fromEntries(component.components
22
+ .map((c) => ('response' in c ? c.response.name : null))
23
+ .filter((name) => name !== null)
24
+ .map((name) => [name, args.variables.get(name)]));
25
+ }
26
+ return null;
27
+ }
28
+ //# sourceMappingURL=propValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propValue.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIjE,MAAM,UAAU,YAAY,CAC3B,SAAqC,EACrC,IAGC;IAED,IAAI,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC7C,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QACxB,CAAC,CAAC,SAAS,CAAC;IACb,IAAI,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAChC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;IACxC,CAAC;IACD,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,WAAW,CACxB,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;YAC1C,QAAQ,CAAC,IAAI;YACb,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;SAC5C,CAAC,IAAI,EAAE,CACR,CAAC;IACH,CAAC;IACD,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IACD,0DAA0D;IAC1D,IAAI,YAAY,IAAI,SAAS,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC,WAAW,CACxB,SAAS,CAAC,UAAU;aAClB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACtD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC;aAC/B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAK,CAAC,CAAC,CAAC,CAClD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
- import { fillComponentValue } from './fill-component-value';
3
- import { LunaticVariablesStore } from '../variables/lunatic-variables-store';
4
- import { times } from '../../../utils/array';
2
+ import { getValueProp } from './propValue';
3
+ import { LunaticVariablesStore } from '../commons/variables/lunatic-variables-store';
4
+ import { times } from '../../utils/array';
5
5
  describe('fillComponentValue', () => {
6
6
  // Helper to avoid repetition
7
7
  const expectFilledComponent = (component,
@@ -9,14 +9,14 @@ describe('fillComponentValue', () => {
9
9
  values = {},
10
10
  // Pager iteration
11
11
  iteration) => {
12
- return expect(fillComponentValue(component, {
12
+ return expect(getValueProp(component, {
13
13
  variables: LunaticVariablesStore.makeFromObject(values),
14
14
  pager: {
15
15
  maxPage: 2,
16
16
  page: 1,
17
17
  iteration,
18
18
  },
19
- }).value);
19
+ }));
20
20
  };
21
21
  describe('response', () => {
22
22
  const component = {
@@ -51,4 +51,4 @@ describe('fillComponentValue', () => {
51
51
  });
52
52
  });
53
53
  });
54
- //# sourceMappingURL=fill-component-value.spec.js.map
54
+ //# sourceMappingURL=propValue.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propValue.spec.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propValue.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACnC,6BAA6B;IAC7B,MAAM,qBAAqB,GAAG,CAC7B,SAAqC;IACrC,6BAA6B;IAC7B,SAAkC,EAAE;IACpC,kBAAkB;IAClB,SAAkB,EACjB,EAAE;QACH,OAAO,MAAM,CACZ,YAAY,CAAC,SAAS,EAAE;YACvB,SAAS,EAAE,qBAAqB,CAAC,cAAc,CAAC,MAAM,CAAC;YACvD,KAAK,EAAE;gBACN,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,CAAC;gBACP,SAAS;aACT;SACD,CAAC,CACF,CAAC;IACH,CAAC,CAAC;IAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACzB,MAAM,SAAS,GAAG;YACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACW,CAAC;QAEzC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC3C,qBAAqB,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,C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  /**
3
3
  * Update the pager to enter a loop if the pager is on a loop
4
4
  */
5
- export declare function autoExploreLoop(state: LunaticState, direction?: 'forward' | 'backward'): LunaticState;
5
+ export declare function autoExploreLoop(state: LunaticReducerState, direction?: 'forward' | 'backward'): LunaticReducerState;