@inseefr/lunatic 2.0.4-v2 → 2.0.5-v2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/button/index.js +0 -2
- package/lib/components/button/lunatic-button.js +4 -18
- package/lib/components/checkbox/checkbox-boolean/checkbox-boolean.js +5 -12
- package/lib/components/checkbox/checkbox-boolean/index.js +0 -2
- package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +7 -15
- package/lib/components/checkbox/checkbox-group/checkbox-group.js +14 -26
- package/lib/components/checkbox/checkbox-group/index.js +0 -2
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +6 -13
- package/lib/components/checkbox/checkbox-one/index.js +0 -2
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +1 -13
- package/lib/components/checkbox/commons/checkbox-option.js +7 -20
- package/lib/components/checkbox/commons/index.js +0 -2
- package/lib/components/checkbox/index.js +0 -4
- package/lib/components/commons/build-style-object.js +2 -13
- package/lib/components/commons/components/combo-box/combo-box-container.js +3 -9
- package/lib/components/commons/components/combo-box/combo-box-content.js +6 -19
- package/lib/components/commons/components/combo-box/combo-box.js +30 -64
- package/lib/components/commons/components/combo-box/index.js +0 -2
- package/lib/components/commons/components/combo-box/panel/index.js +0 -2
- package/lib/components/commons/components/combo-box/panel/option-container.js +4 -19
- package/lib/components/commons/components/combo-box/panel/panel-container.js +3 -8
- package/lib/components/commons/components/combo-box/panel/panel.js +13 -22
- package/lib/components/commons/components/combo-box/selection/delete.js +3 -19
- package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.js +1 -8
- package/lib/components/commons/components/combo-box/selection/index.js +0 -2
- package/lib/components/commons/components/combo-box/selection/input.js +7 -20
- package/lib/components/commons/components/combo-box/selection/label-selection.js +6 -13
- package/lib/components/commons/components/combo-box/selection/selection-container.js +4 -9
- package/lib/components/commons/components/combo-box/selection/selection.js +12 -22
- package/lib/components/commons/components/combo-box/state-management/actions.js +2 -21
- package/lib/components/commons/components/combo-box/state-management/combo-box-context.js +0 -4
- package/lib/components/commons/components/combo-box/state-management/index.js +0 -9
- package/lib/components/commons/components/combo-box/state-management/reducer/index.js +0 -2
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-blur.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-change.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-delete.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-focus.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-init.js +4 -13
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/index.js +0 -2
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-down.js +0 -8
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-up.js +0 -8
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-end.js +0 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-enter.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-escape.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-home.js +0 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-tab.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/reduce-on-keydown.js +1 -20
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-select.js +0 -5
- package/lib/components/commons/components/combo-box/state-management/reducer/reducer.js +0 -22
- package/lib/components/commons/components/create-lunatic-component/create-lunatic-component.js +10 -21
- package/lib/components/commons/components/create-lunatic-component/index.js +0 -3
- package/lib/components/commons/components/default-label-renderer.js +4 -14
- package/lib/components/commons/components/default-option-renderer.js +3 -10
- package/lib/components/commons/components/dragger/dragger.js +19 -45
- package/lib/components/commons/components/dragger/index.js +0 -2
- package/lib/components/commons/components/errors/errors.js +3 -17
- package/lib/components/commons/components/errors/index.js +0 -2
- package/lib/components/commons/components/fab/fab.js +6 -14
- package/lib/components/commons/components/fab/index.js +0 -2
- package/lib/components/commons/components/field-container/field-container.js +3 -12
- package/lib/components/commons/components/field-container/index.js +0 -2
- package/lib/components/commons/components/fieldset.js +1 -9
- package/lib/components/commons/components/html-table/index.js +0 -7
- package/lib/components/commons/components/html-table/table.js +2 -11
- package/lib/components/commons/components/html-table/tbody.js +2 -11
- package/lib/components/commons/components/html-table/td.js +6 -15
- package/lib/components/commons/components/html-table/th.js +5 -14
- package/lib/components/commons/components/html-table/thead.js +2 -11
- package/lib/components/commons/components/html-table/tr.js +3 -12
- package/lib/components/commons/components/is-network/index.js +0 -2
- package/lib/components/commons/components/is-network/is-network.js +7 -26
- package/lib/components/commons/components/is-network/use-online-status.js +0 -9
- package/lib/components/commons/components/label.js +4 -12
- package/lib/components/commons/components/lunatic-component.js +12 -24
- package/lib/components/commons/components/lunatic-fieldset-component.js +9 -20
- package/lib/components/commons/components/md-label/index.js +0 -2
- package/lib/components/commons/components/md-label/link.js +8 -14
- package/lib/components/commons/components/md-label/md-label.js +2 -13
- package/lib/components/commons/components/missing/index.js +0 -2
- package/lib/components/commons/components/missing/missing.js +11 -25
- package/lib/components/commons/components/nothing-to-display.js +0 -4
- package/lib/components/commons/components/orchestrated-component.js +13 -25
- package/lib/components/commons/components/variable-status/img/index.js +0 -3
- package/lib/components/commons/components/variable-status/index.js +0 -2
- package/lib/components/commons/components/variable-status/variable-status.js +17 -34
- package/lib/components/commons/create-customizable-field.js +1 -12
- package/lib/components/commons/create-row-orchestrator.js +14 -21
- package/lib/components/commons/icons/checkbox-checked.icon.js +4 -9
- package/lib/components/commons/icons/checkbox-unchecked.icon.js +4 -9
- package/lib/components/commons/icons/closed.icon.js +4 -9
- package/lib/components/commons/icons/cross.icon.js +4 -9
- package/lib/components/commons/icons/index.js +0 -11
- package/lib/components/commons/icons/load.icon.js +4 -9
- package/lib/components/commons/icons/lunatic-icon.js +1 -7
- package/lib/components/commons/icons/network.icon.js +4 -9
- package/lib/components/commons/icons/on-drag.icon.js +4 -9
- package/lib/components/commons/icons/opened.icon.js +4 -9
- package/lib/components/commons/icons/radio-checked.icon.js +4 -9
- package/lib/components/commons/icons/radio-unchecked.icon.js +4 -9
- package/lib/components/commons/index.js +0 -24
- package/lib/components/commons/prop-types/declarations.js +0 -8
- package/lib/components/commons/prop-types/index.js +0 -6
- package/lib/components/commons/prop-types/lines.js +0 -4
- package/lib/components/commons/prop-types/options.js +0 -4
- package/lib/components/commons/prop-types/response.js +0 -4
- package/lib/components/commons/prop-types/value-type.js +0 -8
- package/lib/components/commons/safety-label.js +0 -8
- package/lib/components/commons/use-document-add-event-listener.js +4 -31
- package/lib/components/commons/use-on-handle-change.js +2 -5
- package/lib/components/commons/use-options-keydown.js +1 -6
- package/lib/components/commons/use-previous.js +0 -3
- package/lib/components/components.js +8 -33
- package/lib/components/datepicker/datepicker.js +7 -18
- package/lib/components/datepicker/index.js +0 -2
- package/lib/components/datepicker/lunatic-datepicker.js +1 -13
- package/lib/components/declarations/declaration.js +1 -8
- package/lib/components/declarations/declarations-after-text.js +0 -9
- package/lib/components/declarations/declarations-before-text.js +0 -9
- package/lib/components/declarations/declarations-detachable.js +0 -9
- package/lib/components/declarations/declarations.js +6 -16
- package/lib/components/declarations/index.js +0 -8
- package/lib/components/dropdown/dropdown-simple/dropdown-simple.js +7 -14
- package/lib/components/dropdown/dropdown-simple/index.js +0 -2
- package/lib/components/dropdown/dropdown-simple/simple-label-renderer.js +3 -13
- package/lib/components/dropdown/dropdown-simple/simple-option-renderer.js +2 -9
- package/lib/components/dropdown/dropdown-writable/dropdown-writable.js +10 -30
- package/lib/components/dropdown/dropdown-writable/filter-tools/filter-options.js +1 -12
- package/lib/components/dropdown/dropdown-writable/filter-tools/letters-matching.js +0 -11
- package/lib/components/dropdown/dropdown-writable/filter-tools/match.js +0 -5
- package/lib/components/dropdown/dropdown-writable/filter-tools/prepare-prefix.js +0 -4
- package/lib/components/dropdown/dropdown-writable/index.js +0 -2
- package/lib/components/dropdown/dropdown-writable/writable-label-renderer.js +3 -13
- package/lib/components/dropdown/dropdown-writable/writable-option-renderer.js +14 -50
- package/lib/components/dropdown/dropdown.js +8 -19
- package/lib/components/dropdown/index.js +0 -2
- package/lib/components/dropdown/lunatic-dropdown.js +8 -17
- package/lib/components/filter-description/component.js +1 -7
- package/lib/components/filter-description/index.js +0 -2
- package/lib/components/index.js +0 -4
- package/lib/components/input/index.js +0 -2
- package/lib/components/input/input.js +6 -18
- package/lib/components/input/lunatic-input.js +1 -14
- package/lib/components/input-number/index.js +0 -2
- package/lib/components/input-number/input-number.js +9 -20
- package/lib/components/input-number/lunatic-input-number.js +1 -12
- package/lib/components/loop/block-for-loop/block-for-loop-ochestrator.js +0 -4
- package/lib/components/loop/block-for-loop/block-for-loop.js +28 -61
- package/lib/components/loop/block-for-loop/index.js +0 -2
- package/lib/components/loop/block-for-loop/row.js +13 -29
- package/lib/components/loop/commons/get-init-length.js +0 -3
- package/lib/components/loop/commons/handle-row-button.js +2 -7
- package/lib/components/loop/commons/index.js +0 -3
- package/lib/components/loop/commons/row-component.js +16 -37
- package/lib/components/loop/index.js +0 -2
- package/lib/components/loop/loop.js +19 -29
- package/lib/components/loop/roster-for-loop/body.js +10 -24
- package/lib/components/loop/roster-for-loop/header.js +2 -9
- package/lib/components/loop/roster-for-loop/index.js +0 -2
- package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +0 -4
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +21 -51
- package/lib/components/loop/roster-for-loop/roster-table.js +10 -21
- package/lib/components/loop/roster-for-loop/row.js +13 -26
- package/lib/components/modal-controls/close-or-skip.js +3 -10
- package/lib/components/modal-controls/index.js +0 -2
- package/lib/components/modal-controls/modal-container.js +0 -5
- package/lib/components/modal-controls/modal-controls.js +5 -28
- package/lib/components/modal-controls/modal-controls.scss +7 -6
- package/lib/components/{pairwise/links → pairwise-links}/index.js +0 -2
- package/lib/components/pairwise-links/orchestrator.js +69 -0
- package/lib/components/{pairwise/links → pairwise-links}/pairwise-links.js +20 -27
- package/lib/components/{pairwise/links → pairwise-links}/row.js +50 -65
- package/lib/components/radio/index.js +0 -2
- package/lib/components/radio/lunatic-radio-group.js +6 -14
- package/lib/components/radio/radio-group.js +6 -13
- package/lib/components/radio/radio-option.js +9 -23
- package/lib/components/sequence/index.js +0 -2
- package/lib/components/sequence/sequence.js +3 -11
- package/lib/components/subsequence/index.js +0 -2
- package/lib/components/subsequence/subsequence.js +2 -9
- package/lib/components/suggester/check-store.js +13 -47
- package/lib/components/suggester/find-best-label/find-best-label.js +2 -14
- package/lib/components/suggester/find-best-label/index.js +0 -2
- package/lib/components/suggester/idb-suggester.js +13 -33
- package/lib/components/suggester/index.js +0 -2
- package/lib/components/suggester/lunatic-suggester.js +13 -27
- package/lib/components/suggester/searching/create-searching.js +5 -18
- package/lib/components/suggester/searching/index.js +0 -2
- package/lib/components/suggester/suggester.js +19 -53
- package/lib/components/suggester-loader-widget/index.js +0 -2
- package/lib/components/suggester-loader-widget/loader-row.js +12 -39
- package/lib/components/suggester-loader-widget/loader.js +14 -55
- package/lib/components/suggester-loader-widget/progress.js +6 -13
- package/lib/components/suggester-loader-widget/tools/action-tool.js +5 -12
- package/lib/components/suggester-loader-widget/tools/index.js +0 -3
- package/lib/components/suggester-loader-widget/tools/tools.js +0 -4
- package/lib/components/suggester-loader-widget/widget-container.js +2 -11
- package/lib/components/suggester-loader-widget/widget.js +20 -52
- package/lib/components/switch/index.js +0 -2
- package/lib/components/switch/lunatic-switch.js +5 -17
- package/lib/components/switch/switch.js +6 -20
- package/lib/components/table/cell.js +14 -39
- package/lib/components/table/components/cell.js +14 -39
- package/lib/components/table/components/header.js +4 -11
- package/lib/components/table/components/row.js +7 -13
- package/lib/components/table/components/table.js +3 -10
- package/lib/components/table/index.js +0 -2
- package/lib/components/table/lunatic-table.js +13 -33
- package/lib/components/table/table-orchestrator.js +12 -20
- package/lib/components/textarea/index.js +0 -2
- package/lib/components/textarea/lunatic-textarea.js +1 -14
- package/lib/components/textarea/textarea.js +7 -19
- package/lib/constants/declarations.js +3 -1
- package/lib/constants/event-types.js +2 -1
- package/lib/constants/index.js +0 -10
- package/lib/constants/supported-preferences.js +0 -5
- package/lib/constants/variable-types.js +2 -2
- package/lib/i18n/build-dictionary.js +2 -10
- package/lib/i18n/index.js +0 -6
- package/lib/index.js +0 -4
- package/lib/stories/checkboxBoolean/checkboxBoolean.stories.js +0 -8
- package/lib/stories/checkboxOne/checkboxOne.stories.js +0 -8
- package/lib/stories/custom-mui/checkbox-boolean-mui.js +4 -12
- package/lib/stories/custom-mui/checkbox-group-mui.js +9 -23
- package/lib/stories/custom-mui/checkbox-one-mui.js +0 -4
- package/lib/stories/custom-mui/index.js +0 -16
- package/lib/stories/custom-mui/input-mui.js +7 -17
- package/lib/stories/custom-mui/input-number-mui.js +7 -15
- package/lib/stories/custom-mui/radio-mui.js +7 -23
- package/lib/stories/custom-mui/suggester-mui/index.js +0 -2
- package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +54 -92
- package/lib/stories/custom-mui/switch-mui.js +5 -15
- package/lib/stories/custom-mui/table-mui.js +2 -10
- package/lib/stories/custom-mui/tbody-mui.js +2 -8
- package/lib/stories/custom-mui/td-mui.js +4 -10
- package/lib/stories/custom-mui/textarea-mui.js +7 -16
- package/lib/stories/custom-mui/th-mui.js +3 -9
- package/lib/stories/custom-mui/thead-mui.js +2 -8
- package/lib/stories/custom-mui/tr-mui.js +3 -10
- package/lib/stories/date-picker/datepicker.stories.js +0 -9
- package/lib/stories/dropdown/dropdown.stories.js +0 -9
- package/lib/stories/filter-description/filter-description.stories.js +0 -12
- package/lib/stories/input/input.stories.js +0 -9
- package/lib/stories/input-number/input-number.stories.js +0 -9
- package/lib/stories/pairwise/data.json +4 -5
- package/lib/stories/pairwise/links.json +81 -18
- package/lib/stories/pairwise/pairwise-links.stories.js +0 -9
- package/lib/stories/paste-questionnaire/test.stories.js +0 -11
- package/lib/stories/questionnaires/logement/logement.stories.js +0 -14
- package/lib/stories/questionnaires/recensement/data.json +12 -0
- package/lib/stories/questionnaires/recensement/recensement.stories.js +55 -0
- package/lib/stories/questionnaires/recensement/source.json +15202 -0
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +0 -11
- package/lib/stories/questionnaires-test/controls/controls.stories.js +0 -15
- package/lib/stories/questionnaires-test/test.stories.js +0 -15
- package/lib/stories/radio/radio.stories.js +0 -8
- package/lib/stories/roster-for-loop/roster-for-loop.stories.js +0 -8
- package/lib/stories/suggester/suggester-workers.stories.js +11 -52
- package/lib/stories/suggester/suggester.stories.js +0 -10
- package/lib/stories/switch/SwitchMaterialUI.js +5 -15
- package/lib/stories/switch/switch.js +3 -26
- package/lib/stories/table/table.stories.js +0 -16
- package/lib/stories/utils/default-arg-types.js +0 -4
- package/lib/stories/utils/orchestrator.js +60 -84
- package/lib/stories/utils/waiting/index.js +0 -2
- package/lib/stories/utils/waiting/waiting.js +1 -11
- package/lib/use-lunatic/actions.js +8 -20
- package/lib/use-lunatic/commons/calculated-variables.js +15 -42
- package/lib/use-lunatic/commons/check-loops.js +9 -36
- package/lib/use-lunatic/commons/compose.js +0 -4
- package/lib/use-lunatic/commons/create-map-pages.js +2 -26
- package/lib/use-lunatic/commons/execute-condition-filter.js +0 -7
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +52 -101
- package/lib/use-lunatic/commons/execute-expression/create-memoizer.js +2 -26
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +18 -43
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +3 -38
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.js +2 -16
- package/lib/use-lunatic/commons/execute-expression/get-safety-expression.js +2 -11
- package/lib/use-lunatic/commons/execute-expression/index.js +0 -2
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +15 -43
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js +0 -7
- package/lib/use-lunatic/commons/fill-components/fill-components.js +0 -13
- package/lib/use-lunatic/commons/fill-components/fill-errors.js +0 -7
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +2 -7
- package/lib/use-lunatic/commons/fill-components/fill-management.js +0 -7
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +1 -9
- package/lib/use-lunatic/commons/fill-components/fill-pagination.js +0 -5
- package/lib/use-lunatic/commons/fill-components/index.js +0 -2
- package/lib/use-lunatic/commons/get-compatible-vtl-expression.js +0 -7
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +22 -64
- package/lib/use-lunatic/commons/get-component-value/index.js +0 -2
- package/lib/use-lunatic/commons/get-components-from-state.js +3 -10
- package/lib/use-lunatic/commons/get-data.js +11 -29
- package/lib/use-lunatic/commons/get-errors-without-empty-value.js +2 -11
- package/lib/use-lunatic/commons/index.js +0 -14
- package/lib/use-lunatic/commons/is-First-last-page.js +1 -3
- package/lib/use-lunatic/commons/is-paginated-loop.js +1 -3
- package/lib/use-lunatic/commons/load-suggesters.js +8 -53
- package/lib/use-lunatic/commons/page-tag.js +10 -33
- package/lib/use-lunatic/commons/use-components-from-state.js +5 -18
- package/lib/use-lunatic/index.js +0 -2
- package/lib/use-lunatic/initial-state.js +0 -3
- package/lib/use-lunatic/reducer/commons/index.js +0 -5
- package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +1 -15
- package/lib/use-lunatic/reducer/commons/resize-array-variable.js +2 -12
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.js +3 -15
- package/lib/use-lunatic/reducer/index.js +0 -2
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +17 -55
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +25 -48
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +4 -18
- package/lib/use-lunatic/reducer/reduce-handle-change/index.js +0 -2
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +8 -27
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +24 -40
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +53 -28
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +9 -32
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +19 -41
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +7 -19
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +1 -8
- package/lib/use-lunatic/reducer/reduce-on-init.js +50 -96
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +0 -5
- package/lib/use-lunatic/reducer/reducer.js +0 -20
- package/lib/use-lunatic/reducer/validate-controls/create-controls-reducer.js +9 -21
- package/lib/use-lunatic/reducer/validate-controls/create-modal-controls-reducer.js +7 -26
- package/lib/use-lunatic/reducer/validate-controls/index.js +0 -3
- package/lib/use-lunatic/reducer/validate-controls/validation-utils.js +7 -20
- package/lib/use-lunatic/use-lunatic.js +57 -104
- package/lib/utils/constants/index.js +0 -10
- package/lib/utils/idb-tools/clear-store.js +1 -11
- package/lib/utils/idb-tools/create-db-opener.js +6 -19
- package/lib/utils/idb-tools/create-open-db.js +1 -7
- package/lib/utils/idb-tools/get-entity.js +0 -4
- package/lib/utils/idb-tools/get-idb.js +0 -2
- package/lib/utils/idb-tools/idb-bulk-insert.js +11 -37
- package/lib/utils/idb-tools/index.js +0 -11
- package/lib/utils/idb-tools/insert-entity.js +0 -4
- package/lib/utils/idb-tools/open-db.js +1 -6
- package/lib/utils/idb-tools/open-or-create-db.js +3 -10
- package/lib/utils/is-element.js +0 -2
- package/lib/utils/store-tools/auto-load.js +9 -50
- package/lib/utils/store-tools/clear-store-data.js +1 -12
- package/lib/utils/store-tools/clear-store-info.js +1 -12
- package/lib/utils/store-tools/create/create.js +1 -18
- package/lib/utils/store-tools/create/index.js +0 -3
- package/lib/utils/store-tools/create/update-store-info.js +0 -6
- package/lib/utils/store-tools/get-store-count.js +0 -5
- package/lib/utils/store-tools/index.js +0 -12
- package/lib/utils/store-tools/open-or-create-store.js +1 -11
- package/lib/utils/store-tools/use-store-index.js +4 -26
- package/lib/utils/suggester-workers/append-to-index/append.js +7 -23
- package/lib/utils/suggester-workers/append-to-index/append.worker.js +6 -10
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +3 -11
- package/lib/utils/suggester-workers/append-to-index/index.js +0 -3
- package/lib/utils/suggester-workers/append-to-index/prepare-entities.js +5 -34
- package/lib/utils/suggester-workers/append-to-index/store-messages.js +0 -6
- package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +0 -19
- package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +11 -40
- package/lib/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +0 -14
- package/lib/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +0 -3
- package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +0 -14
- package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.spec.js +0 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.js +0 -5
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.spec.js +0 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.js +0 -9
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +0 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.js +1 -3
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +0 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.js +3 -9
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.spec.js +0 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +1 -21
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +2 -3
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +0 -3
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +0 -2
- package/lib/utils/suggester-workers/commons-tokenizer/filters/index.js +0 -3
- package/lib/utils/suggester-workers/commons-tokenizer/get-regexp-from-pattern.js +0 -3
- package/lib/utils/suggester-workers/commons-tokenizer/get-stemmer.js +0 -8
- package/lib/utils/suggester-workers/commons-tokenizer/index.js +0 -10
- package/lib/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +0 -6
- package/lib/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +0 -3
- package/lib/utils/suggester-workers/create-worker.js +1 -11
- package/lib/utils/suggester-workers/find-best-label/find-best-label.js +5 -26
- package/lib/utils/suggester-workers/find-best-label/find-best-label.worker.js +9 -23
- package/lib/utils/suggester-workers/find-best-label/tokenize.js +5 -22
- package/lib/utils/suggester-workers/find-best-label/tokenize.spec.js +0 -2
- package/lib/utils/suggester-workers/searching/compute-score.js +0 -15
- package/lib/utils/suggester-workers/searching/get-db.js +1 -15
- package/lib/utils/suggester-workers/searching/index.js +0 -2
- package/lib/utils/suggester-workers/searching/order/create-alphanumeric-orderer.js +0 -5
- package/lib/utils/suggester-workers/searching/order/index.js +0 -8
- package/lib/utils/suggester-workers/searching/query-parser/index.js +0 -3
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.js +0 -3
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.spec.js +0 -2
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +2 -20
- package/lib/utils/suggester-workers/searching/resolve-query-parser.js +1 -15
- package/lib/utils/suggester-workers/searching/search-in-index.js +0 -3
- package/lib/utils/suggester-workers/searching/searching.js +2 -39
- package/lib/utils/suggester-workers/searching/searching.worker.js +4 -7
- package/lib/utils/vtl/dataset-builder.js +0 -4
- package/lib/utils/vtl/index.js +0 -2
- package/package.json +4 -2
- package/lib/components/pairwise/index.js +0 -15
- package/lib/components/pairwise/links/orchestrator.js +0 -16
|
@@ -4,33 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _isPaginatedLoop = _interopRequireDefault(require("./is-paginated-loop"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
-
|
|
14
10
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
|
|
16
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
|
|
18
12
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
|
|
20
13
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
|
-
|
|
30
18
|
function isUnpaginated(questionnaire) {
|
|
31
19
|
var maxPage = questionnaire.maxPage;
|
|
32
20
|
return maxPage === undefined;
|
|
33
21
|
}
|
|
22
|
+
|
|
34
23
|
/**
|
|
35
24
|
*
|
|
36
25
|
* @param {*} component: object
|
|
@@ -38,15 +27,12 @@ function isUnpaginated(questionnaire) {
|
|
|
38
27
|
* @param {*} map Map<page,{ components: Array<component>, isLoop: boolean, subPages: Array<page> }>
|
|
39
28
|
* @returns
|
|
40
29
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
30
|
function mergeComponent(component, page, map) {
|
|
44
31
|
if (!page) {
|
|
45
32
|
return _objectSpread(_objectSpread({}, map), {}, {
|
|
46
33
|
unpaged: [].concat(_toConsumableArray(map.unpaged), [component])
|
|
47
34
|
});
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
if (page in map) {
|
|
51
37
|
var current = map[page];
|
|
52
38
|
var components = current.components;
|
|
@@ -54,20 +40,16 @@ function mergeComponent(component, page, map) {
|
|
|
54
40
|
components: [].concat(_toConsumableArray(components), [component])
|
|
55
41
|
})));
|
|
56
42
|
}
|
|
57
|
-
|
|
58
43
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, page, {
|
|
59
44
|
components: [component]
|
|
60
45
|
}));
|
|
61
46
|
}
|
|
62
|
-
|
|
63
47
|
function mergeNestedComponents(components, map) {
|
|
64
48
|
return components.reduce(function (current, component) {
|
|
65
49
|
var page = component.page;
|
|
66
|
-
|
|
67
50
|
if (page) {
|
|
68
51
|
return mergeComponent(component, page, current);
|
|
69
52
|
}
|
|
70
|
-
|
|
71
53
|
return current;
|
|
72
54
|
}, map);
|
|
73
55
|
}
|
|
@@ -76,11 +58,8 @@ function mergeNestedComponents(components, map) {
|
|
|
76
58
|
* @param {*} components
|
|
77
59
|
* @returns
|
|
78
60
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
61
|
function createPages(questionnaire) {
|
|
82
62
|
var components = questionnaire.components;
|
|
83
|
-
|
|
84
63
|
if (isUnpaginated(questionnaire)) {
|
|
85
64
|
return {
|
|
86
65
|
1: {
|
|
@@ -91,18 +70,15 @@ function createPages(questionnaire) {
|
|
|
91
70
|
|
|
92
71
|
var map = components.reduce(function (current, component) {
|
|
93
72
|
var components = component.components,
|
|
94
|
-
|
|
95
|
-
|
|
73
|
+
page = component.page;
|
|
96
74
|
if ((0, _isPaginatedLoop["default"])(component)) {
|
|
97
75
|
return mergeComponent(component, page, mergeNestedComponents(components, current));
|
|
98
76
|
}
|
|
99
|
-
|
|
100
77
|
return mergeComponent(component, page, current);
|
|
101
78
|
}, {
|
|
102
79
|
unpaged: []
|
|
103
80
|
});
|
|
104
81
|
return map;
|
|
105
82
|
}
|
|
106
|
-
|
|
107
83
|
var _default = createPages;
|
|
108
84
|
exports["default"] = _default;
|
|
@@ -4,31 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _getCompatibleVtlExpression = _interopRequireDefault(require("./get-compatible-vtl-expression"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
function executeConditionFilter(filter, execute, iteration) {
|
|
13
10
|
if (filter && typeof execute === 'function') {
|
|
14
11
|
var logging = function logging() {
|
|
15
12
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
13
|
args[_key] = arguments[_key];
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
console.warn(args);
|
|
20
16
|
console.warn('executeConditionFilter:', filter);
|
|
21
17
|
};
|
|
22
|
-
|
|
23
18
|
var value = filter.value;
|
|
24
19
|
return execute((0, _getCompatibleVtlExpression["default"])(value), {
|
|
25
20
|
iteration: iteration,
|
|
26
21
|
logging: logging
|
|
27
22
|
});
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
return undefined;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
var _default = executeConditionFilter;
|
|
34
27
|
exports["default"] = _default;
|
|
@@ -4,275 +4,231 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _executeExpression = _interopRequireDefault(require("./execute-expression"));
|
|
9
|
-
|
|
10
8
|
var _getSafetyExpression = _interopRequireDefault(require("./get-safety-expression"));
|
|
11
|
-
|
|
12
9
|
var _getExpressionsVariables = _interopRequireDefault(require("./get-expressions-variables"));
|
|
13
|
-
|
|
14
10
|
var _createMemoizer3 = _interopRequireDefault(require("./create-memoizer"));
|
|
15
|
-
|
|
16
11
|
var _createRefreshCalculated = _interopRequireDefault(require("./create-refresh-calculated"));
|
|
17
|
-
|
|
18
12
|
var _vtl = _interopRequireDefault(require("../../../utils/vtl"));
|
|
19
|
-
|
|
20
13
|
var _constants = require("../../../utils/constants");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
|
-
|
|
30
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
-
|
|
32
19
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
33
|
-
|
|
34
20
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
-
|
|
36
21
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
-
|
|
38
22
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
39
|
-
|
|
40
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
-
|
|
42
24
|
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); }
|
|
43
|
-
|
|
44
25
|
function validateExpression(expObject) {
|
|
45
26
|
if (_typeof(expObject) === 'object') {
|
|
46
27
|
var type = expObject.type;
|
|
47
|
-
|
|
48
28
|
if (type === _constants.VTL || type === _constants.VTL_MD) {
|
|
49
29
|
return expObject;
|
|
50
30
|
}
|
|
51
31
|
}
|
|
52
|
-
|
|
53
32
|
if (typeof expObject === 'string') return {
|
|
54
33
|
value: expObject,
|
|
55
34
|
type: _constants.VTL
|
|
56
35
|
};
|
|
57
36
|
console.warn("Non-VTL compatible expression : ".concat(expObject));
|
|
58
37
|
}
|
|
59
|
-
|
|
60
38
|
function createBindings(variables) {
|
|
61
39
|
return Object.entries(variables).reduce(function (bindings, _ref) {
|
|
62
40
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
41
|
+
name = _ref2[0],
|
|
42
|
+
value = _ref2[1].value;
|
|
66
43
|
return _objectSpread(_objectSpread({}, bindings), {}, _defineProperty({}, name, value));
|
|
67
44
|
}, {});
|
|
68
45
|
}
|
|
46
|
+
|
|
69
47
|
/**
|
|
70
48
|
*
|
|
71
49
|
* @param {*} variables
|
|
72
50
|
* @returns
|
|
73
51
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
52
|
function createExecuteExpression(variables, features) {
|
|
77
53
|
// on aimerait map d'expression, avec les bindings
|
|
78
54
|
var bindings = createBindings(variables);
|
|
79
55
|
var tokensMap = new Map();
|
|
80
56
|
var collectedUpdated = new Map();
|
|
81
|
-
|
|
82
57
|
var _createMemoizer = (0, _createMemoizer3["default"])(),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
58
|
+
_createMemoizer2 = _slicedToArray(_createMemoizer, 2),
|
|
59
|
+
memoize = _createMemoizer2[0],
|
|
60
|
+
getMemoizedValue = _createMemoizer2[1];
|
|
87
61
|
var _createRefreshCalcula = (0, _createRefreshCalculated["default"])({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
62
|
+
variables: variables,
|
|
63
|
+
execute: execute,
|
|
64
|
+
bindings: bindings
|
|
65
|
+
}),
|
|
66
|
+
_createRefreshCalcula2 = _slicedToArray(_createRefreshCalcula, 2),
|
|
67
|
+
refreshCalculated = _createRefreshCalcula2[0],
|
|
68
|
+
setToRefreshCalculated = _createRefreshCalcula2[1];
|
|
69
|
+
|
|
95
70
|
/**
|
|
96
71
|
*
|
|
97
72
|
* @param {*} name
|
|
98
73
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
74
|
function pushToLazy(name) {
|
|
102
75
|
var _variables$name$Calcu = variables[name].CalculatedLinked,
|
|
103
|
-
|
|
76
|
+
CalculatedLinked = _variables$name$Calcu === void 0 ? [] : _variables$name$Calcu;
|
|
104
77
|
CalculatedLinked.forEach(function (variable) {
|
|
105
78
|
var name = variable.name;
|
|
106
79
|
setToRefreshCalculated(name, variable);
|
|
107
80
|
});
|
|
108
81
|
}
|
|
82
|
+
|
|
109
83
|
/**
|
|
110
84
|
*
|
|
111
85
|
* @param {*} name
|
|
112
86
|
* @param {*} value
|
|
113
87
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
88
|
function updateBindings(name, value) {
|
|
117
89
|
// update des bindings
|
|
118
90
|
if (name in bindings) {
|
|
119
91
|
bindings[name] = value;
|
|
120
92
|
collectedUpdated.set(name, []);
|
|
121
93
|
}
|
|
122
|
-
|
|
123
94
|
pushToLazy(name);
|
|
124
95
|
}
|
|
96
|
+
|
|
125
97
|
/**
|
|
126
98
|
*
|
|
127
99
|
* @param {*} variables
|
|
128
100
|
* @param {*} iteration
|
|
129
101
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
102
|
function setLoopBindings(variables, iteration) {
|
|
133
103
|
Object.entries(bindings).forEach(function (_ref3) {
|
|
134
104
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
105
|
+
k = _ref4[0],
|
|
106
|
+
v = _ref4[1];
|
|
138
107
|
var _variables$k = variables[k],
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
108
|
+
type = _variables$k.type,
|
|
109
|
+
value = _variables$k.value;
|
|
142
110
|
if (!Array.isArray(v) && type === _constants.COLLECTED && Array.isArray(value)) {
|
|
143
111
|
bindings[k] = value[iteration];
|
|
144
112
|
pushToLazy(k);
|
|
145
113
|
}
|
|
146
114
|
});
|
|
147
115
|
}
|
|
116
|
+
|
|
148
117
|
/**
|
|
149
118
|
*
|
|
150
119
|
* @param {*} variables
|
|
151
120
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
121
|
function resetLoopBindings(variables) {
|
|
155
122
|
Object.entries(bindings).forEach(function (_ref5) {
|
|
156
123
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
124
|
+
k = _ref6[0],
|
|
125
|
+
v = _ref6[1];
|
|
160
126
|
var _variables$k2 = variables[k],
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
127
|
+
type = _variables$k2.type,
|
|
128
|
+
value = _variables$k2.value;
|
|
164
129
|
if (type === _constants.COLLECTED && Array.isArray(value) && !Array.isArray(v)) {
|
|
165
130
|
bindings[k] = value;
|
|
166
131
|
}
|
|
167
132
|
});
|
|
168
133
|
}
|
|
169
|
-
|
|
170
134
|
function getVariablesAndCach(expression) {
|
|
171
135
|
if (tokensMap.has(expression)) {
|
|
172
136
|
return tokensMap.get(expression);
|
|
173
137
|
}
|
|
174
|
-
|
|
175
138
|
var tokens = (0, _getExpressionsVariables["default"])(expression, variables);
|
|
176
139
|
tokensMap.set(expression, tokens);
|
|
177
140
|
return tokens;
|
|
178
141
|
}
|
|
179
|
-
/**/
|
|
180
|
-
|
|
181
142
|
|
|
143
|
+
/**/
|
|
182
144
|
function collecteVariables(dependencies) {
|
|
183
145
|
if (Array.isArray(dependencies)) {
|
|
184
146
|
return dependencies.reduce(function (map, name) {
|
|
185
147
|
if (name in variables) {
|
|
186
148
|
var data = variables[name];
|
|
187
149
|
var variable = data.variable,
|
|
188
|
-
|
|
189
|
-
|
|
150
|
+
type = data.type;
|
|
190
151
|
if (!(name in map)) {
|
|
191
152
|
if (type === 'CALCULATED') {
|
|
192
153
|
var expression = variable.expression;
|
|
193
154
|
var subDependencies = getVariablesAndCach(expression);
|
|
194
155
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, name, _objectSpread({}, variable)), collecteVariables(subDependencies));
|
|
195
156
|
}
|
|
196
|
-
|
|
197
157
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, name, _objectSpread({}, variable)));
|
|
198
158
|
}
|
|
199
159
|
} else {
|
|
200
160
|
throw new Error("Unknown variable ".concat(name));
|
|
201
161
|
}
|
|
202
|
-
|
|
203
162
|
return map;
|
|
204
163
|
}, {});
|
|
205
164
|
}
|
|
206
|
-
|
|
207
165
|
return {};
|
|
208
166
|
}
|
|
209
|
-
|
|
210
167
|
function resolveUseContext(name, _ref7) {
|
|
211
168
|
var iteration = _ref7.iteration,
|
|
212
|
-
|
|
169
|
+
linksIterations = _ref7.linksIterations;
|
|
213
170
|
var value = bindings[name];
|
|
214
|
-
|
|
215
171
|
if ([_constants.X_AXIS, _constants.Y_AXIS].includes(name) && linksIterations !== undefined) {
|
|
216
172
|
pushToLazy(name);
|
|
217
|
-
|
|
218
173
|
var _linksIterations = _slicedToArray(linksIterations, 2),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
174
|
+
x = _linksIterations[0],
|
|
175
|
+
y = _linksIterations[1];
|
|
222
176
|
if (Array.isArray(value) && x < value.length) {
|
|
223
177
|
return value[name === _constants.X_AXIS ? x : y];
|
|
224
178
|
}
|
|
225
|
-
|
|
226
179
|
return null;
|
|
227
180
|
}
|
|
228
|
-
|
|
229
181
|
if (iteration !== undefined && Array.isArray(value)) {
|
|
230
182
|
pushToLazy(name);
|
|
231
|
-
|
|
232
183
|
if (iteration < value.length) {
|
|
233
184
|
return value[iteration];
|
|
234
185
|
}
|
|
235
|
-
|
|
236
186
|
return null;
|
|
237
187
|
}
|
|
238
|
-
|
|
188
|
+
if (linksIterations !== undefined) {
|
|
189
|
+
var _linksIterations2 = _slicedToArray(linksIterations, 2),
|
|
190
|
+
_x = _linksIterations2[0],
|
|
191
|
+
_y = _linksIterations2[1];
|
|
192
|
+
// console.log({ name, linksIterations, value });
|
|
193
|
+
if (Array.isArray(value) && _x < value.length) {
|
|
194
|
+
var sub = value[_x];
|
|
195
|
+
if (Array.isArray(sub) && _y < sub.length) {
|
|
196
|
+
return sub[_y];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
239
201
|
return (0, _vtl["default"])(value);
|
|
240
202
|
}
|
|
241
|
-
|
|
242
203
|
function fillVariablesValues(map, _ref8) {
|
|
243
204
|
var iteration = _ref8.iteration,
|
|
244
|
-
|
|
205
|
+
linksIterations = _ref8.linksIterations;
|
|
245
206
|
return Object.entries(map).reduce(function (sub, _ref9) {
|
|
246
207
|
var _ref10 = _slicedToArray(_ref9, 2),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
208
|
+
name = _ref10[0],
|
|
209
|
+
_ = _ref10[1];
|
|
250
210
|
return _objectSpread(_objectSpread({}, sub), {}, _defineProperty({}, name, resolveUseContext(name, {
|
|
251
211
|
iteration: iteration,
|
|
252
212
|
linksIterations: linksIterations
|
|
253
213
|
})));
|
|
254
214
|
}, {});
|
|
255
215
|
}
|
|
216
|
+
|
|
256
217
|
/**
|
|
257
218
|
*
|
|
258
219
|
* @param {*} vtlObject
|
|
259
220
|
* @param {*} args
|
|
260
221
|
* @returns
|
|
261
222
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
264
223
|
function execute(expObject) {
|
|
265
224
|
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
266
|
-
|
|
267
225
|
var _validateExpression = validateExpression((0, _getSafetyExpression["default"])(expObject)),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
226
|
+
expression = _validateExpression.value,
|
|
227
|
+
type = _validateExpression.type;
|
|
271
228
|
var iteration = args.iteration,
|
|
272
|
-
|
|
273
|
-
|
|
229
|
+
linksIterations = args.linksIterations,
|
|
230
|
+
logging = args.logging;
|
|
274
231
|
var bindingDependencies = getVariablesAndCach(expression);
|
|
275
|
-
|
|
276
232
|
function loggingDefault(_, bindings, e) {
|
|
277
233
|
if (process.env.NODE_ENV === 'development') {
|
|
278
234
|
console.warn("VTL error : ".concat(expression), _objectSpread({}, args), {
|
|
@@ -281,7 +237,6 @@ function createExecuteExpression(variables, features) {
|
|
|
281
237
|
console.warn(e);
|
|
282
238
|
}
|
|
283
239
|
}
|
|
284
|
-
|
|
285
240
|
var vtlBindings = refreshCalculated(fillVariablesValues(collecteVariables(bindingDependencies), {
|
|
286
241
|
iteration: iteration,
|
|
287
242
|
linksIterations: linksIterations
|
|
@@ -291,18 +246,14 @@ function createExecuteExpression(variables, features) {
|
|
|
291
246
|
linksIterations: linksIterations
|
|
292
247
|
});
|
|
293
248
|
var memoized = getMemoizedValue(expression, vtlBindings);
|
|
294
|
-
|
|
295
249
|
if (memoized === undefined) {
|
|
296
250
|
var result = (0, _executeExpression["default"])(vtlBindings, expression, type, features, logging || loggingDefault);
|
|
297
251
|
memoize(expression, vtlBindings, result);
|
|
298
252
|
return result;
|
|
299
253
|
}
|
|
300
|
-
|
|
301
254
|
return memoized;
|
|
302
255
|
}
|
|
303
|
-
|
|
304
256
|
return [execute, updateBindings, setLoopBindings, resetLoopBindings];
|
|
305
257
|
}
|
|
306
|
-
|
|
307
258
|
var _default = createExecuteExpression;
|
|
308
259
|
exports["default"] = _default;
|
|
@@ -4,75 +4,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _objectHash = _interopRequireDefault(require("object-hash"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
|
|
18
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
|
|
20
13
|
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
|
-
|
|
22
14
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
-
|
|
24
15
|
function _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; }
|
|
25
|
-
|
|
26
16
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
27
|
-
|
|
28
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
|
|
30
18
|
function createMemoizer() {
|
|
31
19
|
var expresionsMap = new Map();
|
|
32
|
-
|
|
33
20
|
function refillBindings(bindings) {
|
|
34
21
|
return Object.entries(bindings).reduce(function (map, _ref) {
|
|
35
22
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
key = _ref2[0],
|
|
24
|
+
value = _ref2[1];
|
|
39
25
|
var dataPointsValue = value === null || value === void 0 ? void 0 : value.result;
|
|
40
|
-
|
|
41
26
|
if (dataPointsValue) {
|
|
42
27
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, dataPointsValue));
|
|
43
28
|
}
|
|
44
|
-
|
|
45
29
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, value));
|
|
46
30
|
}, {});
|
|
47
31
|
}
|
|
48
|
-
|
|
49
32
|
function memoize(expression, bindings, value) {
|
|
50
33
|
var refill = refillBindings(bindings);
|
|
51
34
|
var hash = (0, _objectHash["default"])(refill);
|
|
52
35
|
var map = expresionsMap.get(expression);
|
|
53
|
-
|
|
54
36
|
if (!map) {
|
|
55
37
|
map = new Map();
|
|
56
38
|
expresionsMap.set(expression, map);
|
|
57
39
|
}
|
|
58
|
-
|
|
59
40
|
map.set(hash, value);
|
|
60
41
|
}
|
|
61
|
-
|
|
62
42
|
function getMemoizedValue(expression, bindings) {
|
|
63
43
|
var map = expresionsMap.get(expression);
|
|
64
|
-
|
|
65
44
|
if (map) {
|
|
66
45
|
var refill = refillBindings(bindings);
|
|
67
46
|
var hash = (0, _objectHash["default"])(refill);
|
|
68
47
|
return map.get(hash);
|
|
69
48
|
}
|
|
70
|
-
|
|
71
49
|
return undefined;
|
|
72
50
|
}
|
|
73
|
-
|
|
74
51
|
return [memoize, getMemoizedValue];
|
|
75
52
|
}
|
|
76
|
-
|
|
77
53
|
var _default = createMemoizer;
|
|
78
54
|
exports["default"] = _default;
|