@inseefr/lunatic 2.0.0-v2 → 2.0.0-v2test

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 (423) hide show
  1. package/lib/components/button/index.js +0 -2
  2. package/lib/components/button/lunatic-button.js +6 -16
  3. package/lib/components/checkbox/checkbox-boolean/checkbox-boolean.js +8 -13
  4. package/lib/components/checkbox/checkbox-boolean/index.js +0 -2
  5. package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +9 -16
  6. package/lib/components/checkbox/checkbox-group/checkbox-group.js +21 -33
  7. package/lib/components/checkbox/checkbox-group/checkbox.scss +1 -0
  8. package/lib/components/checkbox/checkbox-group/index.js +0 -2
  9. package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +9 -15
  10. package/lib/components/checkbox/checkbox-one/index.js +0 -2
  11. package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +5 -14
  12. package/lib/components/checkbox/commons/checkbox-option.js +14 -18
  13. package/lib/components/checkbox/commons/checkbox-option.scss +3 -0
  14. package/lib/components/checkbox/commons/index.js +0 -2
  15. package/lib/components/checkbox/index.js +0 -4
  16. package/lib/components/commons/build-style-object.js +3 -14
  17. package/lib/components/commons/components/combo-box/combo-box-container.js +3 -9
  18. package/lib/components/commons/components/combo-box/combo-box-content.js +6 -19
  19. package/lib/components/commons/components/combo-box/combo-box.js +35 -67
  20. package/lib/components/commons/components/combo-box/combo-box.scss +0 -10
  21. package/lib/components/commons/components/combo-box/index.js +0 -2
  22. package/lib/components/commons/components/combo-box/panel/index.js +0 -2
  23. package/lib/components/commons/components/combo-box/panel/option-container.js +4 -19
  24. package/lib/components/commons/components/combo-box/panel/panel-container.js +3 -8
  25. package/lib/components/commons/components/combo-box/panel/panel.js +13 -22
  26. package/lib/components/commons/components/combo-box/selection/delete.js +3 -19
  27. package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.js +2 -10
  28. package/lib/components/commons/components/combo-box/selection/index.js +0 -2
  29. package/lib/components/commons/components/combo-box/selection/input.js +8 -21
  30. package/lib/components/commons/components/combo-box/selection/label-selection.js +8 -15
  31. package/lib/components/commons/components/combo-box/selection/selection-container.js +4 -9
  32. package/lib/components/commons/components/combo-box/selection/selection.js +12 -22
  33. package/lib/components/commons/components/combo-box/state-management/actions.js +6 -22
  34. package/lib/components/commons/components/combo-box/state-management/combo-box-context.js +0 -4
  35. package/lib/components/commons/components/combo-box/state-management/index.js +0 -9
  36. package/lib/components/commons/components/combo-box/state-management/reducer/index.js +0 -2
  37. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-blur.js +4 -6
  38. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-change.js +4 -6
  39. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-delete.js +4 -6
  40. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-focus.js +4 -6
  41. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-init.js +8 -14
  42. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/index.js +0 -2
  43. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-down.js +4 -9
  44. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-up.js +4 -9
  45. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-end.js +4 -7
  46. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-enter.js +4 -6
  47. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-escape.js +4 -6
  48. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-home.js +4 -7
  49. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-tab.js +4 -6
  50. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/reduce-on-keydown.js +1 -20
  51. package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-select.js +4 -6
  52. package/lib/components/commons/components/combo-box/state-management/reducer/reducer.js +0 -22
  53. package/lib/components/commons/components/create-lunatic-component/create-lunatic-component.js +10 -21
  54. package/lib/components/commons/components/create-lunatic-component/index.js +0 -3
  55. package/lib/components/commons/components/default-label-renderer.js +4 -14
  56. package/lib/components/commons/components/default-option-renderer.js +3 -10
  57. package/lib/components/commons/components/dragger/dragger.js +20 -46
  58. package/lib/components/commons/components/dragger/index.js +0 -2
  59. package/lib/components/commons/components/errors/errors.js +18 -12
  60. package/lib/components/commons/components/errors/index.js +0 -2
  61. package/lib/components/commons/components/fab/fab.js +6 -14
  62. package/lib/components/commons/components/fab/index.js +0 -2
  63. package/lib/components/commons/components/field-container/field-container.js +3 -12
  64. package/lib/components/commons/components/field-container/index.js +0 -2
  65. package/lib/components/commons/components/fieldset.js +2 -10
  66. package/lib/components/commons/components/fieldset.scss +2 -0
  67. package/lib/components/commons/components/html-table/index.js +0 -7
  68. package/lib/components/commons/components/html-table/table.js +3 -12
  69. package/lib/components/commons/components/html-table/tbody.js +3 -12
  70. package/lib/components/commons/components/html-table/td.js +7 -16
  71. package/lib/components/commons/components/html-table/th.js +6 -15
  72. package/lib/components/commons/components/html-table/thead.js +3 -12
  73. package/lib/components/commons/components/html-table/tr.js +4 -13
  74. package/lib/components/commons/components/is-network/index.js +0 -2
  75. package/lib/components/commons/components/is-network/is-network.js +8 -27
  76. package/lib/components/commons/components/is-network/use-online-status.js +0 -9
  77. package/lib/components/commons/components/label.js +5 -13
  78. package/lib/components/commons/components/lunatic-component.js +12 -24
  79. package/lib/components/commons/components/lunatic-fieldset-component.js +9 -20
  80. package/lib/components/commons/components/md-label/index.js +0 -2
  81. package/lib/components/commons/components/md-label/link.js +8 -14
  82. package/lib/components/commons/components/md-label/md-label.js +6 -14
  83. package/lib/components/commons/components/missing/index.js +0 -2
  84. package/lib/components/commons/components/missing/missing.js +11 -25
  85. package/lib/components/commons/components/nothing-to-display.js +0 -4
  86. package/lib/components/commons/components/orchestrated-component.js +15 -25
  87. package/lib/components/commons/components/variable-status/img/index.js +0 -3
  88. package/lib/components/commons/components/variable-status/index.js +0 -2
  89. package/lib/components/commons/components/variable-status/variable-status.js +18 -35
  90. package/lib/components/commons/create-customizable-field.js +2 -14
  91. package/lib/components/commons/create-row-orchestrator.js +16 -21
  92. package/lib/components/commons/icons/checkbox-checked.icon.js +4 -9
  93. package/lib/components/commons/icons/checkbox-unchecked.icon.js +4 -9
  94. package/lib/components/commons/icons/closed.icon.js +4 -9
  95. package/lib/components/commons/icons/cross.icon.js +4 -9
  96. package/lib/components/commons/icons/index.js +0 -11
  97. package/lib/components/commons/icons/load.icon.js +4 -9
  98. package/lib/components/commons/icons/lunatic-icon.js +1 -7
  99. package/lib/components/commons/icons/network.icon.js +4 -9
  100. package/lib/components/commons/icons/on-drag.icon.js +4 -9
  101. package/lib/components/commons/icons/opened.icon.js +4 -9
  102. package/lib/components/commons/icons/radio-checked.icon.js +4 -9
  103. package/lib/components/commons/icons/radio-unchecked.icon.js +4 -9
  104. package/lib/components/commons/index.js +0 -24
  105. package/lib/components/commons/prop-types/declarations.js +0 -8
  106. package/lib/components/commons/prop-types/index.js +0 -6
  107. package/lib/components/commons/prop-types/lines.js +0 -4
  108. package/lib/components/commons/prop-types/options.js +0 -4
  109. package/lib/components/commons/prop-types/response.js +0 -4
  110. package/lib/components/commons/prop-types/value-type.js +0 -8
  111. package/lib/components/commons/safety-label.js +0 -8
  112. package/lib/components/commons/use-document-add-event-listener.js +9 -33
  113. package/lib/components/commons/use-on-handle-change.js +2 -5
  114. package/lib/components/commons/use-options-keydown.js +1 -6
  115. package/lib/components/commons/use-previous.js +0 -3
  116. package/lib/components/components.js +8 -33
  117. package/lib/components/datepicker/datepicker.js +9 -17
  118. package/lib/components/datepicker/index.js +0 -2
  119. package/lib/components/datepicker/lunatic-datepicker.js +5 -15
  120. package/lib/components/declarations/declaration.js +2 -9
  121. package/lib/components/declarations/declarations-after-text.js +0 -9
  122. package/lib/components/declarations/declarations-before-text.js +0 -9
  123. package/lib/components/declarations/declarations-detachable.js +0 -9
  124. package/lib/components/declarations/declarations.js +8 -14
  125. package/lib/components/declarations/index.js +0 -8
  126. package/lib/components/dropdown/dropdown-simple/dropdown-simple.js +7 -14
  127. package/lib/components/dropdown/dropdown-simple/index.js +0 -2
  128. package/lib/components/dropdown/dropdown-simple/simple-label-renderer.js +3 -13
  129. package/lib/components/dropdown/dropdown-simple/simple-option-renderer.js +2 -9
  130. package/lib/components/dropdown/dropdown-writable/dropdown-writable.js +11 -31
  131. package/lib/components/dropdown/dropdown-writable/filter-tools/filter-options.js +1 -12
  132. package/lib/components/dropdown/dropdown-writable/filter-tools/letters-matching.js +0 -11
  133. package/lib/components/dropdown/dropdown-writable/filter-tools/match.js +0 -5
  134. package/lib/components/dropdown/dropdown-writable/filter-tools/prepare-prefix.js +0 -4
  135. package/lib/components/dropdown/dropdown-writable/index.js +0 -2
  136. package/lib/components/dropdown/dropdown-writable/writable-label-renderer.js +3 -13
  137. package/lib/components/dropdown/dropdown-writable/writable-option-renderer.js +18 -52
  138. package/lib/components/dropdown/dropdown.js +9 -20
  139. package/lib/components/dropdown/index.js +0 -2
  140. package/lib/components/dropdown/lunatic-dropdown.js +11 -19
  141. package/lib/components/filter-description/component.js +3 -6
  142. package/lib/components/filter-description/index.js +0 -2
  143. package/lib/components/index.js +0 -4
  144. package/lib/components/input/index.js +0 -2
  145. package/lib/components/input/input.js +7 -19
  146. package/lib/components/input/lunatic-input.js +4 -15
  147. package/lib/components/input-number/index.js +0 -2
  148. package/lib/components/input-number/input-number.js +12 -22
  149. package/lib/components/input-number/lunatic-input-number.js +5 -14
  150. package/lib/components/loop/block-for-loop/block-for-loop-ochestrator.js +0 -4
  151. package/lib/components/loop/block-for-loop/block-for-loop.js +38 -76
  152. package/lib/components/loop/block-for-loop/index.js +0 -2
  153. package/lib/components/loop/block-for-loop/row.js +16 -30
  154. package/lib/components/loop/commons/get-init-length.js +0 -3
  155. package/lib/components/loop/commons/handle-row-button.js +2 -7
  156. package/lib/components/loop/commons/index.js +0 -3
  157. package/lib/components/loop/commons/row-component.js +17 -38
  158. package/lib/components/loop/index.js +0 -2
  159. package/lib/components/loop/loop.js +19 -29
  160. package/lib/components/loop/roster-for-loop/body.js +14 -26
  161. package/lib/components/loop/roster-for-loop/header.js +2 -9
  162. package/lib/components/loop/roster-for-loop/index.js +0 -2
  163. package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +0 -4
  164. package/lib/components/loop/roster-for-loop/roster-for-loop.js +29 -58
  165. package/lib/components/loop/roster-for-loop/roster-table.js +10 -21
  166. package/lib/components/loop/roster-for-loop/row.js +16 -27
  167. package/lib/components/modal-controls/close-or-skip.js +7 -13
  168. package/lib/components/modal-controls/index.js +0 -2
  169. package/lib/components/modal-controls/modal-container.js +1 -6
  170. package/lib/components/modal-controls/modal-controls.js +6 -29
  171. package/lib/components/modal-controls/modal-controls.scss +15 -35
  172. package/lib/components/{pairwise/links → pairwise-links}/index.js +0 -2
  173. package/lib/components/pairwise-links/orchestrator.js +72 -0
  174. package/lib/components/{pairwise/links → pairwise-links}/pairwise-links.js +24 -33
  175. package/lib/components/{pairwise/links → pairwise-links}/row.js +51 -66
  176. package/lib/components/radio/index.js +0 -2
  177. package/lib/components/radio/lunatic-radio-group.js +9 -16
  178. package/lib/components/radio/radio-group.js +10 -19
  179. package/lib/components/radio/radio-option.js +13 -23
  180. package/lib/components/radio/radio.scss +3 -1
  181. package/lib/components/sequence/index.js +0 -2
  182. package/lib/components/sequence/sequence.js +5 -10
  183. package/lib/components/subsequence/index.js +0 -2
  184. package/lib/components/subsequence/subsequence.js +4 -8
  185. package/lib/components/suggester/check-store.js +15 -54
  186. package/lib/components/suggester/find-best-label/find-best-label.js +2 -14
  187. package/lib/components/suggester/find-best-label/index.js +0 -2
  188. package/lib/components/suggester/idb-suggester.js +14 -34
  189. package/lib/components/suggester/index.js +0 -2
  190. package/lib/components/suggester/lunatic-suggester.js +15 -28
  191. package/lib/components/suggester/searching/create-searching.js +5 -18
  192. package/lib/components/suggester/searching/index.js +0 -2
  193. package/lib/components/suggester/suggester.js +22 -56
  194. package/lib/components/suggester-loader-widget/index.js +0 -2
  195. package/lib/components/suggester-loader-widget/loader-row.js +13 -40
  196. package/lib/components/suggester-loader-widget/loader.js +15 -56
  197. package/lib/components/suggester-loader-widget/progress.js +6 -13
  198. package/lib/components/suggester-loader-widget/tools/action-tool.js +5 -12
  199. package/lib/components/suggester-loader-widget/tools/index.js +0 -3
  200. package/lib/components/suggester-loader-widget/tools/tools.js +0 -4
  201. package/lib/components/suggester-loader-widget/widget-container.js +2 -11
  202. package/lib/components/suggester-loader-widget/widget.js +24 -54
  203. package/lib/components/switch/index.js +0 -2
  204. package/lib/components/switch/lunatic-switch.js +5 -17
  205. package/lib/components/switch/switch.js +7 -21
  206. package/lib/components/table/cell.js +14 -39
  207. package/lib/components/table/components/cell.js +14 -39
  208. package/lib/components/table/components/header.js +4 -11
  209. package/lib/components/table/components/row.js +7 -13
  210. package/lib/components/table/components/table.js +3 -10
  211. package/lib/components/table/index.js +0 -2
  212. package/lib/components/table/lunatic-table.js +17 -34
  213. package/lib/components/table/table-orchestrator.js +12 -20
  214. package/lib/components/textarea/index.js +0 -2
  215. package/lib/components/textarea/lunatic-textarea.js +4 -15
  216. package/lib/components/textarea/textarea.js +8 -20
  217. package/lib/constants/declarations.js +3 -1
  218. package/lib/constants/event-types.js +2 -1
  219. package/lib/constants/index.js +0 -10
  220. package/lib/constants/supported-preferences.js +0 -5
  221. package/lib/constants/variable-types.js +2 -2
  222. package/lib/i18n/build-dictionary.js +5 -11
  223. package/lib/i18n/dictionary.js +8 -0
  224. package/lib/i18n/index.js +0 -6
  225. package/lib/index.js +0 -4
  226. package/lib/stories/{pairwise/block/pairwise-block.stories.js → checkboxBoolean/checkboxBoolean.stories.js} +6 -15
  227. package/lib/stories/checkboxBoolean/source.json +36 -0
  228. package/lib/stories/checkboxOne/checkboxOne.stories.js +0 -8
  229. package/lib/stories/custom-mui/checkbox-boolean-mui.js +4 -12
  230. package/lib/stories/custom-mui/checkbox-group-mui.js +9 -23
  231. package/lib/stories/custom-mui/checkbox-one-mui.js +0 -4
  232. package/lib/stories/custom-mui/index.js +0 -16
  233. package/lib/stories/custom-mui/input-mui.js +7 -17
  234. package/lib/stories/custom-mui/input-number-mui.js +7 -15
  235. package/lib/stories/custom-mui/radio-mui.js +7 -23
  236. package/lib/stories/custom-mui/suggester-mui/index.js +0 -2
  237. package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +55 -93
  238. package/lib/stories/custom-mui/switch-mui.js +5 -15
  239. package/lib/stories/custom-mui/table-mui.js +2 -10
  240. package/lib/stories/custom-mui/tbody-mui.js +2 -8
  241. package/lib/stories/custom-mui/td-mui.js +4 -10
  242. package/lib/stories/custom-mui/textarea-mui.js +7 -16
  243. package/lib/stories/custom-mui/th-mui.js +3 -9
  244. package/lib/stories/custom-mui/thead-mui.js +2 -8
  245. package/lib/stories/custom-mui/tr-mui.js +3 -10
  246. package/lib/stories/date-picker/datepicker.stories.js +3 -10
  247. package/lib/stories/date-picker/source.json +2 -51
  248. package/lib/stories/dropdown/dropdown.stories.js +4 -10
  249. package/lib/stories/filter-description/filter-description.stories.js +4 -13
  250. package/lib/stories/input/input.stories.js +0 -9
  251. package/lib/stories/input-number/input-number.stories.js +0 -9
  252. package/lib/stories/pairwise/data.json +12 -0
  253. package/lib/stories/pairwise/links.json +270 -0
  254. package/lib/stories/pairwise/{links/pairwise-links.stories.js → pairwise-links.stories.js} +3 -12
  255. package/lib/stories/paste-questionnaire/test.stories.js +4 -12
  256. package/lib/stories/questionnaires/logement/data.json +6 -11
  257. package/lib/stories/questionnaires/logement/logement.stories.js +4 -15
  258. package/lib/stories/questionnaires/recensement/data.json +12 -0
  259. package/lib/stories/questionnaires/recensement/recensement.stories.js +58 -0
  260. package/lib/stories/questionnaires/recensement/source.json +15202 -0
  261. package/lib/stories/questionnaires/rp/data.json +5 -0
  262. package/lib/stories/questionnaires/rp/rp.stories.js +36 -0
  263. package/lib/stories/questionnaires/rp/source.json +262 -0
  264. package/lib/stories/questionnaires/simpsons/simpsons.stories.js +4 -12
  265. package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees_PasPageFin.json +13 -52
  266. package/lib/stories/questionnaires-test/controls/boucles-n.json +74 -444
  267. package/lib/stories/questionnaires-test/controls/controls.stories.js +12 -24
  268. package/lib/stories/questionnaires-test/test.stories.js +4 -16
  269. package/lib/stories/radio/radio.stories.js +0 -8
  270. package/lib/stories/roster-for-loop/roster-for-loop.stories.js +8 -9
  271. package/lib/stories/roster-for-loop/source-with-header.json +127 -0
  272. package/lib/stories/suggester/suggester-workers.stories.js +201 -0
  273. package/lib/stories/suggester/suggester.stories.js +0 -10
  274. package/lib/stories/switch/SwitchMaterialUI.js +5 -15
  275. package/lib/stories/switch/switch.js +4 -27
  276. package/lib/stories/table/table-dynamique.json +67 -0
  277. package/lib/stories/table/table.stories.js +8 -16
  278. package/lib/stories/utils/default-arg-types.js +4 -5
  279. package/lib/stories/utils/orchestrator.js +61 -84
  280. package/lib/stories/utils/waiting/index.js +0 -2
  281. package/lib/stories/utils/waiting/waiting.js +1 -11
  282. package/lib/use-lunatic/actions.js +8 -20
  283. package/lib/use-lunatic/commons/calculated-variables.js +20 -44
  284. package/lib/use-lunatic/commons/check-loops.js +14 -38
  285. package/lib/use-lunatic/commons/compose.js +0 -4
  286. package/lib/use-lunatic/commons/create-map-pages.js +6 -27
  287. package/lib/use-lunatic/commons/execute-condition-filter.js +0 -7
  288. package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +64 -107
  289. package/lib/use-lunatic/commons/execute-expression/create-memoizer.js +7 -28
  290. package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +23 -45
  291. package/lib/use-lunatic/commons/execute-expression/execute-expression.js +10 -41
  292. package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.js +2 -16
  293. package/lib/use-lunatic/commons/execute-expression/get-safety-expression.js +5 -12
  294. package/lib/use-lunatic/commons/execute-expression/index.js +0 -2
  295. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +20 -46
  296. package/lib/use-lunatic/commons/fill-components/fill-component-value.js +4 -8
  297. package/lib/use-lunatic/commons/fill-components/fill-components.js +0 -13
  298. package/lib/use-lunatic/commons/fill-components/fill-errors.js +4 -8
  299. package/lib/use-lunatic/commons/fill-components/fill-from-state.js +6 -8
  300. package/lib/use-lunatic/commons/fill-components/fill-management.js +4 -8
  301. package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +5 -10
  302. package/lib/use-lunatic/commons/fill-components/fill-pagination.js +4 -6
  303. package/lib/use-lunatic/commons/fill-components/index.js +0 -2
  304. package/lib/use-lunatic/commons/get-compatible-vtl-expression.js +0 -7
  305. package/lib/use-lunatic/commons/get-component-value/get-component-value.js +26 -66
  306. package/lib/use-lunatic/commons/get-component-value/index.js +0 -2
  307. package/lib/use-lunatic/commons/get-components-from-state.js +10 -14
  308. package/lib/use-lunatic/commons/get-data.js +16 -31
  309. package/lib/use-lunatic/commons/get-errors-without-empty-value.js +22 -0
  310. package/lib/use-lunatic/commons/index.js +7 -13
  311. package/lib/use-lunatic/commons/is-First-last-page.js +1 -3
  312. package/lib/use-lunatic/commons/is-paginated-loop.js +1 -3
  313. package/lib/use-lunatic/commons/load-suggesters.js +9 -54
  314. package/lib/use-lunatic/commons/page-tag.js +15 -34
  315. package/lib/use-lunatic/commons/use-components-from-state.js +12 -20
  316. package/lib/use-lunatic/index.js +0 -2
  317. package/lib/use-lunatic/initial-state.js +1 -3
  318. package/lib/use-lunatic/reducer/commons/index.js +0 -5
  319. package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +1 -15
  320. package/lib/use-lunatic/reducer/commons/resize-array-variable.js +2 -12
  321. package/lib/use-lunatic/reducer/commons/validate-condition-filter.js +4 -16
  322. package/lib/use-lunatic/reducer/index.js +0 -2
  323. package/lib/use-lunatic/reducer/reduce-go-next-page.js +37 -65
  324. package/lib/use-lunatic/reducer/reduce-go-previous-page.js +31 -50
  325. package/lib/use-lunatic/reducer/reduce-go-to-page.js +10 -20
  326. package/lib/use-lunatic/reducer/reduce-handle-change/index.js +0 -2
  327. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +13 -29
  328. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +34 -40
  329. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +58 -30
  330. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +13 -33
  331. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +24 -43
  332. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +11 -20
  333. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +5 -9
  334. package/lib/use-lunatic/reducer/reduce-on-init.js +69 -104
  335. package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +4 -6
  336. package/lib/use-lunatic/reducer/reducer.js +0 -20
  337. package/lib/use-lunatic/reducer/validate-controls/create-controls-reducer.js +28 -27
  338. package/lib/use-lunatic/reducer/validate-controls/create-modal-controls-reducer.js +22 -26
  339. package/lib/use-lunatic/reducer/validate-controls/index.js +0 -3
  340. package/lib/use-lunatic/reducer/validate-controls/validation-utils.js +11 -22
  341. package/lib/use-lunatic/use-lunatic.js +61 -106
  342. package/lib/utils/constants/index.js +0 -10
  343. package/lib/utils/idb-tools/clear-store.js +1 -11
  344. package/lib/utils/idb-tools/create-db-opener.js +6 -19
  345. package/lib/utils/idb-tools/create-open-db.js +1 -7
  346. package/lib/utils/idb-tools/get-entity.js +0 -4
  347. package/lib/utils/idb-tools/get-idb.js +0 -2
  348. package/lib/utils/idb-tools/idb-bulk-insert.js +15 -38
  349. package/lib/utils/idb-tools/index.js +0 -11
  350. package/lib/utils/idb-tools/insert-entity.js +0 -4
  351. package/lib/utils/idb-tools/open-db.js +1 -6
  352. package/lib/utils/idb-tools/open-or-create-db.js +3 -10
  353. package/lib/utils/is-element.js +0 -2
  354. package/lib/utils/store-tools/auto-load.js +10 -51
  355. package/lib/utils/store-tools/clear-store-data.js +1 -12
  356. package/lib/utils/store-tools/clear-store-info.js +1 -12
  357. package/lib/utils/store-tools/create/create.js +1 -18
  358. package/lib/utils/store-tools/create/index.js +0 -3
  359. package/lib/utils/store-tools/create/update-store-info.js +0 -6
  360. package/lib/utils/store-tools/get-store-count.js +0 -5
  361. package/lib/utils/store-tools/index.js +0 -12
  362. package/lib/utils/store-tools/open-or-create-store.js +1 -11
  363. package/lib/utils/store-tools/use-store-index.js +5 -27
  364. package/lib/utils/suggester-workers/append-to-index/append.js +7 -23
  365. package/lib/utils/suggester-workers/append-to-index/append.worker.js +6 -10
  366. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +3 -11
  367. package/lib/utils/suggester-workers/append-to-index/index.js +0 -3
  368. package/lib/utils/suggester-workers/append-to-index/prepare-entities.js +10 -36
  369. package/lib/utils/suggester-workers/append-to-index/store-messages.js +4 -7
  370. package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +9 -19
  371. package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +16 -42
  372. package/lib/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +4 -15
  373. package/lib/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +0 -3
  374. package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +4 -15
  375. package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.spec.js +0 -2
  376. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.js +0 -5
  377. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.spec.js +0 -2
  378. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.js +0 -9
  379. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +0 -2
  380. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.js +1 -3
  381. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +0 -2
  382. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.js +3 -9
  383. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.spec.js +0 -2
  384. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +4 -22
  385. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +2 -3
  386. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +0 -3
  387. package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +0 -2
  388. package/lib/utils/suggester-workers/commons-tokenizer/filters/index.js +0 -3
  389. package/lib/utils/suggester-workers/commons-tokenizer/get-regexp-from-pattern.js +0 -3
  390. package/lib/utils/suggester-workers/commons-tokenizer/get-stemmer.js +0 -8
  391. package/lib/utils/suggester-workers/commons-tokenizer/index.js +0 -10
  392. package/lib/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +0 -6
  393. package/lib/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +0 -3
  394. package/lib/utils/suggester-workers/create-worker.js +1 -11
  395. package/lib/utils/suggester-workers/find-best-label/find-best-label.js +10 -28
  396. package/lib/utils/suggester-workers/find-best-label/find-best-label.worker.js +9 -23
  397. package/lib/utils/suggester-workers/find-best-label/tokenize.js +6 -23
  398. package/lib/utils/suggester-workers/find-best-label/tokenize.spec.js +0 -2
  399. package/lib/utils/suggester-workers/searching/compute-score.js +4 -16
  400. package/lib/utils/suggester-workers/searching/get-db.js +1 -15
  401. package/lib/utils/suggester-workers/searching/index.js +0 -2
  402. package/lib/utils/suggester-workers/searching/order/create-alphanumeric-orderer.js +0 -5
  403. package/lib/utils/suggester-workers/searching/order/index.js +0 -8
  404. package/lib/utils/suggester-workers/searching/query-parser/index.js +0 -3
  405. package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.js +0 -3
  406. package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.spec.js +0 -2
  407. package/lib/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +4 -20
  408. package/lib/utils/suggester-workers/searching/resolve-query-parser.js +1 -15
  409. package/lib/utils/suggester-workers/searching/search-in-index.js +0 -3
  410. package/lib/utils/suggester-workers/searching/searching.js +6 -41
  411. package/lib/utils/suggester-workers/searching/searching.worker.js +4 -7
  412. package/lib/utils/vtl/dataset-builder.js +0 -4
  413. package/lib/utils/vtl/index.js +0 -2
  414. package/package.json +7 -4
  415. package/lib/components/checkbox/checkbox-group/checkbox-option.js +0 -57
  416. package/lib/components/checkbox/checkbox.scss +0 -1
  417. package/lib/components/pairwise/block/index.js +0 -15
  418. package/lib/components/pairwise/block/pairwise-block.js +0 -17
  419. package/lib/components/pairwise/index.js +0 -23
  420. package/lib/components/pairwise/links/links-orchestrator.js +0 -16
  421. package/lib/stories/pairwise/block/block.json +0 -3
  422. package/lib/stories/pairwise/links/data.json +0 -12
  423. package/lib/stories/pairwise/links/links.json +0 -141
