@inseefr/lunatic 2.6.2 → 2.7.0-rc.1
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.
- package/README.md +13 -3
- package/lib/components/button/lunatic-button.js +1 -2
- package/lib/components/checkbox/checkbox-boolean/html/checkbox-boolean.js +1 -2
- package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +1 -2
- package/lib/components/checkbox/checkbox-group/checkbox-group-content.js +1 -2
- package/lib/components/checkbox/checkbox-group/html/checkbox-group-content.js +1 -2
- package/lib/components/checkbox/checkbox-group/html/checkbox-group.js +1 -2
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +1 -2
- package/lib/components/checkbox/checkbox-one/html/checkbox-one.js +1 -2
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +1 -2
- package/lib/components/checkbox/commons/checkbox-option.js +1 -2
- package/lib/components/checkbox/commons/checkbox-option.spec.js +3 -3
- package/lib/components/checkbox/commons/getShortcutKey.js +2 -3
- package/lib/components/commons/components/combo-box/combo-box-container.js +1 -2
- package/lib/components/commons/components/combo-box/combo-box-content-box.js +1 -2
- package/lib/components/commons/components/combo-box/combo-box-content.js +5 -6
- package/lib/components/commons/components/combo-box/combo-box.js +4 -5
- package/lib/components/commons/components/combo-box/combo-box.stories.js +46 -49
- package/lib/components/commons/components/combo-box/keyboard-key-codes.js +2 -3
- package/lib/components/commons/components/combo-box/panel/combo-box-option.js +1 -2
- package/lib/components/commons/components/combo-box/panel/option-container.spec.js +3 -3
- package/lib/components/commons/components/combo-box/panel/panel-container.js +1 -2
- package/lib/components/commons/components/combo-box/panel/panel.spec.js +32 -17
- package/lib/components/commons/components/combo-box/selection/clear-button.js +1 -2
- package/lib/components/commons/components/combo-box/selection/clear-button.spec.js +61 -27
- package/lib/components/commons/components/combo-box/selection/combo-box-label-selection.js +1 -2
- package/lib/components/commons/components/combo-box/selection/input.js +4 -5
- package/lib/components/commons/components/combo-box/selection/label-selection.js +1 -2
- package/lib/components/commons/components/combo-box/selection/selection-container.js +1 -2
- package/lib/components/commons/components/combo-box/selection/selection.js +1 -1
- package/lib/components/commons/components/description.js +2 -4
- package/lib/components/commons/components/dragger/dragger.js +5 -6
- package/lib/components/commons/components/errors/errors.js +2 -3
- package/lib/components/commons/components/fab/fab.js +1 -2
- package/lib/components/commons/components/fab/fab.spec.js +59 -34
- package/lib/components/commons/components/field-container/field-container.js +1 -2
- package/lib/components/commons/components/fieldset.js +1 -2
- package/lib/components/commons/components/html-table/table.js +1 -2
- package/lib/components/commons/components/html-table/tbody.js +1 -2
- package/lib/components/commons/components/html-table/td.js +1 -2
- package/lib/components/commons/components/html-table/th.js +1 -2
- package/lib/components/commons/components/html-table/th.spec.js +3 -3
- package/lib/components/commons/components/html-table/thead.js +1 -2
- package/lib/components/commons/components/html-table/thead.spec.js +3 -3
- package/lib/components/commons/components/html-table/tr.js +1 -2
- package/lib/components/commons/components/is-network/is-network.js +7 -8
- package/lib/components/commons/components/is-network/use-online-status.js +1 -2
- package/lib/components/commons/components/label/label.js +1 -2
- package/lib/components/commons/components/lunatic-component-with-label.js +4 -5
- package/lib/components/commons/components/lunatic-component-without-label.js +4 -5
- package/lib/components/commons/components/md-label/link.js +1 -2
- package/lib/components/commons/components/md-label/md-label.js +4 -5
- package/lib/components/commons/components/missing/missing.js +5 -7
- package/lib/components/commons/components/nothing-to-display.js +1 -2
- package/lib/components/commons/components/orchestrated-component.js +6 -7
- package/lib/components/commons/components/variable-status/variable-status.js +5 -6
- package/lib/components/commons/create-customizable-field.js +4 -5
- package/lib/components/commons/icons/radio-checked-icon.js +1 -2
- package/lib/components/commons/index.js +3 -3
- package/lib/components/commons/safety-label.js +2 -3
- package/lib/components/commons/use-document-add-event-listener.js +1 -2
- package/lib/components/commons/use-on-handle-change.js +1 -2
- package/lib/components/commons/use-options-keydown.js +1 -2
- package/lib/components/component-set/html/component-set-wrapper.js +2 -3
- package/lib/components/component-set/html/component-set.js +1 -2
- package/lib/components/component-set/lunatic-component-set.js +3 -3
- package/lib/components/datepicker/html/datepicker-container.js +1 -2
- package/lib/components/datepicker/html/datepicker-input.js +1 -2
- package/lib/components/datepicker/html/datepicker.js +1 -2
- package/lib/components/datepicker/lunatic-datepicker.js +1 -2
- package/lib/components/declarations/declaration.js +1 -2
- package/lib/components/declarations/declarations-after-text.js +6 -7
- package/lib/components/declarations/declarations-before-text.js +6 -7
- package/lib/components/declarations/declarations-detachable.js +6 -7
- package/lib/components/declarations/declarations.js +2 -4
- package/lib/components/declarations/index.js +3 -3
- package/lib/components/dropdown/html/dropdown-simple/dropdown-simple.js +1 -2
- package/lib/components/dropdown/html/dropdown-simple/simple-label-renderer.js +1 -2
- package/lib/components/dropdown/html/dropdown-simple/simple-option-renderer.js +1 -2
- package/lib/components/dropdown/html/dropdown-writable/dropdown-writable.js +2 -3
- package/lib/components/dropdown/html/dropdown-writable/filter-tools/filter-options.js +1 -2
- package/lib/components/dropdown/html/dropdown-writable/filter-tools/get-label.js +2 -3
- package/lib/components/dropdown/html/dropdown-writable/filter-tools/letters-matching.js +1 -2
- package/lib/components/dropdown/html/dropdown-writable/filter-tools/match.js +1 -2
- package/lib/components/dropdown/html/dropdown-writable/filter-tools/prepare-prefix.js +1 -2
- package/lib/components/dropdown/html/dropdown-writable/writable-label-renderer.js +1 -2
- package/lib/components/dropdown/html/dropdown-writable/writable-option-renderer.js +5 -6
- package/lib/components/dropdown/html/dropdown.js +1 -2
- package/lib/components/dropdown/lunatic-dropdown.js +1 -2
- package/lib/components/duration/duration.js +1 -2
- package/lib/components/duration/durationInput.js +5 -6
- package/lib/components/duration/durationUtils.js +3 -5
- package/lib/components/duration/formatDuration.js +2 -3
- package/lib/components/duration/getDurationFromValue.js +1 -2
- package/lib/components/filter-description/component.js +1 -2
- package/lib/components/index.js +4 -4
- package/lib/components/input/html/input.js +1 -2
- package/lib/components/input/lunatic-input.js +1 -2
- package/lib/components/input-number/html/input-number-thousand.js +2 -3
- package/lib/components/input-number/html/input-number.js +1 -2
- package/lib/components/input-number/lunatic-input-number.js +1 -2
- package/lib/components/loop/block-for-loop.js +12 -17
- package/lib/components/loop/loop.js +3 -3
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +32 -41
- package/lib/components/lunatic-components.js +21 -10
- package/lib/components/modal/html/modal.js +1 -2
- package/lib/components/modal/lunatic-modal.js +2 -3
- package/lib/components/modal-controls/close-or-skip.js +1 -2
- package/lib/components/modal-controls/modal-container.js +1 -2
- package/lib/components/modal-controls/modal-controls.js +5 -6
- package/lib/components/pairwise-links/pairwise-links.js +28 -32
- package/lib/components/question-explication/html/question-explication.js +2 -3
- package/lib/components/question-explication/lunatic-question-explication.js +1 -2
- package/lib/components/question-explication/question-explication.spec.js +4 -4
- package/lib/components/questions/question-context.js +1 -2
- package/lib/components/questions/question-information.js +1 -2
- package/lib/components/radio/html/radio-group-content.js +1 -2
- package/lib/components/radio/html/radio-group.js +1 -2
- package/lib/components/radio/html/radio-option.js +2 -3
- package/lib/components/radio/lunatic-radio-group.js +1 -2
- package/lib/components/roundabout/components/roundabout-container.js +1 -2
- package/lib/components/roundabout/components/roundabout-it-button.js +4 -5
- package/lib/components/roundabout/components/roundabout-it-container.js +1 -2
- package/lib/components/roundabout/components/roundabout-it-title.js +1 -2
- package/lib/components/roundabout/components/roundabout-label.js +1 -2
- package/lib/components/roundabout/components/roundabout-pending.js +1 -2
- package/lib/components/roundabout/lunatic-roundabout.js +1 -2
- package/lib/components/roundabout/redirect.js +4 -5
- package/lib/components/roundabout/roundabout.js +1 -2
- package/lib/components/sequence/html/sequence.js +1 -2
- package/lib/components/sequence/lunatic-sequence.js +1 -2
- package/lib/components/sequence/sequence.spec.js +3 -3
- package/lib/components/subsequence/subsequence.js +1 -2
- package/lib/components/subsequence/subsequence.spec.js +3 -3
- package/lib/components/suggester/find-best-label/find-best-label.js +1 -2
- package/lib/components/suggester/html/notification.js +1 -2
- package/lib/components/suggester/html/suggester.js +5 -6
- package/lib/components/suggester/idb-suggester/check-store.js +4 -5
- package/lib/components/suggester/idb-suggester/idb-suggester.js +1 -1
- package/lib/components/suggester/idb-suggester/suggester-notification.js +1 -2
- package/lib/components/suggester/idb-suggester/suggester-status.js +1 -2
- package/lib/components/suggester/lunatic-suggester.js +1 -2
- package/lib/components/suggester/searching/create-searching.js +9 -6
- package/lib/components/suggester-loader-widget/loader-row.js +2 -3
- package/lib/components/suggester-loader-widget/loader.js +4 -5
- package/lib/components/suggester-loader-widget/progress.js +1 -2
- package/lib/components/suggester-loader-widget/tools/action-tool.js +1 -2
- package/lib/components/suggester-loader-widget/tools/tools.js +1 -2
- package/lib/components/suggester-loader-widget/widget-container.js +1 -2
- package/lib/components/suggester-loader-widget/widget.js +7 -8
- package/lib/components/summary/html/summary-responses.js +1 -2
- package/lib/components/summary/html/summary-title.js +1 -2
- package/lib/components/switch/html/switch.js +1 -2
- package/lib/components/switch/lunatic-switch.js +1 -2
- package/lib/components/table/lunatic-table.js +23 -15
- package/lib/components/table/{header.js → table-header.js} +3 -5
- package/lib/components/textarea/html/textarea.js +1 -2
- package/lib/components/textarea/lunatic-textarea.js +1 -2
- package/lib/constants/component-types.js +1 -2
- package/lib/constants/declarations.js +10 -18
- package/lib/constants/event-types.js +10 -20
- package/lib/constants/supported-preferences.js +4 -5
- package/lib/constants/value-types.js +5 -10
- package/lib/constants/variable-types.js +3 -5
- package/lib/hooks/use-track-changes.js +50 -0
- package/lib/i18n/build-dictionary.js +8 -11
- package/lib/i18n/dictionary.js +1 -2
- package/lib/i18n/index.js +7 -9
- package/lib/i18n/inputNumberProps.js +2 -4
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +6 -57
- package/lib/src/components/index.d.ts +2 -2
- package/lib/src/components/loop/block-for-loop.d.ts +3 -4
- package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +3 -4
- package/lib/src/components/lunatic-components.d.ts +5 -3
- package/lib/src/components/pairwise-links/pairwise-links.d.ts +1 -2
- package/lib/src/components/table/lunatic-table.d.ts +1 -1
- package/lib/src/components/table/{header.d.ts → table-header.d.ts} +2 -2
- package/lib/src/components/type.d.ts +5 -6
- package/lib/src/hooks/use-track-changes.d.ts +9 -0
- package/lib/src/use-lunatic/actions.d.ts +3 -16
- package/lib/src/use-lunatic/commons/compile-controls.d.ts +3 -2
- package/lib/src/use-lunatic/commons/component.d.ts +22 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-component-value.d.ts +2 -3
- package/lib/src/use-lunatic/commons/fill-components/fill-components.d.ts +6 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +107 -122
- package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +112 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +53 -89
- package/lib/src/use-lunatic/commons/get-compatible-vtl-expression.d.ts +1 -0
- package/lib/src/use-lunatic/commons/index.d.ts +0 -3
- package/lib/src/use-lunatic/commons/variables/behaviours/cleaning-behaviour.d.ts +7 -0
- package/lib/src/use-lunatic/commons/variables/behaviours/missing-behaviour.d.ts +7 -0
- package/lib/src/use-lunatic/commons/variables/behaviours/resizing-behaviour.d.ts +7 -0
- package/lib/src/use-lunatic/commons/variables/get-questionnaire-data.d.ts +4 -0
- package/lib/src/use-lunatic/commons/variables/lunatic-variables-store.d.ts +77 -0
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +10 -8
- package/lib/src/use-lunatic/reducer/reduce-handle-change.d.ts +6 -0
- package/lib/src/use-lunatic/reducer/reduce-on-init.d.ts +1 -12
- package/lib/src/use-lunatic/type-source.d.ts +7 -21
- package/lib/src/use-lunatic/type.d.ts +13 -11
- package/lib/src/use-lunatic/use-lunatic.d.ts +33 -56
- package/lib/src/utils/array.d.ts +6 -1
- package/lib/src/utils/env.d.ts +1 -0
- package/lib/src/utils/number.d.ts +4 -0
- package/lib/src/utils/variables.d.ts +5 -0
- package/lib/src/utils/vtl.d.ts +14 -0
- package/lib/stories/Introduction.stories.mdx +2 -4
- package/lib/stories/checkbox-boolean/checkboxBoolean.stories.js +5 -7
- package/lib/stories/checkbox-group/checkbox-group.stories.js +28 -11
- package/lib/stories/checkbox-group/source.json +343 -27
- package/lib/stories/checkbox-one/checkboxOne.stories.js +5 -7
- package/lib/stories/component-set/component-set.stories.js +7 -11
- package/lib/stories/custom-mui/checkbox-boolean-mui.js +4 -5
- package/lib/stories/custom-mui/checkbox-group-mui.js +4 -5
- package/lib/stories/custom-mui/checkbox-one-mui.js +1 -2
- package/lib/stories/custom-mui/input-mui.js +4 -5
- package/lib/stories/custom-mui/input-number-mui.js +4 -5
- package/lib/stories/custom-mui/radio-mui.js +4 -5
- package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +5 -6
- package/lib/stories/custom-mui/switch-mui.js +4 -5
- package/lib/stories/custom-mui/table-mui.js +1 -2
- package/lib/stories/custom-mui/tbody-mui.js +1 -2
- package/lib/stories/custom-mui/td-mui.js +1 -2
- package/lib/stories/custom-mui/textarea-mui.js +4 -5
- package/lib/stories/custom-mui/th-mui.js +1 -2
- package/lib/stories/custom-mui/thead-mui.js +1 -2
- package/lib/stories/custom-mui/tr-mui.js +1 -2
- package/lib/stories/date-picker/datepicker.stories.js +5 -7
- package/lib/stories/declaration/input.stories.js +5 -7
- package/lib/stories/disabled/disabled.stories.js +5 -7
- package/lib/stories/dropdown/dropdown.stories.js +5 -7
- package/lib/stories/duration/duration.stories.js +6 -9
- package/lib/stories/filter-description/filter-description.stories.js +6 -9
- package/lib/stories/input/input.stories.js +6 -9
- package/lib/stories/input-number/input-number.stories.js +7 -11
- package/lib/stories/loop/block-for-loop.stories.js +7 -11
- package/lib/stories/loop/paginated-loop.stories.js +5 -7
- package/lib/stories/loop/roster-for-loop.stories.js +8 -12
- package/lib/stories/modal/modal.stories.js +5 -7
- package/lib/stories/overview/overview.stories.js +5 -7
- package/lib/stories/pairwise/pairwise-links.stories.js +8 -12
- package/lib/stories/paste-questionnaire/test.stories.js +5 -7
- package/lib/stories/question-explication/question-explication.stories.js +5 -7
- package/lib/stories/questionnaires/logement/logement.stories.js +7 -11
- package/lib/stories/questionnaires/recensement/recensement.stories.js +5 -7
- package/lib/stories/questionnaires/rp/rp.stories.js +5 -7
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +8 -12
- package/lib/stories/questionnaires-test/controls/controls-externes.stories.js +5 -7
- package/lib/stories/questionnaires-test/controls/controls.stories.js +9 -15
- package/lib/stories/questionnaires-test/test.stories.js +9 -15
- package/lib/stories/questionnaires2023/bySequence/ticWeb.stories.js +5 -7
- package/lib/stories/questionnaires2023/famille/famille.stories.js +5 -7
- package/lib/stories/questionnaires2023/simpsons/simpsons.stories.js +5 -7
- package/lib/stories/questionnaires2023/ticTel/ticWeb.stories.js +5 -7
- package/lib/stories/questionnaires2023/ticWeb/ticWeb.stories.js +5 -7
- package/lib/stories/radio/radio.stories.js +5 -7
- package/lib/stories/resizing-questionnaire/test.stories.js +5 -7
- package/lib/stories/roundabout/roundabout.stories.js +6 -9
- package/lib/stories/sequence/sequence.stories.js +5 -7
- package/lib/stories/suggester/suggester-workers.stories.js +7 -9
- package/lib/stories/suggester/suggester.stories.js +8 -12
- package/lib/stories/summary/summary.stories.js +5 -7
- package/lib/stories/switch/switch.stories.js +7 -9
- package/lib/stories/table/table.stories.js +10 -15
- package/lib/stories/textarea/textarea.stories.js +5 -7
- package/lib/stories/utils/default-arg-types.js +4 -5
- package/lib/stories/utils/options.js +5 -9
- package/lib/stories/utils/orchestrator.js +10 -10
- package/lib/stories/utils/overview.js +2 -3
- package/lib/stories/utils/waiting/waiting.js +1 -2
- package/lib/test.d.js +3 -0
- package/lib/use-lunatic/actions.js +10 -18
- package/lib/use-lunatic/commons/check-loops.js +5 -6
- package/lib/use-lunatic/commons/compile-controls.js +6 -8
- package/lib/use-lunatic/commons/component.js +22 -0
- package/lib/use-lunatic/commons/compose.js +1 -2
- package/lib/use-lunatic/commons/create-map-pages.js +4 -5
- package/lib/use-lunatic/commons/execute-condition-filter.js +2 -11
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +6 -8
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js +24 -10
- package/lib/use-lunatic/commons/fill-components/fill-components.js +5 -5
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +4 -5
- package/lib/use-lunatic/commons/fill-components/fill-iterations.js +45 -0
- package/lib/use-lunatic/commons/fill-components/fill-management.js +4 -5
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +10 -18
- package/lib/use-lunatic/commons/fill-components/fill-pagination.js +4 -5
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +63 -11
- package/lib/use-lunatic/commons/get-compatible-vtl-expression.js +3 -3
- package/lib/use-lunatic/commons/get-components-from-state.js +1 -2
- package/lib/use-lunatic/commons/get-errors-without-empty-value.js +2 -3
- package/lib/use-lunatic/commons/getOverview.js +3 -4
- package/lib/use-lunatic/commons/index.js +0 -21
- package/lib/use-lunatic/commons/is-First-last-page.js +1 -2
- package/lib/use-lunatic/commons/is-paginated-loop.js +1 -2
- package/lib/use-lunatic/commons/page-navigation.js +4 -4
- package/lib/use-lunatic/commons/page-navigation.spec.js +3 -3
- package/lib/use-lunatic/commons/page-tag.js +3 -3
- package/lib/use-lunatic/commons/use-components-from-state.js +1 -2
- package/lib/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +39 -0
- package/lib/use-lunatic/commons/variables/behaviours/missing-behaviour.js +47 -0
- package/lib/use-lunatic/commons/variables/behaviours/resizing-behaviour.js +78 -0
- package/lib/use-lunatic/commons/variables/get-questionnaire-data.js +65 -0
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.js +329 -0
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.spec.js +216 -0
- package/lib/use-lunatic/initial-state.js +6 -4
- package/lib/use-lunatic/lunatic-context.js +3 -6
- package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +3 -3
- package/lib/use-lunatic/reducer/commons/is-loop-component.js +2 -3
- package/lib/use-lunatic/reducer/commons/resize-array-variable.js +1 -2
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.js +1 -1
- package/lib/use-lunatic/reducer/overview/overview-on-change.js +6 -7
- package/lib/use-lunatic/reducer/overview/overview-on-init.js +5 -5
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +5 -6
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +4 -5
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +4 -5
- package/lib/use-lunatic/reducer/reduce-handle-change.js +29 -0
- package/lib/use-lunatic/reducer/reduce-on-init.js +93 -186
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +4 -5
- package/lib/use-lunatic/reducer/reduce-update-state.js +3 -3
- package/lib/use-lunatic/reducer/reducer.js +3 -4
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +2 -4
- package/lib/use-lunatic/type-source.js +4 -7
- package/lib/use-lunatic/use-lunatic.js +23 -20
- package/lib/use-lunatic/use-lunatic.test.js +134 -5
- package/lib/use-lunatic/use-suggesters.js +6 -7
- package/lib/utils/array.js +57 -6
- package/lib/utils/array.spec.js +30 -0
- package/lib/utils/constants/alphabet.js +1 -2
- package/lib/utils/constants/features.js +3 -6
- package/lib/utils/constants/links.js +2 -4
- package/lib/utils/constants/missing.js +2 -4
- package/lib/utils/constants/variable-status.js +5 -10
- package/lib/utils/constants/variable-types.js +1 -2
- package/lib/utils/env.js +10 -0
- package/lib/utils/function.js +1 -2
- package/lib/utils/get-component-value.js +3 -9
- package/lib/utils/idb-tools/clear-store.js +3 -4
- package/lib/utils/idb-tools/create-db-opener.js +1 -2
- package/lib/utils/idb-tools/create-open-db.js +1 -2
- package/lib/utils/idb-tools/get-entity.js +1 -2
- package/lib/utils/idb-tools/get-idb.js +1 -2
- package/lib/utils/idb-tools/idb-bulk-insert.js +5 -7
- package/lib/utils/idb-tools/index.js +3 -3
- package/lib/utils/idb-tools/insert-entity.js +1 -2
- package/lib/utils/idb-tools/open-db.js +3 -4
- package/lib/utils/idb-tools/open-or-create-db.js +2 -3
- package/lib/utils/is-object.js +1 -1
- package/lib/utils/logger.js +3 -4
- package/lib/utils/number.js +14 -2
- package/lib/utils/object.js +1 -1
- package/lib/utils/store-tools/clear-store-data.js +3 -4
- package/lib/utils/store-tools/clear-store-info.js +3 -4
- package/lib/utils/store-tools/constantes.js +7 -14
- package/lib/utils/store-tools/create/create.js +3 -4
- package/lib/utils/store-tools/create/update-store-info.js +1 -2
- package/lib/utils/store-tools/get-store-count.js +1 -2
- package/lib/utils/store-tools/index.js +3 -3
- package/lib/utils/store-tools/initStore.js +2 -2
- package/lib/utils/store-tools/open-or-create-store.js +1 -2
- package/lib/utils/store-tools/use-store-index.js +4 -5
- package/lib/utils/suggester-workers/append-to-index/append.js +3 -4
- package/lib/utils/suggester-workers/append-to-index/append.worker.js +1 -2
- package/lib/utils/suggester-workers/append-to-index/prepare-entities.js +5 -6
- package/lib/utils/suggester-workers/append-to-index/store-messages.js +4 -5
- package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +4 -5
- package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +5 -6
- package/lib/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +4 -5
- package/lib/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +4 -5
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +4 -5
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/stop-words.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/get-regexp-from-pattern.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/get-stemmer.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +1 -2
- package/lib/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +1 -2
- package/lib/utils/suggester-workers/create-worker-ts.js +2 -3
- package/lib/utils/suggester-workers/create-worker.js +2 -3
- package/lib/utils/suggester-workers/find-best-label/find-best-label.js +5 -6
- package/lib/utils/suggester-workers/find-best-label/tokenize.js +3 -4
- package/lib/utils/suggester-workers/searching/compute-score.js +4 -5
- package/lib/utils/suggester-workers/searching/get-db.js +3 -4
- package/lib/utils/suggester-workers/searching/order/create-alphanumeric-orderer.js +1 -2
- package/lib/utils/suggester-workers/searching/order/index.js +1 -2
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.js +1 -2
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +1 -2
- package/lib/utils/suggester-workers/searching/resolve-query-parser.js +3 -4
- package/lib/utils/suggester-workers/searching/search-in-index.js +1 -2
- package/lib/utils/suggester-workers/searching/searching.js +5 -6
- package/lib/utils/variables.js +37 -0
- package/lib/utils/vtl.js +100 -0
- package/package.json +28 -16
- package/lib/components/loop/utils/get-initial-nb-rows.js +0 -17
- package/lib/components/pairwise-links/index.js +0 -13
- package/lib/components/pairwise-links/orchestrator.js +0 -71
- package/lib/components/pairwise-links/row.js +0 -74
- package/lib/components/table/cell.js +0 -89
- package/lib/components/table/index.js +0 -13
- package/lib/components/table/row.js +0 -40
- package/lib/components/table/table-orchestrator.js +0 -35
- package/lib/src/components/loop/utils/get-initial-nb-rows.d.ts +0 -4
- package/lib/src/components/pairwise-links/index.d.ts +0 -1
- package/lib/src/components/pairwise-links/orchestrator.d.ts +0 -6
- package/lib/src/components/pairwise-links/row.d.ts +0 -7
- package/lib/src/components/table/cell.d.ts +0 -19
- package/lib/src/components/table/index.d.ts +0 -1
- package/lib/src/components/table/row.d.ts +0 -18
- package/lib/src/components/table/table-orchestrator.d.ts +0 -4
- package/lib/src/use-lunatic/commons/calculated-variables.d.ts +0 -8
- package/lib/src/use-lunatic/commons/execute-expression/create-execute-expression.d.ts +0 -9
- package/lib/src/use-lunatic/commons/execute-expression/create-memoizer.d.ts +0 -8
- package/lib/src/use-lunatic/commons/execute-expression/create-refresh-calculated.d.ts +0 -24
- package/lib/src/use-lunatic/commons/execute-expression/execute-expression.d.ts +0 -11
- package/lib/src/use-lunatic/commons/execute-expression/get-expressions-variables.d.ts +0 -7
- package/lib/src/use-lunatic/commons/execute-expression/get-expressions-variables.spec.d.ts +0 -1
- package/lib/src/use-lunatic/commons/execute-expression/get-safety-expression.d.ts +0 -6
- package/lib/src/use-lunatic/commons/execute-expression/index.d.ts +0 -1
- package/lib/src/use-lunatic/commons/get-component-value/get-component-value.d.ts +0 -6
- package/lib/src/use-lunatic/commons/get-component-value/index.d.ts +0 -1
- package/lib/src/use-lunatic/commons/get-data.d.ts +0 -26
- package/lib/src/use-lunatic/reducer/reduce-handle-change/index.d.ts +0 -1
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.d.ts +0 -7
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.spec.d.ts +0 -1
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.d.ts +0 -4
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.d.ts +0 -15
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-missing.d.ts +0 -7
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-resizing.d.ts +0 -4
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.d.ts +0 -14
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.d.ts +0 -9
- package/lib/src/use-lunatic/reducer/reduce-on-init.spec.d.ts +0 -1
- package/lib/src/utils/vtl/dataset-builder.d.ts +0 -5
- package/lib/src/utils/vtl/index.d.ts +0 -1
- package/lib/stories/checkboxGroup/checkboxGroup.stories.js +0 -59
- package/lib/stories/checkboxGroup/source.json +0 -402
- package/lib/use-lunatic/commons/calculated-variables.js +0 -104
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +0 -233
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.spec.js +0 -155
- package/lib/use-lunatic/commons/execute-expression/create-memoizer.js +0 -63
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +0 -149
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.spec.js +0 -130
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +0 -90
- package/lib/use-lunatic/commons/execute-expression/execute-expression.spec.js +0 -38
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.js +0 -40
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.spec.js +0 -31
- package/lib/use-lunatic/commons/execute-expression/get-safety-expression.js +0 -35
- package/lib/use-lunatic/commons/execute-expression/index.js +0 -13
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +0 -174
- package/lib/use-lunatic/commons/get-component-value/index.js +0 -13
- package/lib/use-lunatic/commons/get-data.js +0 -80
- package/lib/use-lunatic/reducer/reduce-handle-change/__mocks__/source-cleaning-loop.json +0 -792
- package/lib/use-lunatic/reducer/reduce-handle-change/index.js +0 -13
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +0 -72
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.spec.js +0 -46
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +0 -115
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +0 -89
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +0 -88
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +0 -110
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +0 -44
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +0 -28
- package/lib/use-lunatic/reducer/reduce-on-init.spec.js +0 -17
- package/lib/utils/vtl/dataset-builder.js +0 -27
- package/lib/utils/vtl/index.js +0 -13
- /package/lib/src/use-lunatic/commons/{execute-expression/create-refresh-calculated.spec.d.ts → variables/lunatic-variables-store.spec.d.ts} +0 -0
- /package/lib/src/{use-lunatic/commons/execute-expression/execute-expression.spec.d.ts → utils/array.spec.d.ts} +0 -0
- /package/lib/stories/{checkboxGroup → checkbox-group}/sourceComponentset.json +0 -0
- /package/lib/stories/{checkboxGroup → checkbox-group}/sourceLoop.json +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
-
var _fillComponents =
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
function
|
|
8
|
+
var _fillComponents = _interopRequireWildcard(require("./fill-components"));
|
|
9
|
+
var _component = require("../component");
|
|
10
|
+
var _vtl = require("../../../utils/vtl");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
15
|
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
16
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
17
|
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); }
|
|
@@ -17,7 +19,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
17
19
|
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."); }
|
|
18
20
|
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); }
|
|
19
21
|
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; }
|
|
20
|
-
function _iterableToArrayLimit(
|
|
22
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
24
|
/**
|
|
23
25
|
* Fill props for roundabout
|
|
@@ -59,8 +61,9 @@ function fillChildComponentsWithIteration(component, state) {
|
|
|
59
61
|
getComponents: function getComponents(iteration) {
|
|
60
62
|
return (0, _fillComponents["default"])(component.components, _objectSpread(_objectSpread({}, state), {}, {
|
|
61
63
|
handleChange: function handleChange(response, value) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
state.handleChange(response, value, {
|
|
65
|
+
iteration: [iteration]
|
|
66
|
+
});
|
|
64
67
|
},
|
|
65
68
|
pager: _objectSpread(_objectSpread({}, state.pager), {}, {
|
|
66
69
|
iteration: iteration,
|
|
@@ -71,6 +74,52 @@ function fillChildComponentsWithIteration(component, state) {
|
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
/**
|
|
78
|
+
* For pairwise, inject a method to retrieve component at a specific iteration combination
|
|
79
|
+
*/
|
|
80
|
+
function fillPairwise(component, state) {
|
|
81
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
82
|
+
getComponents: function getComponents(x, y) {
|
|
83
|
+
if (x === y) {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
return (0, _fillComponents["default"])(component.components, _objectSpread(_objectSpread({}, state), {}, {
|
|
87
|
+
handleChange: function handleChange(response, value) {
|
|
88
|
+
state.handleChange(response, value, {
|
|
89
|
+
iteration: [x, y]
|
|
90
|
+
});
|
|
91
|
+
// Update linked value
|
|
92
|
+
if (response.name in component.symLinks && value in component.symLinks[response.name]) {
|
|
93
|
+
state.handleChange(response, component.symLinks[response.name][value], {
|
|
94
|
+
iteration: [y, x]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
pager: _objectSpread(_objectSpread({}, state.pager), {}, {
|
|
99
|
+
linksIterations: [x, y],
|
|
100
|
+
subPage: 0 // Fake a subpage to simulate an iteration
|
|
101
|
+
})
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* For pairwise, inject a method to retrieve component at a specific iteration combination
|
|
109
|
+
*/
|
|
110
|
+
function fillTable(component, state) {
|
|
111
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
112
|
+
body: component.body.map(function (row) {
|
|
113
|
+
return row.map(function (component) {
|
|
114
|
+
if ((0, _component.hasComponentType)(component)) {
|
|
115
|
+
return (0, _fillComponents.fillComponent)(component, state);
|
|
116
|
+
}
|
|
117
|
+
return state.executeExpression((0, _vtl.getVTLCompatibleValue)(component.label));
|
|
118
|
+
});
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
74
123
|
/**
|
|
75
124
|
* Fill component specific props (RoundAbout for instance)
|
|
76
125
|
*/
|
|
@@ -83,9 +132,12 @@ function fillSpecificExpressions(component, state) {
|
|
|
83
132
|
case 'Loop':
|
|
84
133
|
case 'RosterForLoop':
|
|
85
134
|
return fillChildComponentsWithIteration(component, state);
|
|
135
|
+
case 'PairwiseLinks':
|
|
136
|
+
return fillPairwise(component, state);
|
|
137
|
+
case 'Table':
|
|
138
|
+
return fillTable(component, state);
|
|
86
139
|
default:
|
|
87
140
|
return component;
|
|
88
141
|
}
|
|
89
142
|
}
|
|
90
|
-
var _default = fillSpecificExpressions;
|
|
91
|
-
exports["default"] = _default;
|
|
143
|
+
var _default = exports["default"] = fillSpecificExpressions;
|
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _constants = require("../../utils/constants");
|
|
8
|
-
function _typeof(
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
9
|
/**
|
|
10
10
|
* Ensure that an expression is compatible with VTL (convert if necessary)
|
|
11
|
+
* @deprecated use getExpressionAsString() instead
|
|
11
12
|
*/
|
|
12
13
|
function getCompatibleVTLExpression(expression) {
|
|
13
14
|
if (typeof expression === 'string') {
|
|
@@ -24,5 +25,4 @@ function getCompatibleVTLExpression(expression) {
|
|
|
24
25
|
}
|
|
25
26
|
console.warn("Non-VTL compatible expression : ".concat(expression));
|
|
26
27
|
}
|
|
27
|
-
var _default = getCompatibleVTLExpression;
|
|
28
|
-
exports["default"] = _default;
|
|
28
|
+
var _default = exports["default"] = getCompatibleVTLExpression;
|
|
@@ -43,5 +43,4 @@ function filterComponentsInPage(components) {
|
|
|
43
43
|
return c.componentType === 'FilterDescription' ? c.filterDescription : true;
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
var _default = getComponentsFromState;
|
|
47
|
-
exports["default"] = _default;
|
|
46
|
+
var _default = exports["default"] = getComponentsFromState;
|
|
@@ -8,7 +8,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
8
8
|
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."); }
|
|
9
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); }
|
|
10
10
|
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; }
|
|
11
|
-
function _iterableToArrayLimit(
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
/**
|
|
14
14
|
* Keep errors with at least one error inside
|
|
@@ -21,5 +21,4 @@ function getErrorsWithoutEmptyValue(errors) {
|
|
|
21
21
|
return Array.isArray(value) && value.length;
|
|
22
22
|
})) : {};
|
|
23
23
|
}
|
|
24
|
-
var _default = getErrorsWithoutEmptyValue;
|
|
25
|
-
exports["default"] = _default;
|
|
24
|
+
var _default = exports["default"] = getErrorsWithoutEmptyValue;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.overviewWithChildren = void 0;
|
|
7
|
-
var overviewWithChildren = function overviewWithChildren(stateOverview) {
|
|
7
|
+
var overviewWithChildren = exports.overviewWithChildren = function overviewWithChildren(stateOverview) {
|
|
8
8
|
var wipOverview = stateOverview.filter(function (entry) {
|
|
9
9
|
return entry.type === 'sequence';
|
|
10
10
|
}).map(function (entry) {
|
|
@@ -33,8 +33,7 @@ var overviewWithChildren = function overviewWithChildren(stateOverview) {
|
|
|
33
33
|
};
|
|
34
34
|
(_wipOverview$find = wipOverview.find(function (seq) {
|
|
35
35
|
return seq.page === subSeq.parent;
|
|
36
|
-
})) === null || _wipOverview$find === void 0
|
|
36
|
+
})) === null || _wipOverview$find === void 0 || _wipOverview$find.children.push(subEntry);
|
|
37
37
|
});
|
|
38
38
|
return wipOverview;
|
|
39
|
-
};
|
|
40
|
-
exports.overviewWithChildren = overviewWithChildren;
|
|
39
|
+
};
|
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "checkLoops", {
|
|
|
9
9
|
return _checkLoops["default"];
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "createExecuteExpression", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _executeExpression["default"];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "createMapPages", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function get() {
|
|
@@ -45,12 +39,6 @@ Object.defineProperty(exports, "getComponentsFromState", {
|
|
|
45
39
|
return _getComponentsFromState["default"];
|
|
46
40
|
}
|
|
47
41
|
});
|
|
48
|
-
Object.defineProperty(exports, "getErrorsWithoutEmptyValue", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _getErrorsWithoutEmptyValue["default"];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
42
|
Object.defineProperty(exports, "getNewReachedPage", {
|
|
55
43
|
enumerable: true,
|
|
56
44
|
get: function get() {
|
|
@@ -75,12 +63,6 @@ Object.defineProperty(exports, "isNewReachedPage", {
|
|
|
75
63
|
return _pageTag.isNewReachedPage;
|
|
76
64
|
}
|
|
77
65
|
});
|
|
78
|
-
Object.defineProperty(exports, "isPaginatedLoop", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function get() {
|
|
81
|
-
return _isPaginatedLoop["default"];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
66
|
Object.defineProperty(exports, "useComponentsFromState", {
|
|
85
67
|
enumerable: true,
|
|
86
68
|
get: function get() {
|
|
@@ -90,13 +72,10 @@ Object.defineProperty(exports, "useComponentsFromState", {
|
|
|
90
72
|
var _checkLoops = _interopRequireDefault(require("./check-loops"));
|
|
91
73
|
var _createMapPages = _interopRequireDefault(require("./create-map-pages"));
|
|
92
74
|
var _executeConditionFilter = _interopRequireDefault(require("./execute-condition-filter"));
|
|
93
|
-
var _executeExpression = _interopRequireDefault(require("./execute-expression"));
|
|
94
75
|
var _fillComponentExpressions = _interopRequireDefault(require("./fill-components/fill-component-expressions"));
|
|
95
76
|
var _getCompatibleVtlExpression = _interopRequireDefault(require("./get-compatible-vtl-expression"));
|
|
96
77
|
var _getComponentsFromState = _interopRequireDefault(require("./get-components-from-state"));
|
|
97
|
-
var _getErrorsWithoutEmptyValue = _interopRequireDefault(require("./get-errors-without-empty-value"));
|
|
98
78
|
var _isFirstLastPage = _interopRequireDefault(require("./is-First-last-page"));
|
|
99
|
-
var _isPaginatedLoop = _interopRequireDefault(require("./is-paginated-loop"));
|
|
100
79
|
var _pageTag = require("./page-tag");
|
|
101
80
|
var _useComponentsFromState = _interopRequireDefault(require("./use-components-from-state"));
|
|
102
81
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getNextPager = getNextPager;
|
|
8
8
|
exports.getPrevPager = getPrevPager;
|
|
9
|
-
function ownKeys(
|
|
10
|
-
function _objectSpread(
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
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; }
|
|
12
12
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
13
|
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); }
|
|
@@ -15,7 +15,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
15
15
|
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."); }
|
|
16
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); }
|
|
17
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; }
|
|
18
|
-
function _iterableToArrayLimit(
|
|
18
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
var resetIteration = {
|
|
21
21
|
subPage: undefined,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var _vitest = require("vitest");
|
|
4
4
|
var _pageNavigation = require("./page-navigation");
|
|
5
|
-
function _typeof(
|
|
6
|
-
function ownKeys(
|
|
7
|
-
function _objectSpread(
|
|
5
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
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; }
|
|
9
9
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
10
|
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); }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -10,7 +10,7 @@ exports.getPagerFromPageTag = getPagerFromPageTag;
|
|
|
10
10
|
exports.isNewReachedPage = isNewReachedPage;
|
|
11
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
12
|
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
|
-
function _iterableToArrayLimit(
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
16
|
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."); }
|
|
@@ -18,7 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
18
18
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
19
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
20
|
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; }
|
|
21
|
-
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(
|
|
21
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = new RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
|
22
22
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
23
23
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
24
24
|
/**
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.cleaningBehaviour = cleaningBehaviour;
|
|
7
|
+
/**
|
|
8
|
+
* Cleaning behaviour for the store
|
|
9
|
+
* When a variable changes, other variables can be reset
|
|
10
|
+
*/
|
|
11
|
+
function cleaningBehaviour(store, cleaning) {
|
|
12
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
13
|
+
if (!cleaning) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Create a map to improve performance
|
|
18
|
+
var cleaningMap = new Map(Object.entries(cleaning));
|
|
19
|
+
store.on('change', function (e) {
|
|
20
|
+
var cleaningInfo = cleaningMap.get(e.detail.name);
|
|
21
|
+
|
|
22
|
+
// The variable does not have cleaning
|
|
23
|
+
if (!cleaningInfo) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (var variableName in cleaningInfo) {
|
|
27
|
+
var _initialValues$variab;
|
|
28
|
+
var skipCleaning = store.run(cleaningInfo[variableName], {
|
|
29
|
+
iteration: e.detail.iteration
|
|
30
|
+
});
|
|
31
|
+
if (skipCleaning) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
store.set(variableName, (_initialValues$variab = initialValues[variableName]) !== null && _initialValues$variab !== void 0 ? _initialValues$variab : null, {
|
|
35
|
+
iteration: e.detail.iteration
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.missingBehaviour = missingBehaviour;
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
/**
|
|
11
|
+
* Add missing behaviour to the store
|
|
12
|
+
* Missing works as a simplified cleaning that reset a linked variable
|
|
13
|
+
*/
|
|
14
|
+
function missingBehaviour(store, missing) {
|
|
15
|
+
if (!missing) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Create a map to improve performance
|
|
20
|
+
var missingMap = new Map(Object.entries(missing));
|
|
21
|
+
store.on('change', function (e) {
|
|
22
|
+
// Only clean if a value is set
|
|
23
|
+
if (e.detail.value === null || e.detail.value === undefined) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var linkedVariables = missingMap.get(e.detail.name);
|
|
27
|
+
|
|
28
|
+
// The variable does not have missing variable linked
|
|
29
|
+
if (!linkedVariables) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var _iterator = _createForOfIteratorHelper(linkedVariables),
|
|
33
|
+
_step;
|
|
34
|
+
try {
|
|
35
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
36
|
+
var variableName = _step.value;
|
|
37
|
+
store.set(variableName, null, {
|
|
38
|
+
iteration: e.detail.iteration
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
_iterator.e(err);
|
|
43
|
+
} finally {
|
|
44
|
+
_iterator.f();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resizingBehaviour = resizingBehaviour;
|
|
7
|
+
var _number = require("../../../../utils/number");
|
|
8
|
+
var _commons = require("../../../reducer/commons");
|
|
9
|
+
var _vtl = require("../../../../utils/vtl");
|
|
10
|
+
var _array = require("../../../../utils/array");
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
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); }
|
|
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; }
|
|
18
|
+
/**
|
|
19
|
+
* Resizing behaviour for the store
|
|
20
|
+
* When a variable changes, multiple other variables can change size (size of the array)
|
|
21
|
+
*/
|
|
22
|
+
function resizingBehaviour(store, resizing) {
|
|
23
|
+
if (!resizing) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Create a map to improve performance
|
|
28
|
+
var resizingMap = new Map(Object.entries(resizing));
|
|
29
|
+
store.on('change', function (e) {
|
|
30
|
+
// The variable does not have resizing
|
|
31
|
+
var resizingInfo = resizingMap.get(e.detail.name);
|
|
32
|
+
if (!resizingInfo) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Pairwise resizing
|
|
37
|
+
if ('sizeForLinksVariables' in resizingInfo) {
|
|
38
|
+
resizePairwise(store, resizingInfo, e.detail);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!resizingInfo.size) {
|
|
42
|
+
throw new Error("Cannot resize ".concat(e.detail.name, " missing \"size\" property"));
|
|
43
|
+
}
|
|
44
|
+
var newSize = (0, _number.forceInt)(store.run(resizingInfo.size));
|
|
45
|
+
var _iterator = _createForOfIteratorHelper(resizingInfo.variables),
|
|
46
|
+
_step;
|
|
47
|
+
try {
|
|
48
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
49
|
+
var variableName = _step.value;
|
|
50
|
+
var value = store.get(variableName);
|
|
51
|
+
if (!Array.isArray(value) || value.length !== newSize) {
|
|
52
|
+
store.set(variableName, (0, _commons.resizeArrayVariable)(value, newSize, null));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} catch (err) {
|
|
56
|
+
_iterator.e(err);
|
|
57
|
+
} finally {
|
|
58
|
+
_iterator.f();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function resizePairwise(store, resizingInfo, args) {
|
|
63
|
+
var _resizingInfo$sizeFor = resizingInfo.sizeForLinksVariables.map(function (expression) {
|
|
64
|
+
return (0, _number.forceInt)(store.run((0, _vtl.getExpressionAsString)(expression)));
|
|
65
|
+
}),
|
|
66
|
+
_resizingInfo$sizeFor2 = _slicedToArray(_resizingInfo$sizeFor, 2),
|
|
67
|
+
xSize = _resizingInfo$sizeFor2[0],
|
|
68
|
+
ySize = _resizingInfo$sizeFor2[1];
|
|
69
|
+
resizingInfo.linksVariables.forEach(function (variable) {
|
|
70
|
+
var value = store.get(variable, args.iteration);
|
|
71
|
+
var resizedValue = (0, _array.resizeArray)(
|
|
72
|
+
// The value is not an array, force an array
|
|
73
|
+
Array.isArray(value) ? value.map(function (i) {
|
|
74
|
+
return (0, _array.resizeArray)(i, ySize, null);
|
|
75
|
+
}) : [], xSize, new Array(ySize).fill(null));
|
|
76
|
+
store.set(variable, resizedValue);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getQuestionnaireData = getQuestionnaireData;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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); }
|
|
16
|
+
function getQuestionnaireData(store, variables) {
|
|
17
|
+
var withCalculated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
18
|
+
var variableNames = arguments.length > 3 ? arguments[3] : undefined;
|
|
19
|
+
var result = {
|
|
20
|
+
EXTERNAL: {},
|
|
21
|
+
CALCULATED: {},
|
|
22
|
+
COLLECTED: {}
|
|
23
|
+
};
|
|
24
|
+
if (!variables) {
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Only return requested variables
|
|
29
|
+
if (variableNames) {
|
|
30
|
+
return _objectSpread(_objectSpread({}, result), {}, {
|
|
31
|
+
COLLECTED: Object.fromEntries(variableNames.map(function (name) {
|
|
32
|
+
return [name, {
|
|
33
|
+
EDITED: null,
|
|
34
|
+
FORCED: null,
|
|
35
|
+
INPUTED: null,
|
|
36
|
+
PREVIOUS: null,
|
|
37
|
+
COLLECTED: store.get(name)
|
|
38
|
+
}];
|
|
39
|
+
}))
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var _iterator = _createForOfIteratorHelper(variables),
|
|
43
|
+
_step;
|
|
44
|
+
try {
|
|
45
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
46
|
+
var variable = _step.value;
|
|
47
|
+
// Skip calculated value if necessary
|
|
48
|
+
if (variable.variableType === 'CALCULATED' && !withCalculated) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (variable.variableType === 'COLLECTED') {
|
|
52
|
+
result.COLLECTED[variable.name] = _objectSpread(_objectSpread({}, variable.values), {}, {
|
|
53
|
+
COLLECTED: store.get(variable.name)
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
result[variable.variableType][variable.name] = store.get(variable.name);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_iterator.e(err);
|
|
61
|
+
} finally {
|
|
62
|
+
_iterator.f();
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|