@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
|
@@ -4,14 +4,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports.BlockForLoop = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _i18n = _interopRequireDefault(require("
|
|
10
|
-
var _commons = require("
|
|
11
|
-
var _declarations = require("
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
9
|
+
var _i18n = _interopRequireDefault(require("../../i18n"));
|
|
10
|
+
var _commons = require("../commons");
|
|
11
|
+
var _declarations = require("../declarations");
|
|
12
|
+
var _getInitialNbRows = require("./utils/get-initial-nb-rows");
|
|
13
|
+
var _loopButton = require("./loop-button");
|
|
14
|
+
var _lunaticComponents = require("../lunatic-components");
|
|
15
|
+
var _array = require("../../utils/array");
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -24,25 +25,18 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
|
|
|
24
25
|
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); }
|
|
25
26
|
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; }
|
|
26
27
|
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; } }
|
|
27
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
preferences = _ref.preferences,
|
|
40
|
-
management = _ref.management,
|
|
41
|
-
executeExpression = _ref.executeExpression,
|
|
42
|
-
iterations = _ref.iterations,
|
|
43
|
-
paginatedLoop = _ref.paginatedLoop,
|
|
44
|
-
errors = _ref.errors,
|
|
45
|
-
disabled = _ref.disabled;
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /**
|
|
29
|
+
* Loop without specific markup
|
|
30
|
+
*/
|
|
31
|
+
var BlockForLoop = (0, _commons.createCustomizableLunaticField)(function (props) {
|
|
32
|
+
var declarations = props.declarations,
|
|
33
|
+
id = props.id,
|
|
34
|
+
label = props.label,
|
|
35
|
+
lines = props.lines,
|
|
36
|
+
handleChange = props.handleChange,
|
|
37
|
+
value = props.value,
|
|
38
|
+
iterations = props.iterations,
|
|
39
|
+
getComponents = props.getComponents;
|
|
46
40
|
var min = lines === null || lines === void 0 ? void 0 : lines.min;
|
|
47
41
|
var max = lines === null || lines === void 0 ? void 0 : lines.max;
|
|
48
42
|
var _useState = (0, _react.useState)(function () {
|
|
@@ -50,7 +44,7 @@ function BlockForLoop(_ref) {
|
|
|
50
44
|
//This should be an Integer
|
|
51
45
|
return Number.parseInt(iterations.toString());
|
|
52
46
|
}
|
|
53
|
-
var initLength = (0,
|
|
47
|
+
var initLength = (0, _getInitialNbRows.getInitialNbRows)(value);
|
|
54
48
|
return Math.max(initLength, min);
|
|
55
49
|
}),
|
|
56
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -65,10 +59,10 @@ function BlockForLoop(_ref) {
|
|
|
65
59
|
if (nbRows > 1) {
|
|
66
60
|
var newNbRows = nbRows - 1;
|
|
67
61
|
setNbRows(newNbRows);
|
|
68
|
-
Object.entries(
|
|
69
|
-
var
|
|
70
|
-
k =
|
|
71
|
-
v =
|
|
62
|
+
Object.entries(value).forEach(function (_ref) {
|
|
63
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
64
|
+
k = _ref2[0],
|
|
65
|
+
v = _ref2[1];
|
|
72
66
|
var newValue = v.filter(function (_, i) {
|
|
73
67
|
return i < newNbRows;
|
|
74
68
|
});
|
|
@@ -77,21 +71,7 @@ function BlockForLoop(_ref) {
|
|
|
77
71
|
}, newValue);
|
|
78
72
|
});
|
|
79
73
|
}
|
|
80
|
-
}, [nbRows, handleChange,
|
|
81
|
-
var handleChangeLoop = (0, _react.useCallback)(function (response, value, args) {
|
|
82
|
-
if (!paginatedLoop) {
|
|
83
|
-
var v = valueMap[response.name];
|
|
84
|
-
v[args.index] = value;
|
|
85
|
-
handleChange(response, v, {
|
|
86
|
-
loop: true,
|
|
87
|
-
length: nbRows,
|
|
88
|
-
shallowIteration: args.index
|
|
89
|
-
});
|
|
90
|
-
} else handleChange(response, value, _objectSpread(_objectSpread({}, args), {}, {
|
|
91
|
-
loop: true,
|
|
92
|
-
length: nbRows
|
|
93
|
-
}));
|
|
94
|
-
}, [handleChange, nbRows, paginatedLoop, valueMap]);
|
|
74
|
+
}, [nbRows, handleChange, value]);
|
|
95
75
|
if (nbRows <= 0) {
|
|
96
76
|
return null;
|
|
97
77
|
}
|
|
@@ -102,34 +82,29 @@ function BlockForLoop(_ref) {
|
|
|
102
82
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsAfterText, {
|
|
103
83
|
declarations: declarations,
|
|
104
84
|
id: id
|
|
105
|
-
}),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
preferences: preferences,
|
|
115
|
-
executeExpression: executeExpression,
|
|
116
|
-
errors: errors,
|
|
117
|
-
disabled: disabled
|
|
85
|
+
}), (0, _array.times)(nbRows, function (n) {
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponents.LunaticComponents, {
|
|
87
|
+
components: getComponents(n),
|
|
88
|
+
componentProps: function componentProps(c) {
|
|
89
|
+
return _objectSpread(_objectSpread(_objectSpread({}, props), c), {}, {
|
|
90
|
+
id: "".concat(c.id, "-").concat(n)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, n);
|
|
118
94
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
119
95
|
declarations: declarations,
|
|
120
96
|
id: id
|
|
121
97
|
}), Number.isInteger(min) && Number.isInteger(max) && min !== max && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
122
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
98
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_loopButton.LoopButton, {
|
|
123
99
|
onClick: addRow,
|
|
124
100
|
disabled: nbRows === max,
|
|
125
101
|
children: label || _i18n["default"].DEFAULT_BUTTON_ADD
|
|
126
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
102
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_loopButton.LoopButton, {
|
|
127
103
|
onClick: removeRow,
|
|
128
104
|
disabled: nbRows === 1,
|
|
129
105
|
children: _i18n["default"].DEFAULT_BUTTON_REMOVE
|
|
130
106
|
})]
|
|
131
107
|
})]
|
|
132
108
|
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
exports["default"] = _default;
|
|
109
|
+
}, 'BlockForLoop');
|
|
110
|
+
exports.BlockForLoop = BlockForLoop;
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var _lunaticButton = _interopRequireDefault(require("../../button/lunatic-button"));
|
|
6
|
+
exports.LoopButton = LoopButton;
|
|
7
|
+
var _lunaticButton = _interopRequireDefault(require("../button/lunatic-button"));
|
|
9
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
function
|
|
10
|
+
function LoopButton(_ref) {
|
|
12
11
|
var onClick = _ref.onClick,
|
|
13
12
|
disabled = _ref.disabled,
|
|
14
13
|
children = _ref.children;
|
|
@@ -17,6 +16,4 @@ function HandleRowButton(_ref) {
|
|
|
17
16
|
disabled: disabled,
|
|
18
17
|
children: children
|
|
19
18
|
});
|
|
20
|
-
}
|
|
21
|
-
var _default = HandleRowButton;
|
|
22
|
-
exports["default"] = _default;
|
|
19
|
+
}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var _htmlTable = require("../../commons/components/html-table");
|
|
6
|
+
exports.LoopHeader = LoopHeader;
|
|
7
|
+
var _htmlTable = require("../commons/components/html-table");
|
|
9
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
function
|
|
11
|
-
function Header(_ref) {
|
|
9
|
+
function LoopHeader(_ref) {
|
|
12
10
|
var header = _ref.header,
|
|
13
11
|
id = _ref.id;
|
|
14
12
|
if (!Array.isArray(header)) {
|
|
@@ -29,6 +27,4 @@ function Header(_ref) {
|
|
|
29
27
|
})
|
|
30
28
|
})
|
|
31
29
|
});
|
|
32
|
-
}
|
|
33
|
-
var _default = Header;
|
|
34
|
-
exports["default"] = _default;
|
|
30
|
+
}
|
|
@@ -3,80 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var _rosterForLoop = _interopRequireDefault(require("./roster-for-loop"));
|
|
6
|
+
exports.Loop = Loop;
|
|
7
|
+
var _blockForLoop = require("./block-for-loop");
|
|
8
|
+
var _rosterForLoop = require("./roster-for-loop/roster-for-loop");
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function
|
|
10
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
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; }
|
|
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; }
|
|
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); }
|
|
12
16
|
var LoopTypes = {
|
|
13
17
|
rosterForLoop: 'RosterForLoop',
|
|
14
18
|
blockForLoop: 'Loop'
|
|
15
19
|
};
|
|
16
20
|
function Loop(props) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value = props.value,
|
|
25
|
-
executeExpression = props.executeExpression,
|
|
26
|
-
componentType = props.componentType,
|
|
27
|
-
headers = props.headers,
|
|
28
|
-
shortcut = props.shortcut,
|
|
29
|
-
management = props.management,
|
|
30
|
-
missing = props.missing,
|
|
31
|
-
features = props.features,
|
|
32
|
-
preferences = props.preferences,
|
|
33
|
-
paginatedLoop = props.paginatedLoop,
|
|
34
|
-
errors = props.errors,
|
|
35
|
-
disabled = props.disabled;
|
|
21
|
+
var Component = getComponent(props.componentType);
|
|
22
|
+
if (!Component) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, props));
|
|
26
|
+
}
|
|
27
|
+
function getComponent(componentType) {
|
|
36
28
|
switch (componentType) {
|
|
37
29
|
case LoopTypes.blockForLoop:
|
|
38
|
-
return
|
|
39
|
-
declarations: declarations,
|
|
40
|
-
label: label,
|
|
41
|
-
lines: lines,
|
|
42
|
-
iterations: iterations,
|
|
43
|
-
id: id,
|
|
44
|
-
components: components,
|
|
45
|
-
handleChange: handleChange,
|
|
46
|
-
value: value,
|
|
47
|
-
management: management,
|
|
48
|
-
executeExpression: executeExpression,
|
|
49
|
-
missing: missing,
|
|
50
|
-
shortcut: shortcut,
|
|
51
|
-
features: features,
|
|
52
|
-
preferences: preferences,
|
|
53
|
-
paginatedLoop: paginatedLoop,
|
|
54
|
-
errors: errors,
|
|
55
|
-
disabled: disabled
|
|
56
|
-
});
|
|
30
|
+
return _blockForLoop.BlockForLoop;
|
|
57
31
|
case LoopTypes.rosterForLoop:
|
|
58
|
-
return
|
|
59
|
-
declarations: declarations,
|
|
60
|
-
label: label,
|
|
61
|
-
lines: lines,
|
|
62
|
-
iterations: iterations,
|
|
63
|
-
id: id,
|
|
64
|
-
components: components,
|
|
65
|
-
handleChange: handleChange,
|
|
66
|
-
value: value,
|
|
67
|
-
management: management,
|
|
68
|
-
executeExpression: executeExpression,
|
|
69
|
-
missing: missing,
|
|
70
|
-
shortcut: shortcut,
|
|
71
|
-
features: features,
|
|
72
|
-
preferences: preferences,
|
|
73
|
-
headers: headers,
|
|
74
|
-
errors: errors,
|
|
75
|
-
disabled: disabled
|
|
76
|
-
});
|
|
32
|
+
return _rosterForLoop.RosterForLoop;
|
|
77
33
|
default:
|
|
78
34
|
return null;
|
|
79
35
|
}
|
|
80
|
-
}
|
|
81
|
-
var _default = Loop;
|
|
82
|
-
exports["default"] = _default;
|
|
36
|
+
}
|
|
@@ -4,18 +4,24 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
var _react =
|
|
7
|
+
exports.RosterForLoop = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _declarations = require("../../declarations");
|
|
10
|
-
var _rosterTable = _interopRequireDefault(require("./roster-table"));
|
|
11
10
|
var _commons = require("../../commons");
|
|
12
|
-
var
|
|
11
|
+
var _loopButton = require("../loop-button");
|
|
13
12
|
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
14
|
-
var
|
|
13
|
+
var _getInitialNbRows = require("../utils/get-initial-nb-rows");
|
|
14
|
+
var _htmlTable = require("../../commons/components/html-table");
|
|
15
|
+
var _header = _interopRequireDefault(require("../../table/header"));
|
|
16
|
+
var _array = require("../../../utils/array");
|
|
17
|
+
var _lunaticComponents = require("../../lunatic-components");
|
|
15
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
function
|
|
18
|
-
function
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
25
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
26
|
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."); }
|
|
21
27
|
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); }
|
|
@@ -24,25 +30,22 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
24
30
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
31
|
var DEFAULT_MIN_ROWS = 1;
|
|
26
32
|
var DEFAULT_MAX_ROWS = 12;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
id =
|
|
39
|
-
management = _ref.management,
|
|
40
|
-
disabled = _ref.disabled,
|
|
41
|
-
errors = _ref.errors;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Loop displayed as a table
|
|
36
|
+
*/
|
|
37
|
+
var RosterForLoop = (0, _commons.createCustomizableLunaticField)(function (props) {
|
|
38
|
+
var valueMap = props.value,
|
|
39
|
+
lines = props.lines,
|
|
40
|
+
handleChange = props.handleChange,
|
|
41
|
+
declarations = props.declarations,
|
|
42
|
+
label = props.label,
|
|
43
|
+
headers = props.headers,
|
|
44
|
+
id = props.id;
|
|
42
45
|
var min = (lines === null || lines === void 0 ? void 0 : lines.min) || DEFAULT_MIN_ROWS;
|
|
43
46
|
var max = (lines === null || lines === void 0 ? void 0 : lines.max) || DEFAULT_MAX_ROWS;
|
|
44
47
|
var _useState = (0, _react.useState)(function () {
|
|
45
|
-
return (0,
|
|
48
|
+
return (0, _getInitialNbRows.getInitialNbRows)(valueMap);
|
|
46
49
|
}),
|
|
47
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
51
|
nbRows = _useState2[0],
|
|
@@ -53,69 +56,85 @@ function RosterforLoop(_ref) {
|
|
|
53
56
|
setNbRows(nbRows + 1);
|
|
54
57
|
}
|
|
55
58
|
}, [max, nbRows]);
|
|
56
|
-
var handleChangeLoop = (0, _react.useCallback)(function (response, value, args) {
|
|
57
|
-
var v = valueMap[response.name];
|
|
58
|
-
v[args.index] = value;
|
|
59
|
-
handleChange(response, v, {
|
|
60
|
-
loop: true,
|
|
61
|
-
length: nbRows
|
|
62
|
-
}); // TODO: a retaper pour déplacer cette compléxité
|
|
63
|
-
}, [handleChange, nbRows, valueMap]);
|
|
64
59
|
var removeRow = (0, _react.useCallback)(function () {
|
|
65
|
-
if (nbRows
|
|
66
|
-
|
|
67
|
-
setNbRows(newNbRows);
|
|
68
|
-
Object.entries(valueMap).forEach(function (_ref2) {
|
|
69
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
70
|
-
k = _ref3[0],
|
|
71
|
-
v = _ref3[1];
|
|
72
|
-
var newValue = v.filter(function (_, i) {
|
|
73
|
-
return i < newNbRows;
|
|
74
|
-
});
|
|
75
|
-
handleChange({
|
|
76
|
-
name: k
|
|
77
|
-
}, newValue);
|
|
78
|
-
});
|
|
60
|
+
if (nbRows <= 1) {
|
|
61
|
+
return;
|
|
79
62
|
}
|
|
63
|
+
var newNbRows = nbRows - 1;
|
|
64
|
+
setNbRows(newNbRows);
|
|
65
|
+
Object.entries(valueMap).forEach(function (_ref) {
|
|
66
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
67
|
+
k = _ref2[0],
|
|
68
|
+
v = _ref2[1];
|
|
69
|
+
var newValue = v.filter(function (_, i) {
|
|
70
|
+
return i < newNbRows;
|
|
71
|
+
});
|
|
72
|
+
handleChange({
|
|
73
|
+
name: k
|
|
74
|
+
}, newValue);
|
|
75
|
+
});
|
|
80
76
|
}, [nbRows, handleChange, valueMap]);
|
|
81
|
-
if (nbRows
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
if (nbRows === 0) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsBeforeText, {
|
|
82
|
+
declarations: declarations,
|
|
83
|
+
id: id
|
|
84
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsAfterText, {
|
|
85
|
+
declarations: declarations,
|
|
86
|
+
id: id
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_htmlTable.Table, {
|
|
88
|
+
id: id,
|
|
89
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_header["default"], {
|
|
90
|
+
header: headers,
|
|
88
91
|
id: id
|
|
89
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
92
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Tbody, {
|
|
90
93
|
id: id,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
management: management,
|
|
98
|
-
missing: missing,
|
|
99
|
-
shortcut: shortcut,
|
|
100
|
-
disabled: disabled,
|
|
101
|
-
errors: errors
|
|
102
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
103
|
-
declarations: declarations,
|
|
104
|
-
id: id
|
|
105
|
-
}), showButtons && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
106
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_handleRowButton["default"], {
|
|
107
|
-
onClick: addRow,
|
|
108
|
-
disabled: nbRows === max,
|
|
109
|
-
children: label || _i18n["default"].DEFAULT_BUTTON_ADD
|
|
110
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_handleRowButton["default"], {
|
|
111
|
-
onClick: removeRow,
|
|
112
|
-
disabled: nbRows === min,
|
|
113
|
-
children: _i18n["default"].DEFAULT_BUTTON_REMOVE
|
|
114
|
-
})]
|
|
94
|
+
children: (0, _array.times)(nbRows, function (n) {
|
|
95
|
+
return /*#__PURE__*/(0, _react.createElement)(Row, _objectSpread(_objectSpread({}, props), {}, {
|
|
96
|
+
key: n,
|
|
97
|
+
row: n
|
|
98
|
+
}));
|
|
99
|
+
})
|
|
115
100
|
})]
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
101
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
102
|
+
declarations: declarations,
|
|
103
|
+
id: id
|
|
104
|
+
}), showButtons && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
105
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_loopButton.LoopButton, {
|
|
106
|
+
onClick: addRow,
|
|
107
|
+
disabled: nbRows === max,
|
|
108
|
+
children: label || _i18n["default"].DEFAULT_BUTTON_ADD
|
|
109
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_loopButton.LoopButton, {
|
|
110
|
+
onClick: removeRow,
|
|
111
|
+
disabled: nbRows === min,
|
|
112
|
+
children: _i18n["default"].DEFAULT_BUTTON_REMOVE
|
|
113
|
+
})]
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
116
|
+
}, 'RosterforLoop');
|
|
117
|
+
exports.RosterForLoop = RosterForLoop;
|
|
118
|
+
function Row(props) {
|
|
119
|
+
var components = props.getComponents(props.row);
|
|
120
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Tr, {
|
|
121
|
+
id: props.id,
|
|
122
|
+
row: props.row,
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponents.LunaticComponents, {
|
|
124
|
+
components: components,
|
|
125
|
+
componentProps: function componentProps(c) {
|
|
126
|
+
return _objectSpread(_objectSpread(_objectSpread({}, props), c), {}, {
|
|
127
|
+
id: "".concat(c.id, "-").concat(props.row)
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
wrapper: function wrapper(_ref3) {
|
|
131
|
+
var id = _ref3.id,
|
|
132
|
+
children = _ref3.children;
|
|
133
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Td, {
|
|
134
|
+
id: "".concat(id, "-").concat(props.row),
|
|
135
|
+
children: children
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
}
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports.getInitialNbRows = getInitialNbRows;
|
|
7
|
+
/**
|
|
8
|
+
* Find the length of the variable (the biggest value sent to the loop)
|
|
9
|
+
*/
|
|
10
|
+
function getInitialNbRows(value) {
|
|
8
11
|
return Object.values(value).reduce(function (length, variable) {
|
|
9
12
|
if (Array.isArray(variable)) {
|
|
10
13
|
return Math.max(length, variable.length);
|
|
11
14
|
}
|
|
12
15
|
return length;
|
|
13
16
|
}, 1);
|
|
14
|
-
}
|
|
15
|
-
var _default = getInitLength;
|
|
16
|
-
exports["default"] = _default;
|
|
17
|
+
}
|