@@ -4,146 +4,116 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _commons = require("../commons");
9
-
8
+ var _pageTag = require("../commons/page-tag");
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
-
12
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
-
14
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
15
-
12
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
-
18
14
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
-
20
15
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
-
22
16
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
-
24
17
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
25
-
26
18
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
-
28
19
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
29
-
30
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
-
32
21
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
-
34
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
-
22
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
36
25
  /* à bouger d'ici */
26
+
37
27
  function getInitalValueFromCollected(variable) {
38
28
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
39
29
  var values = variable.values,
40
- name = variable.name;
30
+ name = variable.name;
41
31
  var fromData;
42
-
43
32
  if (name in data) {
44
33
  var _data$name = data[name],
45
- COLLECTED = _data$name.COLLECTED,
46
- FORCED = _data$name.FORCED;
34
+ COLLECTED = _data$name.COLLECTED,
35
+ FORCED = _data$name.FORCED;
47
36
  fromData = COLLECTED || FORCED;
48
37
  }
49
-
50
38
  if (values) {
51
39
  var _COLLECTED = values.COLLECTED,
52
- _FORCED = values.FORCED;
40
+ _FORCED = values.FORCED;
53
41
  return fromData || _FORCED || _COLLECTED;
54
42
  }
55
-
56
43
  return undefined;
57
44
  }
