@inseefr/lunatic 2.5.2-rc1-beta → 2.6.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.fr.md +186 -0
- package/README.md +111 -94
- package/lib/components/button/lunatic-button.js +10 -13
- package/lib/components/checkbox/checkbox-group/html/checkbox-group.js +0 -1
- package/lib/components/commons/components/combo-box/combo-box-content.js +2 -1
- package/lib/components/commons/components/combo-box/combo-box.js +94 -66
- package/lib/components/commons/components/combo-box/combo-box.stories.js +69 -8
- package/lib/components/commons/components/combo-box/panel/panel.js +0 -1
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.js +4 -1
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.spec.js +2 -4
- package/lib/components/commons/components/combo-box/selection/combo-box-label-selection.js +5 -2
- package/lib/components/commons/components/combo-box/selection/label-selection.js +4 -2
- package/lib/components/commons/components/combo-box/selection/selection.js +2 -0
- package/lib/components/commons/components/fab/fab.js +0 -1
- package/lib/components/commons/components/fieldset.js +0 -1
- package/lib/components/commons/components/lunatic-component-with-label.js +1 -3
- package/lib/components/commons/components/md-label/md-label.js +5 -1
- package/lib/components/commons/components/md-label/md-label.spec.js +15 -0
- package/lib/components/commons/components/missing/missing.js +1 -3
- package/lib/components/commons/components/variable-status/variable-status.js +2 -3
- package/lib/components/commons/create-customizable-field.js +1 -0
- package/lib/components/commons/icons/closed-icon.js +0 -2
- package/lib/components/commons/icons/cross-icon.js +0 -2
- package/lib/components/commons/index.js +0 -7
- package/lib/components/component-set/html/__snapshots__/component-set.spec.tsx.snap +124 -0
- package/lib/components/component-set/html/{legend/legend.js → component-set-legend.js} +4 -6
- package/lib/components/component-set/html/component-set-wrapper.js +16 -0
- package/lib/components/component-set/html/component-set.js +7 -8
- package/lib/components/component-set/html/component-set.spec.js +91 -0
- package/lib/components/component-set/lunatic-component-set.js +19 -9
- package/lib/components/datepicker/html/__snapshots__/datepicker.spec.tsx.snap +34 -0
- package/lib/components/datepicker/html/datepicker-input.js +0 -1
- package/lib/components/datepicker/html/datepicker.js +1 -4
- package/lib/components/datepicker/html/datepicker.spec.js +38 -0
- package/lib/components/datepicker/lunatic-datepicker.js +0 -1
- package/lib/components/dropdown/html/__snapshots__/dropdown.spec.tsx.snap +85 -0
- package/lib/components/dropdown/html/dropdown-simple/dropdown-simple.js +3 -2
- package/lib/components/dropdown/html/dropdown-simple/simple-label-renderer.js +0 -2
- package/lib/components/dropdown/html/dropdown-writable/dropdown-writable.js +4 -5
- package/lib/components/dropdown/html/dropdown-writable/writable-label-renderer.js +1 -4
- package/lib/components/dropdown/html/dropdown-writable/writable-option-renderer.js +1 -3
- package/lib/components/dropdown/html/dropdown.js +4 -2
- package/lib/components/dropdown/html/dropdown.spec.js +48 -0
- package/lib/components/dropdown/lunatic-dropdown.js +5 -4
- package/lib/components/duration/getDurationFromValue.js +0 -1
- package/lib/components/filter-description/component.js +0 -2
- package/lib/components/index.js +6 -5
- package/lib/components/input/html/__snapshots__/input.spec.tsx.snap +34 -0
- package/lib/components/input/html/input.js +4 -5
- package/lib/components/input/html/input.spec.js +81 -0
- package/lib/components/input/lunatic-input.js +4 -2
- package/lib/components/input-number/html/__snapshots__/input-number.spec.tsx.snap +38 -90
- package/lib/components/input-number/html/input-number-thousand.js +2 -0
- package/lib/components/input-number/html/input-number.js +3 -0
- package/lib/components/input-number/html/input-number.spec.js +35 -19
- package/lib/components/input-number/lunatic-input-number.js +2 -1
- package/lib/components/loop/{block-for-loop/block-for-loop.js → block-for-loop.js} +39 -64
- package/lib/components/loop/{commons/handle-row-button.js → loop-button.js} +4 -7
- package/lib/components/loop/{roster-for-loop/header.js → loop-header.js} +4 -8
- package/lib/components/loop/loop.js +19 -65
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +102 -83
- package/lib/components/loop/{commons/get-init-length.js → utils/get-initial-nb-rows.js} +6 -5
- package/lib/components/{loop/roster-for-loop/body.js → lunatic-components.js} +46 -37
- package/lib/components/modal/html/modal.js +45 -73
- package/lib/components/modal/html/modal.scss +25 -42
- package/lib/components/modal/lunatic-modal.js +33 -9
- package/lib/components/modal-controls/close-or-skip.js +0 -1
- package/lib/components/modal-controls/modal-controls.spec.js +5 -6
- package/lib/components/pairwise-links/orchestrator.js +1 -4
- package/lib/components/pairwise-links/row.js +1 -4
- package/lib/components/question-explication/html/question-explication.js +0 -1
- package/lib/components/radio/html/radio-group-content.js +4 -3
- package/lib/components/radio/html/radio-group.js +4 -2
- package/lib/components/radio/html/radio-option.js +7 -8
- package/lib/components/radio/lunatic-radio-group.js +4 -2
- package/lib/components/roundabout/components/roundabout-it-title.js +0 -2
- package/lib/components/roundabout/components/roundabout-label.js +0 -2
- package/lib/components/roundabout/lunatic-roundabout.js +1 -4
- package/lib/components/roundabout/roundabout.js +0 -1
- package/lib/components/suggester/html/notification.js +0 -1
- package/lib/components/suggester/html/suggester.js +3 -3
- package/lib/components/suggester/idb-suggester/check-store.js +3 -5
- package/lib/components/suggester/idb-suggester/idb-suggester.js +4 -5
- package/lib/components/suggester/idb-suggester/suggester-notification.js +2 -2
- package/lib/components/suggester/lunatic-suggester.js +3 -1
- package/lib/components/suggester-loader-widget/loader-row.js +1 -4
- package/lib/components/suggester-loader-widget/loader.js +1 -3
- package/lib/components/summary/html/summary-responses.js +13 -7
- package/lib/components/summary/lunatic-summary.js +8 -4
- package/lib/components/switch/html/switch.js +0 -1
- package/lib/components/table/cell.js +0 -2
- package/lib/components/table/header.js +0 -2
- package/lib/components/table/row.js +0 -1
- package/lib/components/textarea/html/__snapshots__/textarea.spec.tsx.snap +30 -0
- package/lib/components/textarea/html/textarea.js +5 -6
- package/lib/components/textarea/html/textarea.spec.js +38 -0
- package/lib/components/textarea/lunatic-textarea.js +4 -2
- package/lib/index.js +8 -0
- package/lib/src/components/button/lunatic-button.d.ts +5 -3
- package/lib/src/components/checkbox/checkbox-boolean/html/checkbox-boolean.d.ts +2 -2
- package/lib/src/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.d.ts +1 -1
- package/lib/src/components/checkbox/checkbox-group/checkbox-group-content.d.ts +1 -1
- package/lib/src/components/checkbox/checkbox-group/html/checkbox-group-content.d.ts +1 -1
- package/lib/src/components/checkbox/checkbox-group/html/checkbox-group.d.ts +4 -4
- package/lib/src/components/checkbox/checkbox-group/lunatic-checkbox-group.d.ts +2 -2
- package/lib/src/components/checkbox/checkbox-one/html/checkbox-one.d.ts +1 -1
- package/lib/src/components/checkbox/checkbox-one/lunatic-checkbox-one.d.ts +1 -1
- package/lib/src/components/checkbox/commons/checkbox-option.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/combo-box-container.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/combo-box-content-box.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/combo-box-content.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +6 -5
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +30 -2
- package/lib/src/components/commons/components/combo-box/combo-box.type.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/panel/combo-box-option.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/panel/panel-container.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/panel/panel.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/selection/LabelOrInput.d.ts +3 -2
- package/lib/src/components/commons/components/combo-box/selection/combo-box-label-selection.d.ts +2 -1
- package/lib/src/components/commons/components/combo-box/selection/input.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/selection/label-selection.d.ts +4 -3
- package/lib/src/components/commons/components/combo-box/selection/selection-container.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/selection/selection.d.ts +3 -2
- package/lib/src/components/commons/components/description.d.ts +1 -1
- package/lib/src/components/commons/components/dragger/dragger.d.ts +1 -1
- package/lib/src/components/commons/components/errors/errors.d.ts +1 -1
- package/lib/src/components/commons/components/fab/fab.d.ts +1 -1
- package/lib/src/components/commons/components/field-container/field-container.d.ts +1 -1
- package/lib/src/components/commons/components/fieldset.d.ts +3 -3
- package/lib/src/components/commons/components/html-table/table.d.ts +1 -1
- package/lib/src/components/commons/components/html-table/thead.d.ts +1 -1
- package/lib/src/components/commons/components/label/label.d.ts +1 -1
- package/lib/src/components/commons/components/lunatic-component-with-label.d.ts +2 -2
- package/lib/src/components/commons/components/lunatic-component-without-label.d.ts +2 -2
- package/lib/src/components/commons/components/md-label/link.d.ts +1 -1
- package/lib/src/components/commons/components/md-label/md-label.spec.d.ts +1 -0
- package/lib/src/components/commons/components/missing/missing.d.ts +1 -1
- package/lib/src/components/commons/components/orchestrated-component.d.ts +2 -2
- package/lib/src/components/commons/components/variable-status/variable-status.d.ts +1 -1
- package/lib/src/components/commons/create-customizable-field.d.ts +1 -1
- package/lib/src/components/commons/icons/checkbox-checked-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/checkbox-unchecked-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/closed-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/cross-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/load-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/lunatic-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/network-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/on-drag-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/opened-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/radio-checked-icon.d.ts +1 -1
- package/lib/src/components/commons/icons/radio-unchecked-icon.d.ts +1 -1
- package/lib/src/components/commons/index.d.ts +0 -1
- package/lib/src/components/commons/safety-label.d.ts +1 -1
- package/lib/src/components/component-set/html/component-set-legend.d.ts +8 -0
- package/lib/src/components/component-set/html/component-set-wrapper.d.ts +6 -0
- package/lib/src/components/component-set/html/component-set.d.ts +5 -4
- package/lib/src/components/component-set/html/component-set.spec.d.ts +1 -0
- package/lib/src/components/component-set/lunatic-component-set.d.ts +3 -4
- package/lib/src/components/datepicker/html/datepicker-container.d.ts +1 -1
- package/lib/src/components/datepicker/html/datepicker-input.d.ts +1 -1
- package/lib/src/components/datepicker/html/datepicker.d.ts +3 -3
- package/lib/src/components/datepicker/html/datepicker.spec.d.ts +1 -0
- package/lib/src/components/datepicker/lunatic-datepicker.d.ts +2 -2
- package/lib/src/components/declarations/declaration.d.ts +1 -1
- package/lib/src/components/declarations/declarations-after-text.d.ts +1 -1
- package/lib/src/components/declarations/declarations-before-text.d.ts +1 -1
- package/lib/src/components/declarations/declarations-detachable.d.ts +1 -1
- package/lib/src/components/declarations/declarations.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown-simple/dropdown-simple.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-simple/simple-label-renderer.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown-simple/simple-option-renderer.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +5 -4
- package/lib/src/components/dropdown/html/dropdown-writable/writable-label-renderer.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown-writable/writable-option-renderer.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown.d.ts +4 -3
- package/lib/src/components/dropdown/html/dropdown.spec.d.ts +1 -0
- package/lib/src/components/dropdown/lunatic-dropdown.d.ts +2 -2
- package/lib/src/components/duration/duration.d.ts +1 -1
- package/lib/src/components/duration/durationInput.d.ts +1 -1
- package/lib/src/components/duration/formatDuration.d.ts +1 -1
- package/lib/src/components/duration/getDurationFromValue.d.ts +1 -1
- package/lib/src/components/duration/index.d.ts +1 -1
- package/lib/src/components/filter-description/component.d.ts +2 -2
- package/lib/src/components/index.d.ts +4 -4
- package/lib/src/components/input/html/input.d.ts +4 -3
- package/lib/src/components/input/html/input.spec.d.ts +1 -0
- package/lib/src/components/input/lunatic-input.d.ts +1 -1
- package/lib/src/components/input-number/html/input-number-thousand.d.ts +2 -1
- package/lib/src/components/input-number/html/input-number.d.ts +3 -2
- package/lib/src/components/input-number/lunatic-input-number.d.ts +1 -1
- package/lib/src/components/loop/{block-for-loop/block-for-loop.d.ts → block-for-loop.d.ts} +6 -4
- package/lib/src/components/loop/loop-button.d.ts +7 -0
- package/lib/src/components/loop/loop-header.d.ts +9 -0
- package/lib/src/components/loop/loop.d.ts +2 -3
- package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +7 -5
- package/lib/src/components/loop/utils/get-initial-nb-rows.d.ts +4 -0
- package/lib/src/components/lunatic-components.d.ts +13 -0
- package/lib/src/components/modal/html/modal.d.ts +10 -13
- package/lib/src/components/modal/lunatic-modal.d.ts +2 -2
- package/lib/src/components/modal-controls/close-or-skip.d.ts +1 -1
- package/lib/src/components/modal-controls/modal-container.d.ts +1 -1
- package/lib/src/components/modal-controls/modal-controls.d.ts +2 -2
- package/lib/src/components/pairwise-links/orchestrator.d.ts +1 -1
- package/lib/src/components/pairwise-links/pairwise-links.d.ts +1 -1
- package/lib/src/components/pairwise-links/row.d.ts +1 -1
- package/lib/src/components/question-explication/html/question-explication.d.ts +1 -1
- package/lib/src/components/question-explication/lunatic-question-explication.d.ts +1 -1
- package/lib/src/components/radio/html/radio-group-content.d.ts +3 -2
- package/lib/src/components/radio/html/radio-group.d.ts +3 -2
- package/lib/src/components/radio/html/radio-option.d.ts +3 -2
- package/lib/src/components/roundabout/components/roundabout-it-title.d.ts +3 -3
- package/lib/src/components/roundabout/components/roundabout-label.d.ts +3 -3
- package/lib/src/components/roundabout/lunatic-roundabout.d.ts +1 -1
- package/lib/src/components/roundabout/roundabout.d.ts +2 -2
- package/lib/src/components/sequence/html/sequence.d.ts +1 -1
- package/lib/src/components/sequence/lunatic-sequence.d.ts +2 -2
- package/lib/src/components/suggester/html/notification.d.ts +2 -2
- package/lib/src/components/suggester/html/suggester.d.ts +6 -5
- package/lib/src/components/suggester/idb-suggester/check-store.d.ts +1 -1
- package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +3 -3
- package/lib/src/components/suggester/idb-suggester/suggester-notification.d.ts +1 -1
- package/lib/src/components/suggester/idb-suggester/suggester-status.d.ts +1 -1
- package/lib/src/components/suggester/lunatic-suggester.d.ts +2 -2
- package/lib/src/components/suggester/searching/create-searching.d.ts +1 -1
- package/lib/src/components/suggester-loader-widget/loader-row.d.ts +1 -1
- package/lib/src/components/suggester-loader-widget/loader.d.ts +1 -1
- package/lib/src/components/suggester-loader-widget/tools/action-tool.d.ts +1 -1
- package/lib/src/components/suggester-loader-widget/tools/tools.d.ts +1 -1
- package/lib/src/components/suggester-loader-widget/widget.d.ts +1 -1
- package/lib/src/components/summary/html/summary-container.d.ts +1 -1
- package/lib/src/components/summary/html/summary-responses.d.ts +3 -1
- package/lib/src/components/summary/html/summary-title.d.ts +1 -1
- package/lib/src/components/summary/lunatic-summary.d.ts +3 -2
- package/lib/src/components/switch/html/switch.d.ts +3 -3
- package/lib/src/components/switch/lunatic-switch.d.ts +1 -1
- package/lib/src/components/table/cell.d.ts +1 -1
- package/lib/src/components/table/header.d.ts +1 -1
- package/lib/src/components/table/lunatic-table.d.ts +1 -1
- package/lib/src/components/table/row.d.ts +1 -1
- package/lib/src/components/table/table-orchestrator.d.ts +1 -1
- package/lib/src/components/textarea/html/textarea.d.ts +4 -3
- package/lib/src/components/textarea/html/textarea.spec.d.ts +1 -0
- package/lib/src/components/textarea/lunatic-textarea.d.ts +1 -1
- package/lib/src/components/type.d.ts +9 -6
- package/lib/src/i18n/build-dictionary.d.ts +1 -1
- package/lib/src/index.d.ts +1 -0
- package/lib/src/use-lunatic/actions.d.ts +4 -8
- package/lib/src/use-lunatic/commons/calculated-variables.d.ts +1 -1
- package/lib/src/use-lunatic/commons/check-loops.d.ts +1 -1
- package/lib/src/use-lunatic/commons/check-pager.d.ts +1 -1
- package/lib/src/use-lunatic/commons/compile-controls.d.ts +1 -1
- package/lib/src/use-lunatic/commons/compose.d.ts +1 -1
- package/lib/src/use-lunatic/commons/create-map-pages.d.ts +2 -2
- package/lib/src/use-lunatic/commons/execute-condition-filter.d.ts +1 -1
- package/lib/src/use-lunatic/commons/execute-expression/create-execute-expression.d.ts +1 -1
- package/lib/src/use-lunatic/commons/execute-expression/create-refresh-calculated.d.ts +2 -2
- package/lib/src/use-lunatic/commons/execute-expression/execute-expression.d.ts +3 -3
- package/lib/src/use-lunatic/commons/execute-expression/get-safety-expression.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +5 -2
- package/lib/src/use-lunatic/commons/fill-components/fill-component-value.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-components.d.ts +15 -10
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +38 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-management.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-missing-response.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-pagination.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +62 -33
- package/lib/src/use-lunatic/commons/get-compatible-vtl-expression.d.ts +1 -1
- package/lib/src/use-lunatic/commons/get-component-value/get-component-value.d.ts +1 -1
- package/lib/src/use-lunatic/commons/get-components-from-state.d.ts +1 -2
- package/lib/src/use-lunatic/commons/get-data.d.ts +1 -1
- package/lib/src/use-lunatic/commons/get-errors-without-empty-value.d.ts +1 -1
- package/lib/src/use-lunatic/commons/getOverview.d.ts +1 -1
- package/lib/src/use-lunatic/commons/is-First-last-page.d.ts +1 -1
- package/lib/src/use-lunatic/commons/is-paginated-loop.d.ts +1 -1
- package/lib/src/use-lunatic/commons/is-roundabout.d.ts +1 -1
- package/lib/src/use-lunatic/commons/page-navigation.d.ts +2 -2
- package/lib/src/use-lunatic/commons/page-tag.d.ts +1 -1
- package/lib/src/use-lunatic/commons/page.d.ts +2 -2
- package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +2 -2
- package/lib/src/use-lunatic/hooks/use-loop-variables.d.ts +1 -1
- package/lib/src/use-lunatic/lunatic-context.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/commons/auto-explore-loop.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +3 -3
- package/lib/src/use-lunatic/reducer/commons/validate-condition-filter.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/overview/overview-on-change.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-go-next-page.d.ts +2 -4
- package/lib/src/use-lunatic/reducer/reduce-go-next-page.spec.d.ts +1 -0
- package/lib/src/use-lunatic/reducer/reduce-go-previous-page.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/reduce-go-previous-page.spec.d.ts +1 -0
- package/lib/src/use-lunatic/reducer/reduce-go-to-page.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-missing.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-resizing.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/reduce-on-init.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-on-set-waiting.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reduce-update-state.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/reducer.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/resolve-component-controls/resolve-component-control.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.d.ts +2 -2
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -1
- package/lib/src/use-lunatic/type-source.d.ts +3 -1
- package/lib/src/use-lunatic/type.d.ts +3 -3
- package/lib/src/use-lunatic/use-lunatic.d.ts +21 -15
- package/lib/src/use-lunatic/use-suggesters.d.ts +1 -1
- package/lib/src/utils/array.d.ts +8 -0
- package/lib/src/utils/dom.d.ts +14 -0
- package/lib/src/utils/get-component-value.d.ts +1 -1
- package/lib/src/utils/get-component-value.test.d.ts +1 -0
- package/lib/src/utils/is-element.d.ts +1 -1
- package/lib/src/utils/number.d.ts +5 -0
- package/lib/src/utils/number.spec.d.ts +1 -0
- package/lib/src/utils/store-tools/initStore.d.ts +1 -1
- package/lib/src/utils/suggester-workers/append-to-index/create-append-task.d.ts +1 -1
- package/lib/src/utils/suggester-workers/searching/compute-score.d.ts +1 -1
- package/lib/stories/checkbox-one/source.json +2 -2
- package/lib/stories/component-set/component-set.stories.js +9 -9
- package/lib/stories/component-set/{data2.json → data-roundabout.json} +1 -1
- package/lib/stories/component-set/data.json +8 -1
- package/lib/stories/component-set/source-loop.json +308 -0
- package/lib/stories/component-set/source-roundabout.json +434 -0
- package/lib/stories/component-set/source.json +16 -2
- package/lib/stories/disabled/data.json +32 -0
- package/lib/{components/commons/components/combo-box/state-management/reduce-on-keydown/on-end.js → stories/disabled/disabled.stories.js} +25 -12
- package/lib/stories/disabled/source.json +382 -0
- package/lib/stories/input/source-with-question.json +9 -3
- package/lib/stories/input/source.json +6 -0
- package/lib/stories/loop/source-paginated.json +2 -2
- package/lib/stories/overview/source.json +1 -1
- package/lib/stories/overview/sourceWithHierarchy.json +10 -2
- package/lib/stories/pairwise/links-componentset.json +292 -0
- package/lib/stories/pairwise/pairwise-links.stories.js +11 -2
- package/lib/stories/question-explication/source.json +16 -16
- package/lib/stories/questionnaires/logement/source-sum.json +31805 -34611
- package/lib/stories/questionnaires/recensement/source.json +2 -2
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +4 -4
- package/lib/stories/questionnaires-test/V2_DeclarationsSimples.json +963 -847
- package/lib/stories/questionnaires-test/V2_QuestSimple_Boucles.json +4350 -4090
- package/lib/stories/suggester/simple.json +4 -0
- package/lib/stories/summary/source.json +55 -40
- package/lib/stories/utils/orchestrator.js +11 -22
- package/lib/tests/utils/lunatic.d.ts +16 -2
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +13 -45
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +5 -1
- package/lib/use-lunatic/commons/fill-components/fill-components.js +10 -2
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +3 -0
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +66 -21
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +1 -3
- package/lib/use-lunatic/commons/page.js +6 -0
- package/lib/use-lunatic/hooks/use-loop-variables.js +1 -1
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +10 -10
- package/lib/use-lunatic/reducer/reduce-go-next-page.spec.js +13 -0
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +3 -3
- package/lib/use-lunatic/reducer/reduce-go-previous-page.spec.js +14 -0
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +3 -8
- package/lib/use-lunatic/reducer/reduce-handle-change/__mocks__/source-cleaning-loop.json +790 -924
- package/lib/use-lunatic/reducer/reducer.js +2 -2
- package/lib/use-lunatic/use-lunatic.js +5 -2
- package/lib/use-lunatic/use-lunatic.test.js +26 -0
- package/lib/utils/array.js +33 -0
- package/lib/utils/dom.js +27 -0
- package/lib/utils/get-component-value.js +13 -11
- package/lib/utils/get-component-value.test.js +57 -0
- package/lib/utils/number.js +30 -0
- package/lib/utils/number.spec.js +11 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +0 -2
- package/package.json +9 -3
- package/lib/components/commons/components/combo-box/state-management/actions.js +0 -79
- package/lib/components/commons/components/combo-box/state-management/index.js +0 -25
- package/lib/components/commons/components/combo-box/state-management/reduce-on-init.js +0 -38
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/on-arrow-down.js +0 -30
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/on-arrow-up.js +0 -30
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/on-enter.js +0 -19
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/on-escape.js +0 -18
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/on-home.js +0 -23
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/on-tab.js +0 -18
- package/lib/components/commons/components/combo-box/state-management/reduce-on-keydown/reduce-on-keydown.js +0 -40
- package/lib/components/commons/components/combo-box/state-management/reducer.js +0 -53
- package/lib/components/commons/create-row-orchestrator.js +0 -58
- package/lib/components/component-set/html/component-set-component-container.js +0 -20
- package/lib/components/component-set/html/component-set-components.js +0 -45
- package/lib/components/component-set/html/legend/index.js +0 -13
- package/lib/components/component-set/index.js +0 -13
- package/lib/components/loop/block-for-loop/block-for-loop-ochestrator.js +0 -12
- package/lib/components/loop/block-for-loop/index.js +0 -13
- package/lib/components/loop/block-for-loop/row.js +0 -56
- package/lib/components/loop/commons/index.js +0 -20
- package/lib/components/loop/commons/row-component.js +0 -72
- package/lib/components/loop/index.js +0 -13
- package/lib/components/loop/roster-for-loop/index.js +0 -13
- package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +0 -12
- package/lib/components/loop/roster-for-loop/roster-table.js +0 -50
- package/lib/components/loop/roster-for-loop/row.js +0 -85
- package/lib/src/components/commons/components/combo-box/state-management/actions.d.ts +0 -78
- package/lib/src/components/commons/components/combo-box/state-management/index.d.ts +0 -9
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-init.d.ts +0 -4
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-arrow-down.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-arrow-up.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-end.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-enter.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-escape.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-home.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/on-tab.d.ts +0 -2
- package/lib/src/components/commons/components/combo-box/state-management/reduce-on-keydown/reduce-on-keydown.d.ts +0 -9
- package/lib/src/components/commons/components/combo-box/state-management/reducer.d.ts +0 -3
- package/lib/src/components/commons/create-row-orchestrator.d.ts +0 -32
- package/lib/src/components/component-set/html/component-set-component-container.d.ts +0 -6
- package/lib/src/components/component-set/html/component-set-components.d.ts +0 -7
- package/lib/src/components/component-set/html/legend/index.d.ts +0 -1
- package/lib/src/components/component-set/html/legend/legend.d.ts +0 -8
- package/lib/src/components/component-set/index.d.ts +0 -1
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +0 -51
- package/lib/src/components/loop/block-for-loop/index.d.ts +0 -1
- package/lib/src/components/loop/block-for-loop/row.d.ts +0 -23
- package/lib/src/components/loop/commons/get-init-length.d.ts +0 -2
- package/lib/src/components/loop/commons/handle-row-button.d.ts +0 -7
- package/lib/src/components/loop/commons/index.d.ts +0 -2
- package/lib/src/components/loop/commons/row-component.d.ts +0 -9
- package/lib/src/components/loop/index.d.ts +0 -1
- package/lib/src/components/loop/roster-for-loop/body.d.ts +0 -12
- package/lib/src/components/loop/roster-for-loop/header.d.ts +0 -9
- package/lib/src/components/loop/roster-for-loop/index.d.ts +0 -1
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +0 -51
- package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +0 -13
- package/lib/src/components/loop/roster-for-loop/row.d.ts +0 -24
- package/lib/stories/component-set/source1.json +0 -287
- package/lib/stories/component-set/source2.json +0 -413
- /package/lib/components/commons/components/combo-box/{state-management/reduce-on-keydown/keyboard-key-codes.js → keyboard-key-codes.js} +0 -0
- /package/lib/src/components/commons/components/combo-box/{state-management/reduce-on-keydown/keyboard-key-codes.d.ts → keyboard-key-codes.d.ts} +0 -0
- /package/lib/stories/component-set/{data1.json → data-loop.json} +0 -0
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
27
27
|
"response": { "name": "NB_HAB" }
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
{
|
|
30
30
|
"id": "hoew",
|
|
31
31
|
"componentType": "InputNumber",
|
|
32
32
|
"mandatory": false,
|
|
@@ -216,44 +216,59 @@
|
|
|
216
216
|
"value": "\"## Vos réponses.\"",
|
|
217
217
|
"type": "VTL|MD"
|
|
218
218
|
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
219
|
+
"sections": [
|
|
220
|
+
{
|
|
221
|
+
"id": "summary-section-0",
|
|
222
|
+
"iterations": { "value": "NB_HAB", "type": "VTL" },
|
|
223
|
+
"title": {
|
|
224
|
+
"value": "\"### Le bulletin individuel de \" || PRENOMS",
|
|
225
|
+
"type": "VTL|MD"
|
|
226
|
+
},
|
|
227
|
+
"responses": [
|
|
228
|
+
{
|
|
229
|
+
"id": "summary-section-0-response-0",
|
|
230
|
+
"label": { "value": "\"L'age de \" || PRENOMS", "type": "VTL" },
|
|
231
|
+
"value": {
|
|
232
|
+
"value": "cast(AGE,string) || \" ans\"",
|
|
233
|
+
"type": "VTL"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"id": "summary-section-0-response-1",
|
|
238
|
+
"label": { "value": "\"Le sexe de \" || PRENOMS", "type": "VTL" },
|
|
239
|
+
"value": {
|
|
240
|
+
"value": "if(SEXE = \"1\") then \"Masculin\" else \"Féminin\"",
|
|
241
|
+
"type": "VTL"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"id": "summary-section-1",
|
|
248
|
+
"title": {
|
|
249
|
+
"value": "\"### La feuille logement\"",
|
|
250
|
+
"type": "VTL|MD"
|
|
251
|
+
},
|
|
252
|
+
"responses": [
|
|
253
|
+
{
|
|
254
|
+
"id": "summary-section-1-response-0",
|
|
255
|
+
"label": { "value": "\"Zéro divisé par zéro \"", "type": "VTL" },
|
|
256
|
+
"value": {
|
|
257
|
+
"value": "cast(ZERO,string) || \", mais ça tu savais déjà !\"",
|
|
258
|
+
"type": "VTL"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"id": "summary-section-1-response-1",
|
|
263
|
+
"label": { "value": "\"Nombre d'habitants \"", "type": "VTL" },
|
|
264
|
+
"value": {
|
|
265
|
+
"value": "cast(NB_HAB,string) || \" personnes\"",
|
|
266
|
+
"type": "VTL"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
],
|
|
257
272
|
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
258
273
|
"page": "5"
|
|
259
274
|
}
|
|
@@ -270,7 +285,7 @@
|
|
|
270
285
|
"INPUTED": null
|
|
271
286
|
}
|
|
272
287
|
},
|
|
273
|
-
|
|
288
|
+
{
|
|
274
289
|
"variableType": "COLLECTED",
|
|
275
290
|
"name": "ZERO",
|
|
276
291
|
"values": {
|
|
@@ -13,8 +13,7 @@ var _logger = require("../../utils/logger");
|
|
|
13
13
|
var _overview = require("./overview");
|
|
14
14
|
var _waiting = _interopRequireDefault(require("./waiting"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
var _excluded = ["source", "data", "management", "shortcut", "activeControls", "features", "initialPage", "getStoreInfo", "missing", "missingStrategy", "missingShortcut", "autoSuggesterLoading", "addExternal", "preferences", "custom", "showOverview", "filterDescription", "getReferentiel", "dontKnowButton", "refusedButton", "readOnly"]
|
|
17
|
-
_excluded2 = ["id", "componentType", "response", "storeName", "conditionFilter"];
|
|
16
|
+
var _excluded = ["source", "data", "management", "shortcut", "activeControls", "features", "initialPage", "getStoreInfo", "missing", "missingStrategy", "missingShortcut", "autoSuggesterLoading", "addExternal", "preferences", "custom", "showOverview", "filterDescription", "getReferentiel", "dontKnowButton", "refusedButton", "readOnly"];
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
18
|
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); }
|
|
20
19
|
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; }
|
|
@@ -51,7 +50,7 @@ function DevOptions(_ref) {
|
|
|
51
50
|
className: "title",
|
|
52
51
|
children: "Options d\xE9veloppeur"
|
|
53
52
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
54
|
-
className: "
|
|
53
|
+
className: "conteneur",
|
|
55
54
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.Button, {
|
|
56
55
|
onClick: function onClick() {
|
|
57
56
|
return _logger.Logger.log(getData(true));
|
|
@@ -77,7 +76,7 @@ function DevOptions(_ref) {
|
|
|
77
76
|
handleChange: handleChange,
|
|
78
77
|
min: 1,
|
|
79
78
|
label: 'Page',
|
|
80
|
-
description: 'the page
|
|
79
|
+
description: 'the page where you want to jump'
|
|
81
80
|
})]
|
|
82
81
|
})]
|
|
83
82
|
});
|
|
@@ -225,27 +224,17 @@ function OrchestratorForStories(_ref3) {
|
|
|
225
224
|
className: "container",
|
|
226
225
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
227
226
|
className: "components",
|
|
228
|
-
children:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
storeName =
|
|
233
|
-
|
|
234
|
-
other = _objectWithoutProperties(component, _excluded2);
|
|
235
|
-
var Component = lunatic[componentType];
|
|
236
|
-
var storeInfo = storeName ? getStoreInfo(storeName) : {};
|
|
237
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
238
|
-
className: "lunatic lunatic-component",
|
|
239
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
240
|
-
id: id,
|
|
241
|
-
response: response
|
|
242
|
-
}, other), rest), component), storeInfo), {}, {
|
|
243
|
-
// fill error when needed
|
|
227
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.LunaticComponents, {
|
|
228
|
+
autoFocusKey: pageTag,
|
|
229
|
+
components: components,
|
|
230
|
+
componentProps: function componentProps(_ref4) {
|
|
231
|
+
var storeName = _ref4.storeName;
|
|
232
|
+
return _objectSpread({
|
|
244
233
|
errors: errorActive[pageTag],
|
|
245
234
|
filterDescription: filterDescription,
|
|
246
235
|
disabled: readOnly
|
|
247
|
-
}))
|
|
248
|
-
}
|
|
236
|
+
}, storeName ? getStoreInfo(storeName) : {});
|
|
237
|
+
}
|
|
249
238
|
})
|
|
250
239
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Pager, {
|
|
251
240
|
goPrevious: goPreviousPage,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LunaticSource } from '../../src/use-lunatic/type-source';
|
|
1
|
+
import type { LunaticSource } from '../../src/use-lunatic/type-source';
|
|
2
2
|
import type { LunaticData, LunaticState } from '../../src/use-lunatic/type';
|
|
3
|
-
import { ActionInit } from '../../src/use-lunatic/actions';
|
|
3
|
+
import { type ActionInit } from '../../src/use-lunatic/actions';
|
|
4
4
|
/**
|
|
5
5
|
* Generate a base state from a source / data for unit testing reducer
|
|
6
6
|
*/
|
|
@@ -9,3 +9,17 @@ export declare function generateState(source: LunaticSource, data?: Record<strin
|
|
|
9
9
|
* Generate LunaticData from a record of values
|
|
10
10
|
*/
|
|
11
11
|
export declare function generateData<T extends Record<string, unknown>>(data: T): LunaticData;
|
|
12
|
+
export declare function generateVariable({ type, name }: {
|
|
13
|
+
type?: string | undefined;
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
}): {
|
|
16
|
+
variableType: string;
|
|
17
|
+
name: string;
|
|
18
|
+
values: {
|
|
19
|
+
PREVIOUS: null;
|
|
20
|
+
COLLECTED: null;
|
|
21
|
+
FORCED: null;
|
|
22
|
+
EDITED: null;
|
|
23
|
+
INPUTED: null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -101,41 +101,6 @@ function createExecuteExpression(variables, features) {
|
|
|
101
101
|
pushToLazy(name);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* Update the binding for a loop
|
|
106
|
-
*/
|
|
107
|
-
function setLoopBindings(variables, iteration) {
|
|
108
|
-
Object.entries(bindings).forEach(function (_ref3) {
|
|
109
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
110
|
-
k = _ref4[0],
|
|
111
|
-
v = _ref4[1];
|
|
112
|
-
var _variables$k = variables[k],
|
|
113
|
-
type = _variables$k.type,
|
|
114
|
-
value = _variables$k.value;
|
|
115
|
-
if (!Array.isArray(v) && type === _constants.COLLECTED && Array.isArray(value)) {
|
|
116
|
-
bindings[k] = value[iteration];
|
|
117
|
-
pushToLazy(k);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Reset the values in a loop
|
|
124
|
-
*/
|
|
125
|
-
function resetLoopBindings(variables) {
|
|
126
|
-
Object.entries(bindings).forEach(function (_ref5) {
|
|
127
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
128
|
-
k = _ref6[0],
|
|
129
|
-
v = _ref6[1];
|
|
130
|
-
var _variables$k2 = variables[k],
|
|
131
|
-
type = _variables$k2.type,
|
|
132
|
-
value = _variables$k2.value;
|
|
133
|
-
if (type === _constants.COLLECTED && Array.isArray(value) && !Array.isArray(v)) {
|
|
134
|
-
bindings[k] = value;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
104
|
/**
|
|
140
105
|
* Extract variables from an expression
|
|
141
106
|
*/
|
|
@@ -177,9 +142,9 @@ function createExecuteExpression(variables, features) {
|
|
|
177
142
|
}
|
|
178
143
|
return {};
|
|
179
144
|
}
|
|
180
|
-
function resolveUseContext(name,
|
|
181
|
-
var iteration =
|
|
182
|
-
linksIterations =
|
|
145
|
+
function resolveUseContext(name, _ref3) {
|
|
146
|
+
var iteration = _ref3.iteration,
|
|
147
|
+
linksIterations = _ref3.linksIterations;
|
|
183
148
|
var value = bindings[name];
|
|
184
149
|
if ([_constants.X_AXIS, _constants.Y_AXIS].includes(name) && linksIterations !== undefined) {
|
|
185
150
|
pushToLazy(name);
|
|
@@ -212,13 +177,13 @@ function createExecuteExpression(variables, features) {
|
|
|
212
177
|
}
|
|
213
178
|
return (0, _vtl["default"])(value);
|
|
214
179
|
}
|
|
215
|
-
function fillVariablesValues(map,
|
|
216
|
-
var iteration =
|
|
217
|
-
linksIterations =
|
|
218
|
-
return Object.entries(map).reduce(function (sub,
|
|
219
|
-
var
|
|
220
|
-
name =
|
|
221
|
-
_ =
|
|
180
|
+
function fillVariablesValues(map, _ref4) {
|
|
181
|
+
var iteration = _ref4.iteration,
|
|
182
|
+
linksIterations = _ref4.linksIterations;
|
|
183
|
+
return Object.entries(map).reduce(function (sub, _ref5) {
|
|
184
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
185
|
+
name = _ref6[0],
|
|
186
|
+
_ = _ref6[1];
|
|
222
187
|
return _objectSpread(_objectSpread({}, sub), {}, _defineProperty({}, name, resolveUseContext(name, {
|
|
223
188
|
iteration: iteration,
|
|
224
189
|
linksIterations: linksIterations
|
|
@@ -226,6 +191,7 @@ function createExecuteExpression(variables, features) {
|
|
|
226
191
|
}, {});
|
|
227
192
|
}
|
|
228
193
|
function execute(expObject) {
|
|
194
|
+
var _args$iteration;
|
|
229
195
|
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
230
196
|
var _validateExpression = validateExpression((0, _getSafetyExpression["default"])(expObject)),
|
|
231
197
|
expression = _validateExpression.value,
|
|
@@ -250,6 +216,8 @@ function createExecuteExpression(variables, features) {
|
|
|
250
216
|
iteration: iteration,
|
|
251
217
|
linksIterations: linksIterations
|
|
252
218
|
});
|
|
219
|
+
// Add index has a specific variable
|
|
220
|
+
vtlBindings['GLOBAL_ITERATION_INDEX'] = (((_args$iteration = args === null || args === void 0 ? void 0 : args.iteration) !== null && _args$iteration !== void 0 ? _args$iteration : 0) + 1).toString();
|
|
253
221
|
var memoized = getMemoizedValue(expression, vtlBindings);
|
|
254
222
|
if (memoized === undefined) {
|
|
255
223
|
var result = (0, _executeExpression["default"])(vtlBindings, expression, type, features, logging || loggingDefault);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
exports.executeVtlExpression = executeVtlExpression;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _trevas = require("@inseefr/trevas");
|
|
10
9
|
var _mdLabel = _interopRequireDefault(require("../../../components/commons/components/md-label"));
|
|
11
10
|
var _vtl = _interopRequireDefault(require("../../../utils/vtl"));
|
|
@@ -24,7 +24,7 @@ var VTL_ATTRIBUTES = ['label', 'options.label', 'responses.label', 'hierarchy.la
|
|
|
24
24
|
// Disable controls compilation
|
|
25
25
|
// 'controls.control',
|
|
26
26
|
// 'controls.errorMessage',
|
|
27
|
-
'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'headers.label', 'header.label'];
|
|
27
|
+
'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'headers.label', 'header.label', 'disabled', 'readOnly'];
|
|
28
28
|
|
|
29
29
|
// Utility type to replace all expression from an object into a translated version
|
|
30
30
|
|
|
@@ -99,6 +99,10 @@ function fillAttributes(component, _ref2) {
|
|
|
99
99
|
return _objectSpread(_objectSpread({}, step), crawl(path, step));
|
|
100
100
|
}, _objectSpread({}, component));
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Fill props interpreting VTL expression
|
|
105
|
+
*/
|
|
102
106
|
function fillComponentExpressions(component, state) {
|
|
103
107
|
var pager = state.pager,
|
|
104
108
|
executeExpression = state.executeExpression;
|
|
@@ -35,11 +35,19 @@ function compose() {
|
|
|
35
35
|
*
|
|
36
36
|
* Force typing for this function since it's doo dynamic
|
|
37
37
|
*/
|
|
38
|
-
var fillComponent = compose(_fillFromState["default"], _fillComponentExpressions["default"],
|
|
38
|
+
var fillComponent = compose(_fillFromState["default"], _fillComponentExpressions["default"], _fillPagination["default"], _fillComponentValue["default"], _fillMissingResponse["default"], _fillManagement["default"], _fillSpecificExpression["default"]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Fill components with values coming from the state, and interpret VTL expression
|
|
42
|
+
*/
|
|
39
43
|
function fillComponents(components, state) {
|
|
40
44
|
return components.map(function (component) {
|
|
41
45
|
return fillComponent(component, state);
|
|
42
|
-
});
|
|
46
|
+
}).filter(matchConditionFilter);
|
|
47
|
+
}
|
|
48
|
+
function matchConditionFilter(_ref) {
|
|
49
|
+
var conditionFilter = _ref.conditionFilter;
|
|
50
|
+
return conditionFilter !== undefined ? conditionFilter : true;
|
|
43
51
|
}
|
|
44
52
|
var _default = fillComponents;
|
|
45
53
|
exports["default"] = _default;
|
|
@@ -10,6 +10,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
11
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
12
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
/**
|
|
14
|
+
* Add state data as component props
|
|
15
|
+
*/
|
|
13
16
|
function fillFromState(component, state) {
|
|
14
17
|
var handleChange = state.handleChange,
|
|
15
18
|
executeExpression = state.executeExpression,
|
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
+
var _fillComponents = _interopRequireDefault(require("./fill-components"));
|
|
9
|
+
var _array = require("../../../utils/array");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
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; }
|
|
@@ -16,31 +19,73 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
20
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Fill props for roundabout
|
|
24
|
+
* - expressions, VTL that states the level of completion for each iteration
|
|
25
|
+
*/
|
|
26
|
+
function fillRoundaboutProps(component, state) {
|
|
27
|
+
var iterations = component.iterations,
|
|
28
|
+
expressions = component.expressions;
|
|
29
|
+
var compiled = Object.entries(expressions).reduce(function (result, _ref) {
|
|
30
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
31
|
+
name = _ref2[0],
|
|
32
|
+
expression = _ref2[1];
|
|
33
|
+
var values = new Array(iterations).fill(null).map(function (_, iteration) {
|
|
34
|
+
return state.executeExpression(expression, {
|
|
35
|
+
iteration: iteration
|
|
33
36
|
});
|
|
34
|
-
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, name, values));
|
|
35
|
-
}, {});
|
|
36
|
-
return _objectSpread(_objectSpread({}, component), {}, {
|
|
37
|
-
expressions: compiled
|
|
38
37
|
});
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, name, values));
|
|
39
|
+
}, {});
|
|
40
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
41
|
+
expressions: compiled
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Fill child components for nested component type
|
|
47
|
+
*/
|
|
48
|
+
function fillChildComponents(component, state) {
|
|
49
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
50
|
+
components: (0, _fillComponents["default"])(component.components, state)
|
|
51
|
+
});
|
|
41
52
|
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* For loops, inject a method to retrieve component at a specific iteration
|
|
56
|
+
*/
|
|
57
|
+
function fillChildComponentsWithIteration(component, state) {
|
|
58
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
59
|
+
getComponents: function getComponents(iteration) {
|
|
60
|
+
return (0, _fillComponents["default"])(component.components, _objectSpread(_objectSpread({}, state), {}, {
|
|
61
|
+
handleChange: function handleChange(response, value) {
|
|
62
|
+
var _component$value$resp, _component$value;
|
|
63
|
+
state.handleChange(response, (0, _array.setAtIndex)((_component$value$resp = (_component$value = component.value) === null || _component$value === void 0 ? void 0 : _component$value[response.name]) !== null && _component$value$resp !== void 0 ? _component$value$resp : [], iteration, value));
|
|
64
|
+
},
|
|
65
|
+
pager: _objectSpread(_objectSpread({}, state.pager), {}, {
|
|
66
|
+
iteration: iteration,
|
|
67
|
+
subPage: 0 // Fake a subpage to simulate an iteration
|
|
68
|
+
})
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Fill component specific props (RoundAbout for instance)
|
|
76
|
+
*/
|
|
42
77
|
function fillSpecificExpressions(component, state) {
|
|
43
|
-
|
|
78
|
+
switch (component.componentType) {
|
|
79
|
+
case 'Roundabout':
|
|
80
|
+
return fillRoundaboutProps(component, state);
|
|
81
|
+
case 'ComponentSet':
|
|
82
|
+
return fillChildComponents(component, state);
|
|
83
|
+
case 'Loop':
|
|
84
|
+
case 'RosterForLoop':
|
|
85
|
+
return fillChildComponentsWithIteration(component, state);
|
|
86
|
+
default:
|
|
87
|
+
return component;
|
|
88
|
+
}
|
|
44
89
|
}
|
|
45
90
|
var _default = fillSpecificExpressions;
|
|
46
91
|
exports["default"] = _default;
|
|
@@ -19,9 +19,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
19
19
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
20
|
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); }
|
|
21
21
|
function isInSubPage(state) {
|
|
22
|
-
|
|
23
|
-
var subPage = pager.subPage;
|
|
24
|
-
return subPage !== undefined;
|
|
22
|
+
return state.pager.subPage !== undefined;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
/**
|
|
@@ -30,6 +30,7 @@ function pageStringToNumbers(page) {
|
|
|
30
30
|
* if no components can be displayed on this page (using filter)
|
|
31
31
|
*/
|
|
32
32
|
function isPageEmpty(state) {
|
|
33
|
+
var isMovingBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
33
34
|
var executeExpression = state.executeExpression,
|
|
34
35
|
pager = state.pager;
|
|
35
36
|
var iteration = pager.iteration;
|
|
@@ -42,6 +43,11 @@ function isPageEmpty(state) {
|
|
|
42
43
|
return true;
|
|
43
44
|
});
|
|
44
45
|
|
|
46
|
+
// When moving backward, modal only pages should be skipped
|
|
47
|
+
if (isMovingBackward && visibleComponents.length === 1 && visibleComponents[0].componentType === 'ConfirmationModal') {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
// No components are displayable on this page
|
|
46
52
|
if (visibleComponents.length === 0) {
|
|
47
53
|
return true;
|
|
@@ -22,5 +22,5 @@ function useLoopVariables(pager, pages) {
|
|
|
22
22
|
return c.componentType === 'Loop';
|
|
23
23
|
});
|
|
24
24
|
return (_loop$loopDependencie = loop === null || loop === void 0 ? void 0 : loop.loopDependencies) !== null && _loop$loopDependencie !== void 0 ? _loop$loopDependencie : [];
|
|
25
|
-
}, [page, inIteration]);
|
|
25
|
+
}, [page, pages, inIteration]);
|
|
26
26
|
}
|
|
@@ -3,21 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.reduceGoNextPage = void 0;
|
|
7
7
|
var _commons = require("../commons");
|
|
8
|
-
var _compose = _interopRequireDefault(require("../commons/compose"));
|
|
9
|
-
var _overviewOnChange = require("./overview/overview-on-change");
|
|
10
|
-
var _pageNavigation = require("../commons/page-navigation");
|
|
11
8
|
var _page = require("../commons/page");
|
|
9
|
+
var _pageNavigation = require("../commons/page-navigation");
|
|
12
10
|
var _autoExploreLoop = require("./commons/auto-explore-loop");
|
|
13
|
-
|
|
11
|
+
var _overviewOnChange = require("./overview/overview-on-change");
|
|
14
12
|
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); }
|
|
15
13
|
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; }
|
|
16
14
|
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; }
|
|
17
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; }
|
|
18
16
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
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); }
|
|
20
|
-
function
|
|
18
|
+
function reduceGoNext(state) {
|
|
21
19
|
var _pages$pager$page;
|
|
22
20
|
var pages = state.pages,
|
|
23
21
|
pager = state.pager;
|
|
@@ -33,7 +31,7 @@ function reduceGoNextPage(state) {
|
|
|
33
31
|
|
|
34
32
|
// We reached an empty page, move forward
|
|
35
33
|
if ((0, _page.isPageEmpty)(newState)) {
|
|
36
|
-
return
|
|
34
|
+
return reduceGoNext(newState);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
// If we reached a loop, go inside
|
|
@@ -41,7 +39,7 @@ function reduceGoNextPage(state) {
|
|
|
41
39
|
|
|
42
40
|
// We explored a loop, check if we reached an empty page, move forward
|
|
43
41
|
if (newState.pager !== nextPager && (0, _page.isPageEmpty)(newState)) {
|
|
44
|
-
return
|
|
42
|
+
return reduceGoNext(newState);
|
|
45
43
|
}
|
|
46
44
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
|
47
45
|
isInLoop: newState.pager.iteration !== undefined,
|
|
@@ -50,5 +48,7 @@ function reduceGoNextPage(state) {
|
|
|
50
48
|
})
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
|
-
var
|
|
54
|
-
|
|
51
|
+
var reduceGoNextPage = function reduceGoNextPage(state) {
|
|
52
|
+
return (0, _overviewOnChange.overviewOnChange)(reduceGoNext(state));
|
|
53
|
+
};
|
|
54
|
+
exports.reduceGoNextPage = reduceGoNextPage;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _lunatic = require("../../../tests/utils/lunatic");
|
|
5
|
+
var _source = _interopRequireDefault(require("../../stories/modal/source.json"));
|
|
6
|
+
var _reduceGoNextPage = require("./reduce-go-next-page");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
(0, _vitest.describe)('reduceGoPreviousPage', function () {
|
|
9
|
+
(0, _vitest.it)('should move forward for modal', function () {
|
|
10
|
+
var state = (0, _lunatic.generateState)(_source["default"]);
|
|
11
|
+
(0, _vitest.expect)((0, _reduceGoNextPage.reduceGoNextPage)(state).pager.page).toBe('2');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -29,15 +29,15 @@ function reduceGoPreviousPage(state) {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
// We reached an empty page, keep going backward
|
|
32
|
-
if ((0, _page.isPageEmpty)(newState)) {
|
|
32
|
+
if ((0, _page.isPageEmpty)(newState, true)) {
|
|
33
33
|
return reduceGoPreviousPage(newState);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// If we reached a loop, go to the last iteration / sequence
|
|
37
37
|
newState = (0, _autoExploreLoop.autoExploreLoop)(newState, 'backward');
|
|
38
38
|
|
|
39
|
-
// We explored a loop, check if we reached an empty page, move
|
|
40
|
-
if (newState.pager !== prevPager && (0, _page.isPageEmpty)(newState)) {
|
|
39
|
+
// We explored a loop, check if we reached an empty page, move backward
|
|
40
|
+
if (newState.pager !== prevPager && (0, _page.isPageEmpty)(newState, true)) {
|
|
41
41
|
return reduceGoPreviousPage(newState);
|
|
42
42
|
}
|
|
43
43
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _lunatic = require("../../../tests/utils/lunatic");
|
|
5
|
+
var _source = _interopRequireDefault(require("../../stories/modal/source.json"));
|
|
6
|
+
var _reduceGoPreviousPage = _interopRequireDefault(require("./reduce-go-previous-page"));
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
(0, _vitest.describe)('reduceGoPreviousPage', function () {
|
|
9
|
+
(0, _vitest.it)('should skip modal when going backward', function () {
|
|
10
|
+
var state = (0, _lunatic.generateState)(_source["default"]);
|
|
11
|
+
state.pager.page = '3';
|
|
12
|
+
(0, _vitest.expect)((0, _reduceGoPreviousPage["default"])(state).pager.page).toBe('1');
|
|
13
|
+
});
|
|
14
|
+
});
|