@inseefr/lunatic 2.0.4-v2 → 2.0.5-v2

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