58
-
59
45
  function getInitialValueFromExternal(variable) {
60
46
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
61
47
  var name = variable.name;
62
-
63
48
  if (name in data) {
64
49
  return data[name];
65
50
  }
66
-
67
51
  return undefined;
68
52
  }
69
-
70
53
  function getInitialValue(variable) {
71
54
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
72
55
  var COLLECTED = data.COLLECTED,
73
- EXTERNAL = data.EXTERNAL,
74
- CALCULATED = data.CALCULATED;
56
+ EXTERNAL = data.EXTERNAL,
57
+ CALCULATED = data.CALCULATED;
75
58
  var variableType = variable.variableType;
76
-
77
59
  switch (variableType) {
78
60
  case 'COLLECTED':
79
61
  return getInitalValueFromCollected(variable, COLLECTED);
80
-
81
62
  case 'EXTERNAL':
82
63
  return getInitialValueFromExternal(variable, EXTERNAL);
83
-
84
64
  case 'CALCULATED':
85
65
  return getInitialValueFromExternal(variable, CALCULATED);
86
-
87
66
  default:
88
67
  return null;
89
68
  }
90
69
  }
91
-
92
70
  function appendToArrayMap(map, key, entry) {
93
71
  if (key in map) {
94
72
  return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, [].concat(_toConsumableArray(map[key]), [entry])));
