@inseefr/lunatic 2.0.4-v2 → 2.0.6-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 +3 -14
- 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 +34 -66
- 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 +6 -22
- 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 +4 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-change.js +4 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-delete.js +4 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-focus.js +4 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-init.js +8 -14
- 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 +4 -9
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-up.js +4 -9
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-end.js +4 -7
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-enter.js +4 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-escape.js +4 -6
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-home.js +4 -7
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-tab.js +4 -6
- 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 +4 -6
- 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 +20 -46
- package/lib/components/commons/components/dragger/index.js +0 -2
- package/lib/components/commons/components/errors/errors.js +4 -18
- 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 +8 -27
- 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 +6 -14
- 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 +18 -35
- 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 +9 -33
- 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 +11 -31
- 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 +18 -52
- 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 +11 -21
- 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 +32 -63
- 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 +17 -38
- 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 +14 -26
- 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 +25 -54
- 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 +7 -13
- 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 +6 -29
- 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 +72 -0
- package/lib/components/{pairwise/links → pairwise-links}/pairwise-links.js +20 -27
- package/lib/components/{pairwise/links → pairwise-links}/row.js +51 -66
- 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 +14 -48
- 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 +14 -34
- 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 +21 -55
- package/lib/components/suggester-loader-widget/index.js +0 -2
- package/lib/components/suggester-loader-widget/loader-row.js +13 -40
- package/lib/components/suggester-loader-widget/loader.js +15 -56
- 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 +24 -54
- 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 +14 -34
- 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 +5 -11
- package/lib/i18n/dictionary.js +8 -0
- 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 +55 -93
- 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 +4 -13
- 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 +4 -12
- package/lib/stories/questionnaires/logement/data.json +6 -11
- package/lib/stories/questionnaires/logement/logement.stories.js +4 -15
- package/lib/stories/questionnaires/recensement/data.json +12 -0
- package/lib/stories/questionnaires/recensement/recensement.stories.js +58 -0
- package/lib/stories/questionnaires/recensement/source.json +15202 -0
- package/lib/stories/questionnaires/rp/data.json +5 -0
- package/lib/stories/questionnaires/rp/rp.stories.js +36 -0
- package/lib/stories/questionnaires/rp/source.json +262 -0
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +4 -12
- package/lib/stories/questionnaires-test/controls/controls.stories.js +4 -16
- package/lib/stories/questionnaires-test/test.stories.js +4 -16
- package/lib/stories/radio/radio.stories.js +0 -8
- package/lib/stories/roster-for-loop/roster-for-loop.stories.js +8 -9
- package/lib/stories/roster-for-loop/source-with-header.json +127 -0
- package/lib/stories/suggester/suggester-workers.stories.js +12 -53
- package/lib/stories/suggester/suggester.stories.js +0 -10
- package/lib/stories/switch/SwitchMaterialUI.js +5 -15
- package/lib/stories/switch/switch.js +4 -27
- package/lib/stories/table/table.stories.js +0 -16
- package/lib/stories/utils/default-arg-types.js +4 -5
- package/lib/stories/utils/orchestrator.js +61 -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 +20 -44
- package/lib/use-lunatic/commons/check-loops.js +14 -38
- package/lib/use-lunatic/commons/compose.js +0 -4
- package/lib/use-lunatic/commons/create-map-pages.js +6 -27
- package/lib/use-lunatic/commons/execute-condition-filter.js +0 -7
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +64 -107
- package/lib/use-lunatic/commons/execute-expression/create-memoizer.js +7 -28
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +23 -45
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +10 -41
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.js +2 -16
- package/lib/use-lunatic/commons/execute-expression/get-safety-expression.js +5 -12
- package/lib/use-lunatic/commons/execute-expression/index.js +0 -2
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +20 -46
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js +4 -8
- package/lib/use-lunatic/commons/fill-components/fill-components.js +0 -13
- package/lib/use-lunatic/commons/fill-components/fill-errors.js +4 -8
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +6 -8
- package/lib/use-lunatic/commons/fill-components/fill-management.js +4 -8
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +5 -10
- package/lib/use-lunatic/commons/fill-components/fill-pagination.js +4 -6
- 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 +26 -66
- package/lib/use-lunatic/commons/get-component-value/index.js +0 -2
- package/lib/use-lunatic/commons/get-components-from-state.js +10 -14
- package/lib/use-lunatic/commons/get-data.js +16 -31
- package/lib/use-lunatic/commons/get-errors-without-empty-value.js +3 -12
- 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 +9 -54
- package/lib/use-lunatic/commons/page-tag.js +11 -34
- package/lib/use-lunatic/commons/use-components-from-state.js +12 -20
- 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 +4 -16
- package/lib/use-lunatic/reducer/index.js +0 -2
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +21 -56
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +29 -49
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +8 -19
- package/lib/use-lunatic/reducer/reduce-handle-change/index.js +0 -2
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +13 -29
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +28 -41
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +58 -30
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +13 -33
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +24 -43
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +11 -20
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +5 -9
- package/lib/use-lunatic/reducer/reduce-on-init.js +55 -98
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +4 -6
- package/lib/use-lunatic/reducer/reducer.js +0 -20
- package/lib/use-lunatic/reducer/validate-controls/create-controls-reducer.js +13 -22
- package/lib/use-lunatic/reducer/validate-controls/create-modal-controls-reducer.js +11 -27
- 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 +61 -106
- 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 +15 -38
- 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 +10 -51
- 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 +5 -27
- 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 +10 -36
- package/lib/utils/suggester-workers/append-to-index/store-messages.js +4 -7
- package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +4 -20
- package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +16 -42
- package/lib/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +4 -15
- 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 +4 -15
- 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 +4 -22
- 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 +10 -28
- 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 +6 -23
- package/lib/utils/suggester-workers/find-best-label/tokenize.spec.js +0 -2
- package/lib/utils/suggester-workers/searching/compute-score.js +4 -16
- 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 +6 -41
- 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,25 @@ 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
|
-
|
|
9
|
+
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); }
|
|
12
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
-
|
|
14
11
|
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
12
|
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
13
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
|
|
20
14
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
-
|
|
22
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; }
|
|
23
|
-
|
|
24
16
|
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
17
|
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
|
-
function
|
|
29
|
-
|
|
18
|
+
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; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
21
|
function isUnpaginated(questionnaire) {
|
|
31
22
|
var maxPage = questionnaire.maxPage;
|
|
32
23
|
return maxPage === undefined;
|
|
33
24
|
}
|
|
25
|
+
|
|
34
26
|
/**
|
|
35
27
|
*
|
|
36
28
|
* @param {*} component: object
|
|
@@ -38,15 +30,12 @@ function isUnpaginated(questionnaire) {
|
|
|
38
30
|
* @param {*} map Map<page,{ components: Array<component>, isLoop: boolean, subPages: Array<page> }>
|
|
39
31
|
* @returns
|
|
40
32
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
33
|
function mergeComponent(component, page, map) {
|
|
44
34
|
if (!page) {
|
|
45
35
|
return _objectSpread(_objectSpread({}, map), {}, {
|
|
46
36
|
unpaged: [].concat(_toConsumableArray(map.unpaged), [component])
|
|
47
37
|
});
|
|
48
38
|
}
|
|
49
|
-
|
|
50
39
|
if (page in map) {
|
|
51
40
|
var current = map[page];
|
|
52
41
|
var components = current.components;
|
|
@@ -54,20 +43,16 @@ function mergeComponent(component, page, map) {
|
|
|
54
43
|
components: [].concat(_toConsumableArray(components), [component])
|
|
55
44
|
})));
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, page, {
|
|
59
47
|
components: [component]
|
|
60
48
|
}));
|
|
61
49
|
}
|
|
62
|
-
|
|
63
50
|
function mergeNestedComponents(components, map) {
|
|
64
51
|
return components.reduce(function (current, component) {
|
|
65
52
|
var page = component.page;
|
|
66
|
-
|
|
67
53
|
if (page) {
|
|
68
54
|
return mergeComponent(component, page, current);
|
|
69
55
|
}
|
|
70
|
-
|
|
71
56
|
return current;
|
|
72
57
|
}, map);
|
|
73
58
|
}
|
|
@@ -76,11 +61,8 @@ function mergeNestedComponents(components, map) {
|
|
|
76
61
|
* @param {*} components
|
|
77
62
|
* @returns
|
|
78
63
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
64
|
function createPages(questionnaire) {
|
|
82
65
|
var components = questionnaire.components;
|
|
83
|
-
|
|
84
66
|
if (isUnpaginated(questionnaire)) {
|
|
85
67
|
return {
|
|
86
68
|
1: {
|
|
@@ -91,18 +73,15 @@ function createPages(questionnaire) {
|
|
|
91
73
|
|
|
92
74
|
var map = components.reduce(function (current, component) {
|
|
93
75
|
var components = component.components,
|
|
94
|
-
|
|
95
|
-
|
|
76
|
+
page = component.page;
|
|
96
77
|
if ((0, _isPaginatedLoop["default"])(component)) {
|
|
97
78
|
return mergeComponent(component, page, mergeNestedComponents(components, current));
|
|
98
79
|
}
|
|
99
|
-
|
|
100
80
|
return mergeComponent(component, page, current);
|
|
101
81
|
}, {
|
|
102
82
|
unpaged: []
|
|
103
83
|
});
|
|
104
84
|
return map;
|
|
105
85
|
}
|
|
106
|
-
|
|
107
86
|
var _default = createPages;
|
|
108
87
|
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,237 @@ 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
|
-
function
|
|
29
|
-
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
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); }
|
|
30
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
-
|
|
32
21
|
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
22
|
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
23
|
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
|
-
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
|
-
|
|
24
|
+
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; } }
|
|
40
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
-
|
|
42
26
|
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
27
|
function validateExpression(expObject) {
|
|
45
28
|
if (_typeof(expObject) === 'object') {
|
|
46
29
|
var type = expObject.type;
|
|
47
|
-
|
|
48
30
|
if (type === _constants.VTL || type === _constants.VTL_MD) {
|
|
49
31
|
return expObject;
|
|
50
32
|
}
|
|
51
33
|
}
|
|
52
|
-
|
|
53
34
|
if (typeof expObject === 'string') return {
|
|
54
35
|
value: expObject,
|
|
55
36
|
type: _constants.VTL
|
|
56
37
|
};
|
|
57
38
|
console.warn("Non-VTL compatible expression : ".concat(expObject));
|
|
58
39
|
}
|
|
59
|
-
|
|
60
40
|
function createBindings(variables) {
|
|
61
41
|
return Object.entries(variables).reduce(function (bindings, _ref) {
|
|
62
42
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
43
|
+
name = _ref2[0],
|
|
44
|
+
value = _ref2[1].value;
|
|
66
45
|
return _objectSpread(_objectSpread({}, bindings), {}, _defineProperty({}, name, value));
|
|
67
46
|
}, {});
|
|
68
47
|
}
|
|
48
|
+
|
|
69
49
|
/**
|
|
70
50
|
*
|
|
71
51
|
* @param {*} variables
|
|
72
52
|
* @returns
|
|
73
53
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
54
|
function createExecuteExpression(variables, features) {
|
|
77
55
|
// on aimerait map d'expression, avec les bindings
|
|
78
56
|
var bindings = createBindings(variables);
|
|
79
57
|
var tokensMap = new Map();
|
|
80
58
|
var collectedUpdated = new Map();
|
|
81
|
-
|
|
82
59
|
var _createMemoizer = (0, _createMemoizer3["default"])(),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
60
|
+
_createMemoizer2 = _slicedToArray(_createMemoizer, 2),
|
|
61
|
+
memoize = _createMemoizer2[0],
|
|
62
|
+
getMemoizedValue = _createMemoizer2[1];
|
|
87
63
|
var _createRefreshCalcula = (0, _createRefreshCalculated["default"])({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
64
|
+
variables: variables,
|
|
65
|
+
execute: execute,
|
|
66
|
+
bindings: bindings
|
|
67
|
+
}),
|
|
68
|
+
_createRefreshCalcula2 = _slicedToArray(_createRefreshCalcula, 2),
|
|
69
|
+
refreshCalculated = _createRefreshCalcula2[0],
|
|
70
|
+
setToRefreshCalculated = _createRefreshCalcula2[1];
|
|
71
|
+
|
|
95
72
|
/**
|
|
96
73
|
*
|
|
97
74
|
* @param {*} name
|
|
98
75
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
76
|
function pushToLazy(name) {
|
|
102
|
-
|
|
77
|
+
if (name in variables) {
|
|
78
|
+
var _variables$name$Calcu = variables[name].CalculatedLinked,
|
|
103
79
|
CalculatedLinked = _variables$name$Calcu === void 0 ? [] : _variables$name$Calcu;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
80
|
+
CalculatedLinked.forEach(function (variable) {
|
|
81
|
+
var name = variable.name;
|
|
82
|
+
setToRefreshCalculated(name, variable);
|
|
83
|
+
});
|
|
84
|
+
} else {
|
|
85
|
+
console.warn("".concat(name, " is not identified as varaible!"));
|
|
86
|
+
}
|
|
108
87
|
}
|
|
88
|
+
|
|
109
89
|
/**
|
|
110
90
|
*
|
|
111
91
|
* @param {*} name
|
|
112
92
|
* @param {*} value
|
|
113
93
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
94
|
function updateBindings(name, value) {
|
|
117
95
|
// update des bindings
|
|
118
96
|
if (name in bindings) {
|
|
119
97
|
bindings[name] = value;
|
|
120
98
|
collectedUpdated.set(name, []);
|
|
121
99
|
}
|
|
122
|
-
|
|
123
100
|
pushToLazy(name);
|
|
124
101
|
}
|
|
102
|
+
|
|
125
103
|
/**
|
|
126
104
|
*
|
|
127
105
|
* @param {*} variables
|
|
128
106
|
* @param {*} iteration
|
|
129
107
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
108
|
function setLoopBindings(variables, iteration) {
|
|
133
109
|
Object.entries(bindings).forEach(function (_ref3) {
|
|
134
110
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
111
|
+
k = _ref4[0],
|
|
112
|
+
v = _ref4[1];
|
|
138
113
|
var _variables$k = variables[k],
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
114
|
+
type = _variables$k.type,
|
|
115
|
+
value = _variables$k.value;
|
|
142
116
|
if (!Array.isArray(v) && type === _constants.COLLECTED && Array.isArray(value)) {
|
|
143
117
|
bindings[k] = value[iteration];
|
|
144
118
|
pushToLazy(k);
|
|
145
119
|
}
|
|
146
120
|
});
|
|
147
121
|
}
|
|
122
|
+
|
|
148
123
|
/**
|
|
149
124
|
*
|
|
150
125
|
* @param {*} variables
|
|
151
126
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
127
|
function resetLoopBindings(variables) {
|
|
155
128
|
Object.entries(bindings).forEach(function (_ref5) {
|
|
156
129
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
130
|
+
k = _ref6[0],
|
|
131
|
+
v = _ref6[1];
|
|
160
132
|
var _variables$k2 = variables[k],
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
133
|
+
type = _variables$k2.type,
|
|
134
|
+
value = _variables$k2.value;
|
|
164
135
|
if (type === _constants.COLLECTED && Array.isArray(value) && !Array.isArray(v)) {
|
|
165
136
|
bindings[k] = value;
|
|
166
137
|
}
|
|
167
138
|
});
|
|
168
139
|
}
|
|
169
|
-
|
|
170
140
|
function getVariablesAndCach(expression) {
|
|
171
141
|
if (tokensMap.has(expression)) {
|
|
172
142
|
return tokensMap.get(expression);
|
|
173
143
|
}
|
|
174
|
-
|
|
175
144
|
var tokens = (0, _getExpressionsVariables["default"])(expression, variables);
|
|
176
145
|
tokensMap.set(expression, tokens);
|
|
177
146
|
return tokens;
|
|
178
147
|
}
|
|
179
|
-
/**/
|
|
180
|
-
|
|
181
148
|
|
|
149
|
+
/**/
|
|
182
150
|
function collecteVariables(dependencies) {
|
|
183
151
|
if (Array.isArray(dependencies)) {
|
|
184
152
|
return dependencies.reduce(function (map, name) {
|
|
185
153
|
if (name in variables) {
|
|
186
154
|
var data = variables[name];
|
|
187
155
|
var variable = data.variable,
|
|
188
|
-
|
|
189
|
-
|
|
156
|
+
type = data.type;
|
|
190
157
|
if (!(name in map)) {
|
|
191
158
|
if (type === 'CALCULATED') {
|
|
192
159
|
var expression = variable.expression;
|
|
193
160
|
var subDependencies = getVariablesAndCach(expression);
|
|
194
161
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, name, _objectSpread({}, variable)), collecteVariables(subDependencies));
|
|
195
162
|
}
|
|
196
|
-
|
|
197
163
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, name, _objectSpread({}, variable)));
|
|
198
164
|
}
|
|
199
165
|
} else {
|
|
200
166
|
throw new Error("Unknown variable ".concat(name));
|
|
201
167
|
}
|
|
202
|
-
|
|
203
168
|
return map;
|
|
204
169
|
}, {});
|
|
205
170
|
}
|
|
206
|
-
|
|
207
171
|
return {};
|
|
208
172
|
}
|
|
209
|
-
|
|
210
173
|
function resolveUseContext(name, _ref7) {
|
|
211
174
|
var iteration = _ref7.iteration,
|
|
212
|
-
|
|
175
|
+
linksIterations = _ref7.linksIterations;
|
|
213
176
|
var value = bindings[name];
|
|
214
|
-
|
|
215
177
|
if ([_constants.X_AXIS, _constants.Y_AXIS].includes(name) && linksIterations !== undefined) {
|
|
216
178
|
pushToLazy(name);
|
|
217
|
-
|
|
218
179
|
var _linksIterations = _slicedToArray(linksIterations, 2),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
180
|
+
x = _linksIterations[0],
|
|
181
|
+
y = _linksIterations[1];
|
|
222
182
|
if (Array.isArray(value) && x < value.length) {
|
|
223
183
|
return value[name === _constants.X_AXIS ? x : y];
|
|
224
184
|
}
|
|
225
|
-
|
|
226
185
|
return null;
|
|
227
186
|
}
|
|
228
|
-
|
|
229
187
|
if (iteration !== undefined && Array.isArray(value)) {
|
|
230
188
|
pushToLazy(name);
|
|
231
|
-
|
|
232
189
|
if (iteration < value.length) {
|
|
233
190
|
return value[iteration];
|
|
234
191
|
}
|
|
235
|
-
|
|
236
192
|
return null;
|
|
237
193
|
}
|
|
238
|
-
|
|
194
|
+
if (linksIterations !== undefined) {
|
|
195
|
+
var _linksIterations2 = _slicedToArray(linksIterations, 2),
|
|
196
|
+
_x2 = _linksIterations2[0],
|
|
197
|
+
_y = _linksIterations2[1];
|
|
198
|
+
// console.log({ name, linksIterations, value });
|
|
199
|
+
if (Array.isArray(value) && _x2 < value.length) {
|
|
200
|
+
var sub = value[_x2];
|
|
201
|
+
if (Array.isArray(sub) && _y < sub.length) {
|
|
202
|
+
return sub[_y];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
239
207
|
return (0, _vtl["default"])(value);
|
|
240
208
|
}
|
|
241
|
-
|
|
242
209
|
function fillVariablesValues(map, _ref8) {
|
|
243
210
|
var iteration = _ref8.iteration,
|
|
244
|
-
|
|
211
|
+
linksIterations = _ref8.linksIterations;
|
|
245
212
|
return Object.entries(map).reduce(function (sub, _ref9) {
|
|
246
213
|
var _ref10 = _slicedToArray(_ref9, 2),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
214
|
+
name = _ref10[0],
|
|
215
|
+
_ = _ref10[1];
|
|
250
216
|
return _objectSpread(_objectSpread({}, sub), {}, _defineProperty({}, name, resolveUseContext(name, {
|
|
251
217
|
iteration: iteration,
|
|
252
218
|
linksIterations: linksIterations
|
|
253
219
|
})));
|
|
254
220
|
}, {});
|
|
255
221
|
}
|
|
222
|
+
|
|
256
223
|
/**
|
|
257
224
|
*
|
|
258
225
|
* @param {*} vtlObject
|
|
259
226
|
* @param {*} args
|
|
260
227
|
* @returns
|
|
261
228
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
264
229
|
function execute(expObject) {
|
|
265
230
|
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
266
|
-
|
|
267
231
|
var _validateExpression = validateExpression((0, _getSafetyExpression["default"])(expObject)),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
232
|
+
expression = _validateExpression.value,
|
|
233
|
+
type = _validateExpression.type;
|
|
271
234
|
var iteration = args.iteration,
|
|
272
|
-
|
|
273
|
-
|
|
235
|
+
linksIterations = args.linksIterations,
|
|
236
|
+
logging = args.logging;
|
|
274
237
|
var bindingDependencies = getVariablesAndCach(expression);
|
|
275
|
-
|
|
276
238
|
function loggingDefault(_, bindings, e) {
|
|
277
239
|
if (process.env.NODE_ENV === 'development') {
|
|
278
240
|
console.warn("VTL error : ".concat(expression), _objectSpread({}, args), {
|
|
@@ -281,7 +243,6 @@ function createExecuteExpression(variables, features) {
|
|
|
281
243
|
console.warn(e);
|
|
282
244
|
}
|
|
283
245
|
}
|
|
284
|
-
|
|
285
246
|
var vtlBindings = refreshCalculated(fillVariablesValues(collecteVariables(bindingDependencies), {
|
|
286
247
|
iteration: iteration,
|
|
287
248
|
linksIterations: linksIterations
|
|
@@ -291,18 +252,14 @@ function createExecuteExpression(variables, features) {
|
|
|
291
252
|
linksIterations: linksIterations
|
|
292
253
|
});
|
|
293
254
|
var memoized = getMemoizedValue(expression, vtlBindings);
|
|
294
|
-
|
|
295
255
|
if (memoized === undefined) {
|
|
296
256
|
var result = (0, _executeExpression["default"])(vtlBindings, expression, type, features, logging || loggingDefault);
|
|
297
257
|
memoize(expression, vtlBindings, result);
|
|
298
258
|
return result;
|
|
299
259
|
}
|
|
300
|
-
|
|
301
260
|
return memoized;
|
|
302
261
|
}
|
|
303
|
-
|
|
304
262
|
return [execute, updateBindings, setLoopBindings, resetLoopBindings];
|
|
305
263
|
}
|
|
306
|
-
|
|
307
264
|
var _default = createExecuteExpression;
|
|
308
265
|
exports["default"] = _default;
|
|
@@ -1,78 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _objectHash = _interopRequireDefault(require("object-hash"));
|
|
9
|
-
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
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); }
|
|
18
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
|
|
20
16
|
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
17
|
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
18
|
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
|
-
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
|
-
|
|
19
|
+
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; } }
|
|
28
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
|
|
30
21
|
function createMemoizer() {
|
|
31
22
|
var expresionsMap = new Map();
|
|
32
|
-
|
|
33
23
|
function refillBindings(bindings) {
|
|
34
24
|
return Object.entries(bindings).reduce(function (map, _ref) {
|
|
35
25
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
key = _ref2[0],
|
|
27
|
+
value = _ref2[1];
|
|
39
28
|
var dataPointsValue = value === null || value === void 0 ? void 0 : value.result;
|
|
40
|
-
|
|
41
29
|
if (dataPointsValue) {
|
|
42
30
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, dataPointsValue));
|
|
43
31
|
}
|
|
44
|
-
|
|
45
32
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, value));
|
|
46
33
|
}, {});
|
|
47
34
|
}
|
|
48
|
-
|
|
49
35
|
function memoize(expression, bindings, value) {
|
|
50
36
|
var refill = refillBindings(bindings);
|
|
51
37
|
var hash = (0, _objectHash["default"])(refill);
|
|
52
38
|
var map = expresionsMap.get(expression);
|
|
53
|
-
|
|
54
39
|
if (!map) {
|
|
55
40
|
map = new Map();
|
|
56
41
|
expresionsMap.set(expression, map);
|
|
57
42
|
}
|
|
58
|
-
|
|
59
43
|
map.set(hash, value);
|
|
60
44
|
}
|
|
61
|
-
|
|
62
45
|
function getMemoizedValue(expression, bindings) {
|
|
63
46
|
var map = expresionsMap.get(expression);
|
|
64
|
-
|
|
65
47
|
if (map) {
|
|
66
48
|
var refill = refillBindings(bindings);
|
|
67
49
|
var hash = (0, _objectHash["default"])(refill);
|
|
68
50
|
return map.get(hash);
|
|
69
51
|
}
|
|
70
|
-
|
|
71
52
|
return undefined;
|
|
72
53
|
}
|
|
73
|
-
|
|
74
54
|
return [memoize, getMemoizedValue];
|
|
75
55
|
}
|
|
76
|
-
|
|
77
56
|
var _default = createMemoizer;
|
|
78
57
|
exports["default"] = _default;
|