95
73
  }
96
-
97
74
  return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, [entry]));
98
75
  }
99
-
100
76
  function appendToObjectMap(map, key, object) {
101
77
  if (key in map) {
102
78
  return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, _objectSpread(_objectSpread({}, map[key]), object)));
103
79
  }
104
-
105
80
  return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, object));
106
81
  }
82
+
107
83
  /**
108
84
  *
109
85
  * @param {*} source
110
86
  * @param {*} data
111
87
  * @returns
112
88
  */
113
-
114
-
115
89
  function createVariables(source, data) {
116
90
  var _source$variables = source.variables,
117
- variables = _source$variables === void 0 ? [] : _source$variables;
118
-
91
+ variables = _source$variables === void 0 ? [] : _source$variables;
119
92
  var _variables$reduce = variables.reduce(function (_ref, variable) {
120
- var _ref2 = _slicedToArray(_ref, 2),
93
+ var _ref2 = _slicedToArray(_ref, 2),
121
94
  mapType = _ref2[0],
122
95
  mapVar = _ref2[1];
123
-
124
- var type = variable.variableType,
96
+ var type = variable.variableType,
125
97
  name = variable.name;
126
- return [appendToArrayMap(mapType, type, variable), appendToObjectMap(mapVar, name, {
127
- variable: variable,
128
- type: type,
129
- value: getInitialValue(variable, data)
130
- })];
131
- }, [{}, {}]),
132
- _variables$reduce2 = _slicedToArray(_variables$reduce, 2),
133
- mapVariablesTypes = _variables$reduce2[0],
134
- mapVariables = _variables$reduce2[1]; //
135
-
136
-
98
+ return [appendToArrayMap(mapType, type, variable), appendToObjectMap(mapVar, name, {
99
+ variable: variable,
100
+ type: type,
101
+ value: getInitialValue(variable, data)
102
+ })];
103
+ }, [{}, {}]),
104
+ _variables$reduce2 = _slicedToArray(_variables$reduce, 2),
105
+ mapVariablesTypes = _variables$reduce2[0],
106
+ mapVariables = _variables$reduce2[1];
107
+ //
137
108
  var _mapVariablesTypes$CA = mapVariablesTypes.CALCULATED,
138
- CALCULATED = _mapVariablesTypes$CA === void 0 ? [] : _mapVariablesTypes$CA;
109
+ CALCULATED = _mapVariablesTypes$CA === void 0 ? [] : _mapVariablesTypes$CA;
139
110
  CALCULATED.forEach(function (calculated) {
140
111
  var _calculated$bindingDe = calculated.bindingDependencies,
141
- bindingDependencies = _calculated$bindingDe === void 0 ? [] : _calculated$bindingDe;
112
+ bindingDependencies = _calculated$bindingDe === void 0 ? [] : _calculated$bindingDe;
142
113
  bindingDependencies.forEach(function (name) {
143
114
  if (name in mapVariables) {
144
115
  var variable = mapVariables[name];
145
116
  var CalculatedLinked = variable.CalculatedLinked;
146
-
147
117
  if (CalculatedLinked) {
148
118
  CalculatedLinked.push(calculated);
149
119
  } else {
@@ -156,70 +126,69 @@ function createVariables(source, data) {
156
126
  }
157
127
  /* */
158
128
 
159
-
160
- function checkInLoop(state) {
129
+ function checkInLoop(state, initialPager) {
161
130
  var pager = state.pager,
162
- pages = state.pages,
163
- executeExpression = state.executeExpression;
131
+ pages = state.pages,
132
+ executeExpression = state.executeExpression;
164
133
  var page = pager.page;
165
-
166
134
  if (page in pages) {
167
135
  var _pages$page = pages[page],
168
- isLoop = _pages$page.isLoop,
169
- subPages = _pages$page.subPages,
170
- iterations = _pages$page.iterations,
171
- loopDependencies = _pages$page.loopDependencies;
172
-
136
+ isLoop = _pages$page.isLoop,
137
+ subPages = _pages$page.subPages,
138
+ iterations = _pages$page.iterations,
139
+ loopDependencies = _pages$page.loopDependencies;
173
140
  if (isLoop) {
174
141
  return _objectSpread(_objectSpread({}, state), {}, {
142
+ isInLoop: true,
175
143
  pager: _objectSpread(_objectSpread({}, pager), {}, {
176
- subPage: 0,
144
+ subPage: initialPager.subPage || 0,
177
145
  nbSubPages: subPages.length,
178
- iteration: 0,
146
+ iteration: initialPager.iteration || 0,
179
147
  nbIterations: executeExpression(iterations, {
180
- iteration: 0,
148
+ iteration: undefined,
181
149
  bindingDependencies: loopDependencies
182
150
  })
183
151
  })
184
152
  });
185
153
  }
186
154
  }
187
-
188
155
  return state;
189
156
  }
190
-
191
157
  function reduceOnInit(state, action) {
192
158
  var payload = action.payload;
193
159
  var source = payload.source,
194
- data = payload.data,
195
- initialPage = payload.initialPage,
196
- features = payload.features,
197
- handleChange = payload.handleChange,
198
- preferences = payload.preferences,
199
- savingType = payload.savingType,
200
- management = payload.management,
201
- activeControls = payload.activeControls;
202
-
160
+ data = payload.data,
161
+ initialPage = payload.initialPage,
162
+ features = payload.features,
163
+ handleChange = payload.handleChange,
164
+ preferences = payload.preferences,
165
+ savingType = payload.savingType,
166
+ management = payload.management,
167
+ activeControls = payload.activeControls;
203
168
  if (source && data) {
204
169
  var variables = createVariables(source, data); // map des variables
205
-
206
170
  var _createExecuteExpress = (0, _commons.createExecuteExpression)(variables, features),
207
- _createExecuteExpress2 = _slicedToArray(_createExecuteExpress, 4),
208
- executeExpression = _createExecuteExpress2[0],
209
- updateBindings = _createExecuteExpress2[1],
210
- setLoopBindings = _createExecuteExpress2[2],
211
- resetLoopBindings = _createExecuteExpress2[3];
212
-
171
+ _createExecuteExpress2 = _slicedToArray(_createExecuteExpress, 4),
172
+ executeExpression = _createExecuteExpress2[0],
173
+ updateBindings = _createExecuteExpress2[1],
174
+ setLoopBindings = _createExecuteExpress2[2],
175
+ resetLoopBindings = _createExecuteExpress2[3];
213
176
  var pages = (0, _commons.checkLoops)((0, _commons.createMapPages)(source));
214
177
  var maxPage = source.maxPage,
215
- _source$cleaning = source.cleaning,
216
- cleaning = _source$cleaning === void 0 ? {} : _source$cleaning,
217
- _source$missingBlock = source.missingBlock,
218
- missingBlock = _source$missingBlock === void 0 ? {} : _source$missingBlock,
219
- _source$resizing = source.resizing,
220
- resizing = _source$resizing === void 0 ? {} : _source$resizing;
178
+ _source$cleaning = source.cleaning,
179
+ cleaning = _source$cleaning === void 0 ? {} : _source$cleaning,
180
+ _source$missingBlock = source.missingBlock,
181
+ missingBlock = _source$missingBlock === void 0 ? {} : _source$missingBlock,
182
+ _source$resizing = source.resizing,
183
+ resizing = _source$resizing === void 0 ? {} : _source$resizing;
184
+ var initialPager = (0, _pageTag.getPagerFromPageTag)(initialPage);
185
+ if (!initialPager) {
186
+ initialPager = {
187
+ page: 1
188
+ };
189
+ }
221
190
  var pager = {
222
- page: initialPage,
191
+ page: initialPager.page,
223
192
  maxPage: maxPage,
224
193
  subPage: undefined,
225
194
  nbSubPages: undefined,
@@ -227,11 +196,9 @@ function reduceOnInit(state, action) {
227
196
  nbIterations: undefined,
228
197
  lastReachedPage: initialPage
229
198
  };
230
-
231
199
  var _isFirstLastPage = (0, _commons.isFirstLastPage)(pager),
232
- isFirstPage = _isFirstLastPage.isFirstPage,
233
- isLastPage = _isFirstLastPage.isLastPage;
234
-
200
+ isFirstPage = _isFirstLastPage.isFirstPage,
201
+ isLastPage = _isFirstLastPage.isLastPage;
235
202
  return checkInLoop(_objectSpread(_objectSpread({}, state), {}, {
236
203
  cleaning: cleaning,
237
204
  missingBlock: missingBlock,
@@ -250,11 +217,9 @@ function reduceOnInit(state, action) {
250
217
  management: management,
251
218
  savingType: savingType,
252
219
  activeControls: activeControls
253
- }));
220
+ }), initialPager);
254
221
  }
255
-
256
222
  return state;
257
223
  }
258
-
259
224
  var _default = reduceOnInit;
260
225
  exports["default"] = _default;
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
7
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
-
10
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
-
12
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
-
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
13
  function reduceOnSetWaiting(state, action) {
15
14
  var payload = action.payload;
16
15
  var status = payload.status;
@@ -18,6 +17,5 @@ function reduceOnSetWaiting(state, action) {
18
17
  waiting: status
19
18
  });
20
19
  }
21
-
22
20
  var _default = reduceOnSetWaiting;
23
21
  exports["default"] = _default;
@@ -1,58 +1,38 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _reduceOnInit = _interopRequireDefault(require("./reduce-on-init"));
11
-
12
9
  var _reduceGoPreviousPage = _interopRequireDefault(require("./reduce-go-previous-page"));
13
-
14
10
  var _reduceGoNextPage = _interopRequireDefault(require("./reduce-go-next-page"));
15
-
16
11
  var _reduceGoToPage = _interopRequireDefault(require("./reduce-go-to-page"));
17
-
18
12
  var _reduceHandleChange = _interopRequireDefault(require("./reduce-handle-change"));
19
-
20
13
  var _reduceOnSetWaiting = _interopRequireDefault(require("./reduce-on-set-waiting"));
21
-
22
14
  var actions = _interopRequireWildcard(require("../actions"));
23
-
24
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
-
26
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
18
  function reducer(state, action) {
31
19
  var type = action.type;
32
-
33
20
  switch (type) {
34
21
  case actions.ON_INIT:
35
22
  return (0, _reduceOnInit["default"])(state, action);
36
-
37
23
  case actions.GO_PREVIOUS_PAGE:
38
24
  return (0, _reduceGoPreviousPage["default"])(state, action);
39
-
40
25
  case actions.GO_NEXT_PAGE:
41
26
  return (0, _reduceGoNextPage["default"])(state, action);
42
-
43
27
  case actions.GO_TO_PAGE:
44
28
  return (0, _reduceGoToPage["default"])(state, action);
45
-
46
29
  case actions.HANDLE_CHANGE:
47
30
  return (0, _reduceHandleChange["default"])(state, action);
48
-
49
31
  case actions.ON_SET_WAITING:
50
32
  return (0, _reduceOnSetWaiting["default"])(state, action);
51
-
52
33
  default:
53
34
  return state;
54
35
  }
55
36
  }
56
-
57
37
  var _default = reducer;
58
38
  exports["default"] = _default;
@@ -4,56 +4,57 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _validationUtils = require("./validation-utils");
9
-
10
8
  var _commons = require("../../commons");
11
-
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
-
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
15
  function validateComponents(state, components) {
19
- var pager = state.pager; // TODO check components in components (Loop, etc...)
20
-
16
+ var pager = state.pager;
21
17
  return components.reduce(function (errors, component) {
22
- var controls = component.controls;
23
-
18
+ var controls = component.controls,
19
+ componentType = component.componentType,
20
+ id = component.id;
24
21
  if (Array.isArray(controls)) {
25
22
  var componentErrors = (0, _validationUtils.resolveComponentControls)(state, controls);
26
-
27
- if (componentErrors.length) {
28
- return _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, (0, _commons.getPageTag)(pager), componentErrors));
29
- }
30
- } // If no error we remove the possible previous errors
31
-
32
-
33
- return _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, (0, _commons.getPageTag)(pager), []));
23
+ var shallowIteration = pager.shallowIteration;
24
+ var idC = shallowIteration !== undefined ? "".concat(id, "-").concat(shallowIteration) : id;
25
+ return _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, idC, componentErrors));
26
+ }
27
+ //Thanks to init which split basic Loops, we only go into unPaginatedLoops
28
+ if (['Loop', 'RosterForLoop'].includes(componentType)) {
29
+ var _components = component.components;
30
+ var recurs = validateComponents(state, _components);
31
+ return _objectSpread(_objectSpread(_objectSpread({}, (state.errors || {})[(0, _commons.getPageTag)(pager)] || {}), errors), recurs);
32
+ }
33
+ // If no error we remove the possible previous errors
34
+ return {};
34
35
  }, {});
35
36
  }
36
-
37
37
  function createControlsReducer(reducer) {
38
38
  // Nothing to init
39
39
  return function (state, action) {
40
40
  var activeControls = state.activeControls;
41
41
  var updatedState = reducer(state, action);
42
- if (!activeControls || state.pager.lastReachedPage !== updatedState.pager.lastReachedPage) //if no active controls or is the first time we reach the page
42
+ if (!activeControls || state.pager.lastReachedPage !== updatedState.pager.lastReachedPage)
43
+ //if no active controls or is the first time we reach the page
43
44
  return _objectSpread(_objectSpread({}, updatedState), {}, {
44
45
  currentErrors: undefined
45
46
  });
46
47
  var components = (0, _commons.getComponentsFromState)(updatedState);
47
-
48
- var errors = _objectSpread(_objectSpread({}, state.errors), validateComponents(updatedState, components));
49
-
50
48
  var pager = updatedState.pager;
49
+ var _state$errors = state.errors,
50
+ errors = _state$errors === void 0 ? {} : _state$errors;
51
+ var pageTag = (0, _commons.getPageTag)(pager);
52
+ var e = _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, pageTag, validateComponents(updatedState, components)));
51
53
  return _objectSpread(_objectSpread({}, updatedState), {}, {
52
- errors: errors,
53
- currentErrors: errors[(0, _commons.getPageTag)(pager)]
54
+ errors: e,
55
+ currentErrors: e[pageTag]
54
56
  });
55
57
  };
56
58
  }
57
-
58
59
  var _default = createControlsReducer;
59
60
  exports["default"] = _default;
@@ -5,84 +5,80 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  exports.isErrors = isErrors;
8
-
9
8
  var _validationUtils = require("./validation-utils");
10
-
11
9
  var _commons = require("../../commons");
12
-
10
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
-
15
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
-
17
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
-
13
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
16
  function validateComponentsForModal(state, components) {
20
- var pager = state.pager; // TODO check components in components (Loop, etc...)
21
-
17
+ var pager = state.pager;
22
18
  return components.reduce(function (errors, component) {
23
- var controls = component.controls;
24
-
19
+ var controls = component.controls,
20
+ componentType = component.componentType,
21
+ id = component.id;
25
22
  if (Array.isArray(controls)) {
26
23
  var componentErrors = (0, _validationUtils.resolveComponentControls)(state, controls);
27
-
28
24
  if (componentErrors.length) {
29
- return _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, (0, _commons.getPageTag)(pager), componentErrors));
25
+ var shallowIteration = pager.shallowIteration;
26
+ var idC = shallowIteration !== undefined ? "".concat(id, "-").concat(shallowIteration) : id;
27
+ return (0, _commons.getErrorsWithoutEmptyValue)(_objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, idC, componentErrors)));
30
28
  }
31
29
  }
32
-
33
- return errors;
30
+ //Thanks to init which split basic Loops, we only go into unPaginatedLoops
31
+ if (['Loop', 'RosterForLoop'].includes(componentType)) {
32
+ // TODO handle the case where shallowInteration hasn't been initalized because not handleChange fired
33
+ var _components = component.components;
34
+ var recurs = validateComponentsForModal(state, _components);
35
+ return (0, _commons.getErrorsWithoutEmptyValue)(_objectSpread(_objectSpread(_objectSpread({}, (state.errors || {})[(0, _commons.getPageTag)(pager)] || {}), errors), recurs));
36
+ }
37
+ // If no error we remove the possible previous errors
38
+ return {};
34
39
  }, {});
35
40
  }
36
-
37
41
  function isErrors(errors) {
38
42
  if (errors) {
39
43
  return Object.keys(errors).length > 0;
40
44
  }
41
-
42
45
  return false;
43
46
  }
44
-
45
47
  function createModalControlsReducer(reducer) {
46
48
  // Nothing to init
47
49
  return function (state, action) {
48
50
  var payload = action.payload;
49
51
  var activeControls = state.activeControls,
50
- errors = state.errors;
52
+ errors = state.errors;
51
53
  var block = payload.block;
52
54
  if (!activeControls) return reducer(_objectSpread(_objectSpread({}, state), {}, {
53
55
  modalErrors: undefined
54
56
  }), action);
55
57
  var components = (0, _commons.getComponentsFromState)(state);
56
58
  var prec = state.modalErrors;
57
-
58
59
  if (block) {
59
60
  // Block the modal and stay in page so we add the error in the current page
60
61
  return _objectSpread(_objectSpread({}, state), {}, {
61
62
  modalErrors: undefined,
62
- currentErrors: prec[(0, _commons.getPageTag)(state.pager)]
63
+ currentErrors: prec
63
64
  });
64
65
  }
65
-
66
66
  if (prec) {
67
67
  return reducer(_objectSpread(_objectSpread({}, state), {}, {
68
68
  modalErrors: undefined
69
69
  }), action);
70
70
  }
71
-
72
71
  var modalErrors = validateComponentsForModal(state, components);
73
-
74
72
  if (isErrors(modalErrors)) {
75
73
  return _objectSpread(_objectSpread({}, state), {}, {
76
74
  modalErrors: modalErrors,
77
75
  errors: _objectSpread(_objectSpread({}, errors), modalErrors)
78
76
  });
79
77
  }
80
-
81
78
  return reducer(_objectSpread(_objectSpread({}, state), {}, {
82
79
  modalErrors: undefined
83
80
  }), action);
84
81
  };
85
82
  }
86
-
87
83
  var _default = createModalControlsReducer;
88
84
  exports["default"] = _default;
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "createModalControlsReducer", {
15
15
  return _createModalControlsReducer["default"];
16
16
  }
17
17
  });
18
-
19
18
  var _createControlsReducer = _interopRequireDefault(require("./create-controls-reducer"));
20
-
21
19
  var _createModalControlsReducer = _interopRequireDefault(require("./create-modal-controls-reducer"));
22
-
23
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }