@inseefr/lunatic 2.0.0-rc9 → 2.0.0-v2test
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/LICENSE +21 -21
- package/README.md +25 -22
- package/lib/components/button/button.scss +24 -0
- package/lib/components/button/index.js +13 -0
- package/lib/components/button/lunatic-button.js +52 -0
- package/lib/components/checkbox/checkbox-boolean/checkbox-boolean.js +29 -0
- package/lib/components/checkbox/checkbox-boolean/index.js +13 -0
- package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +40 -0
- package/lib/components/checkbox/checkbox-group/checkbox-group.js +84 -0
- package/lib/components/checkbox/checkbox-group/checkbox.scss +4 -0
- package/lib/components/checkbox/checkbox-group/index.js +13 -0
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +35 -0
- package/lib/components/checkbox/checkbox-one/index.js +13 -0
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +27 -0
- package/lib/components/checkbox/commons/checkbox-option.js +55 -0
- package/lib/components/checkbox/commons/checkbox-option.scss +3 -0
- package/lib/components/checkbox/commons/index.js +13 -0
- package/lib/components/checkbox/index.js +27 -0
- package/lib/components/commons/build-style-object.js +25 -0
- package/lib/components/commons/components/combo-box/combo-box-container.js +31 -0
- package/lib/components/commons/components/combo-box/combo-box-content.js +60 -0
- package/lib/components/commons/components/combo-box/combo-box.js +190 -0
- package/lib/components/commons/components/combo-box/combo-box.scss +205 -0
- package/lib/components/commons/components/combo-box/index.js +13 -0
- package/lib/components/commons/components/combo-box/panel/index.js +13 -0
- package/lib/components/commons/components/combo-box/panel/option-container.js +62 -0
- package/lib/components/commons/components/combo-box/panel/panel-container.js +26 -0
- package/lib/components/commons/components/combo-box/panel/panel.js +61 -0
- package/lib/components/commons/components/combo-box/selection/delete.js +53 -0
- package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.js +22 -0
- package/lib/components/commons/components/combo-box/selection/index.js +13 -0
- package/lib/components/commons/components/combo-box/selection/input.js +55 -0
- package/lib/components/commons/components/combo-box/selection/label-selection.js +32 -0
- package/lib/components/commons/components/combo-box/selection/selection-container.js +35 -0
- package/lib/components/commons/components/combo-box/selection/selection.js +61 -0
- package/lib/components/commons/components/combo-box/state-management/actions.js +82 -0
- package/lib/components/commons/components/combo-box/state-management/combo-box-context.js +16 -0
- package/lib/components/commons/components/combo-box/state-management/index.js +33 -0
- package/lib/components/commons/components/combo-box/state-management/initial-state.js +14 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/index.js +13 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-blur.js +20 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-change.js +22 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-delete.js +21 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-focus.js +20 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-init.js +40 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/index.js +13 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/keyboard-key-codes.js +18 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-down.js +32 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-up.js +32 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-end.js +25 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-enter.js +21 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-escape.js +20 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-home.js +25 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-tab.js +20 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/reduce-on-keydown.js +40 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reduce-on-select.js +22 -0
- package/lib/components/commons/components/combo-box/state-management/reducer/reducer.js +41 -0
- package/lib/components/commons/components/create-lunatic-component/create-lunatic-component.js +64 -0
- package/lib/components/commons/components/create-lunatic-component/index.js +11 -0
- package/lib/components/commons/components/default-label-renderer.js +44 -0
- package/lib/components/commons/components/default-option-renderer.js +36 -0
- package/lib/components/commons/components/dragger/dragger.js +92 -0
- package/lib/components/commons/components/dragger/dragger.scss +8 -0
- package/lib/components/commons/components/dragger/index.js +13 -0
- package/lib/components/commons/components/errors/errors.js +41 -0
- package/lib/components/commons/components/errors/errors.scss +5 -0
- package/lib/components/commons/components/errors/index.js +13 -0
- package/lib/components/commons/components/fab/fab.js +48 -0
- package/lib/components/commons/components/fab/fab.scss +32 -0
- package/lib/components/commons/components/fab/index.js +13 -0
- package/lib/components/commons/components/field-container/field-container.js +39 -0
- package/lib/components/commons/components/field-container/field-container.scss +0 -0
- package/lib/components/commons/components/field-container/index.js +13 -0
- package/lib/components/commons/components/fieldset.js +18 -0
- package/lib/components/commons/components/fieldset.scss +5 -0
- package/lib/components/commons/components/html-table/index.js +48 -0
- package/lib/components/commons/components/html-table/table.js +29 -0
- package/lib/components/commons/components/html-table/tbody.js +29 -0
- package/lib/components/commons/components/html-table/td.js +41 -0
- package/lib/components/commons/components/html-table/th.js +39 -0
- package/lib/components/commons/components/html-table/thead.js +29 -0
- package/lib/components/commons/components/html-table/tr.js +31 -0
- package/lib/components/commons/components/is-network/index.js +13 -0
- package/lib/components/commons/components/is-network/is-network.js +51 -0
- package/lib/components/commons/components/is-network/use-online-status.js +46 -0
- package/lib/components/commons/components/label.js +27 -0
- package/lib/components/commons/components/lunatic-component.js +55 -0
- package/lib/components/commons/components/lunatic-fieldset-component.js +49 -0
- package/lib/components/commons/components/md-label/index.js +13 -0
- package/lib/components/commons/components/md-label/link.js +51 -0
- package/lib/components/commons/components/md-label/md-label.js +44 -0
- package/lib/components/commons/components/missing/index.js +13 -0
- package/lib/components/commons/components/missing/missing.js +76 -0
- package/lib/components/commons/components/missing/missing.scss +30 -0
- package/lib/components/commons/components/nothing-to-display.js +13 -0
- package/lib/components/commons/components/orchestrated-component.js +59 -0
- package/{src/components/tooltip → lib/components/commons/components/variable-status}/img/edited.png +0 -0
- package/{src/components/tooltip → lib/components/commons/components/variable-status}/img/forced.png +0 -0
- package/lib/components/commons/components/variable-status/img/index.js +20 -0
- package/lib/components/commons/components/variable-status/index.js +13 -0
- package/lib/components/commons/components/variable-status/variable-status.js +78 -0
- package/lib/components/commons/components/variable-status/variable-status.scss +39 -0
- package/lib/components/commons/create-customizable-field.js +26 -0
- package/lib/components/commons/create-row-orchestrator.js +53 -0
- package/lib/components/commons/icons/checkbox-checked.icon.js +36 -0
- package/lib/components/commons/icons/checkbox-unchecked.icon.js +36 -0
- package/lib/components/commons/icons/closed.icon.js +33 -0
- package/lib/components/commons/icons/cross.icon.js +33 -0
- package/lib/components/commons/icons/index.js +76 -0
- package/lib/components/commons/icons/load.icon.js +33 -0
- package/lib/components/commons/icons/lunatic-icon.js +19 -0
- package/lib/components/commons/icons/lunatic-icon.scss +3 -0
- package/lib/components/commons/icons/network.icon.js +33 -0
- package/lib/components/commons/icons/on-drag.icon.js +33 -0
- package/lib/components/commons/icons/opened.icon.js +33 -0
- package/lib/components/commons/icons/radio-checked.icon.js +36 -0
- package/lib/components/commons/icons/radio-unchecked.icon.js +36 -0
- package/lib/components/commons/index.js +138 -0
- package/lib/components/commons/prop-types/declarations.js +19 -0
- package/lib/components/commons/prop-types/index.js +41 -0
- package/lib/components/commons/prop-types/lines.js +13 -0
- package/lib/components/commons/prop-types/options.js +13 -0
- package/lib/components/commons/prop-types/response.js +13 -0
- package/lib/components/commons/prop-types/value-type.js +14 -0
- package/lib/components/commons/safety-label.js +26 -0
- package/lib/components/commons/use-document-add-event-listener.js +84 -0
- package/lib/components/commons/use-on-handle-change.js +19 -0
- package/lib/components/commons/use-options-keydown.js +24 -0
- package/lib/components/commons/use-previous.js +16 -0
- package/lib/components/components.js +163 -0
- package/lib/components/datepicker/datepicker.js +45 -0
- package/lib/components/datepicker/datepicker.scss +1 -0
- package/lib/components/datepicker/index.js +13 -0
- package/lib/components/datepicker/lunatic-datepicker.js +27 -0
- package/lib/components/declarations/declaration.js +19 -0
- package/lib/components/declarations/declarations-after-text.js +20 -0
- package/lib/components/declarations/declarations-before-text.js +20 -0
- package/lib/components/declarations/declarations-detachable.js +20 -0
- package/lib/components/declarations/declarations.js +51 -0
- package/lib/components/declarations/declarations.scss +36 -0
- package/lib/components/declarations/index.js +43 -0
- package/lib/components/dropdown/dropdown-simple/dropdown-simple.js +36 -0
- package/lib/components/dropdown/dropdown-simple/index.js +13 -0
- package/lib/components/dropdown/dropdown-simple/simple-label-renderer.js +43 -0
- package/lib/components/dropdown/dropdown-simple/simple-option-renderer.js +35 -0
- package/lib/components/dropdown/dropdown-writable/dropdown-writable.js +59 -0
- package/lib/components/dropdown/dropdown-writable/filter-tools/filter-options.js +36 -0
- package/lib/components/dropdown/dropdown-writable/filter-tools/letters-matching.js +29 -0
- package/lib/components/dropdown/dropdown-writable/filter-tools/match.js +22 -0
- package/lib/components/dropdown/dropdown-writable/filter-tools/prepare-prefix.js +13 -0
- package/lib/components/dropdown/dropdown-writable/index.js +13 -0
- package/lib/components/dropdown/dropdown-writable/writable-label-renderer.js +43 -0
- package/lib/components/dropdown/dropdown-writable/writable-option-renderer.js +136 -0
- package/lib/components/dropdown/dropdown.js +47 -0
- package/lib/components/dropdown/dropdown.scss +41 -0
- package/lib/components/dropdown/index.js +13 -0
- package/lib/components/dropdown/lunatic-dropdown.js +53 -0
- package/lib/components/filter-description/component.js +20 -0
- package/lib/components/filter-description/index.js +13 -0
- package/lib/components/index.js +28 -0
- package/lib/components/index.scss +136 -0
- package/lib/components/input/index.js +13 -0
- package/lib/components/input/input.js +49 -0
- package/lib/components/input/input.scss +32 -0
- package/lib/components/input/lunatic-input.js +30 -0
- package/lib/components/input-number/index.js +13 -0
- package/lib/components/input-number/input-number.js +51 -0
- package/lib/components/input-number/input-number.scss +7 -0
- package/lib/components/input-number/lunatic-input-number.js +26 -0
- package/lib/components/loop/block-for-loop/block-for-loop-ochestrator.js +12 -0
- package/lib/components/loop/block-for-loop/block-for-loop.js +140 -0
- package/lib/components/loop/block-for-loop/index.js +13 -0
- package/lib/components/loop/block-for-loop/row.js +68 -0
- package/lib/components/loop/commons/get-init-length.js +16 -0
- package/lib/components/loop/commons/handle-row-button.js +20 -0
- package/lib/components/loop/commons/index.js +20 -0
- package/lib/components/loop/commons/row-component.js +65 -0
- package/lib/components/loop/index.js +13 -0
- package/lib/components/loop/loop.js +84 -0
- package/lib/components/loop/roster-for-loop/body.js +57 -0
- package/lib/components/loop/roster-for-loop/header.js +35 -0
- package/lib/components/loop/roster-for-loop/index.js +13 -0
- package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +12 -0
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +124 -0
- package/lib/components/loop/roster-for-loop/roster-table.js +50 -0
- package/lib/components/loop/roster-for-loop/roster.scss +42 -0
- package/lib/components/loop/roster-for-loop/row.js +75 -0
- package/lib/components/modal-controls/close-or-skip.js +40 -0
- package/lib/components/modal-controls/index.js +13 -0
- package/lib/components/modal-controls/modal-container.js +19 -0
- package/lib/components/modal-controls/modal-controls.js +71 -0
- package/lib/components/modal-controls/modal-controls.scss +48 -0
- package/lib/components/pairwise-links/index.js +13 -0
- package/lib/components/pairwise-links/orchestrator.js +72 -0
- package/lib/components/pairwise-links/pairwise-links.js +68 -0
- package/lib/components/pairwise-links/row.js +80 -0
- package/lib/components/radio/index.js +13 -0
- package/lib/components/radio/lunatic-radio-group.js +37 -0
- package/lib/components/radio/radio-group.js +41 -0
- package/lib/components/radio/radio-option.js +80 -0
- package/lib/components/radio/radio.scss +66 -0
- package/lib/components/sequence/index.js +13 -0
- package/lib/components/sequence/sequence.js +33 -0
- package/lib/components/sequence/sequence.scss +10 -0
- package/lib/components/subsequence/index.js +13 -0
- package/lib/components/subsequence/subsequence.js +31 -0
- package/lib/components/suggester/check-store.js +115 -0
- package/lib/components/suggester/default-style.scss +125 -0
- package/lib/components/suggester/find-best-label/find-best-label.js +55 -0
- package/lib/components/suggester/find-best-label/index.js +13 -0
- package/lib/components/suggester/idb-suggester.js +75 -0
- package/lib/components/suggester/index.js +13 -0
- package/lib/components/suggester/lunatic-suggester.js +80 -0
- package/lib/components/suggester/searching/create-searching.js +75 -0
- package/lib/components/suggester/searching/index.js +13 -0
- package/lib/components/suggester/suggester.js +138 -0
- package/lib/components/suggester-loader-widget/index.js +13 -0
- package/lib/components/suggester-loader-widget/loader-row.js +123 -0
- package/lib/components/suggester-loader-widget/loader.js +139 -0
- package/lib/components/suggester-loader-widget/progress.js +38 -0
- package/lib/components/suggester-loader-widget/tools/action-tool.js +28 -0
- package/lib/components/suggester-loader-widget/tools/index.js +20 -0
- package/lib/components/suggester-loader-widget/tools/tools.js +16 -0
- package/lib/components/suggester-loader-widget/widget-container.js +39 -0
- package/lib/components/suggester-loader-widget/widget.js +140 -0
- package/lib/components/suggester-loader-widget/widget.scss +176 -0
- package/lib/components/switch/index.js +13 -0
- package/lib/components/switch/lunatic-switch.js +47 -0
- package/lib/components/switch/switch.js +78 -0
- package/lib/components/switch/switch.scss +47 -0
- package/lib/components/table/cell.js +88 -0
- package/lib/components/table/components/cell.js +88 -0
- package/lib/components/table/components/header.js +41 -0
- package/lib/components/table/components/row.js +41 -0
- package/lib/components/table/components/table.js +31 -0
- package/lib/components/table/components/table.scss +27 -0
- package/lib/components/table/index.js +13 -0
- package/lib/components/table/lunatic-table.js +77 -0
- package/lib/components/table/table-orchestrator.js +47 -0
- package/lib/components/textarea/index.js +13 -0
- package/lib/components/textarea/lunatic-textarea.js +39 -0
- package/lib/components/textarea/textarea.js +42 -0
- package/lib/components/textarea/textarea.scss +8 -0
- package/lib/constants/component-types.js +8 -0
- package/lib/constants/declarations.js +28 -0
- package/lib/constants/event-types.js +29 -0
- package/lib/constants/index.js +60 -0
- package/lib/constants/supported-preferences.js +13 -0
- package/lib/constants/value-types.js +16 -0
- package/lib/constants/variable-types.js +12 -0
- package/lib/i18n/build-dictionary.js +50 -0
- package/lib/i18n/dictionary.js +34 -0
- package/lib/i18n/index.js +13 -0
- package/lib/index.js +21 -4040
- package/lib/stories/Introduction.stories.mdx +114 -0
- package/lib/stories/checkboxBoolean/checkboxBoolean.stories.js +27 -0
- package/lib/stories/checkboxBoolean/source.json +36 -0
- package/lib/stories/checkboxOne/checkboxOne.stories.js +27 -0
- package/lib/stories/checkboxOne/source.json +36 -0
- package/lib/stories/custom-mui/checkbox-boolean-mui.js +31 -0
- package/lib/stories/custom-mui/checkbox-group-mui.js +66 -0
- package/lib/stories/custom-mui/checkbox-one-mui.js +13 -0
- package/lib/stories/custom-mui/index.js +111 -0
- package/lib/stories/custom-mui/input-mui.js +51 -0
- package/lib/stories/custom-mui/input-number-mui.js +39 -0
- package/lib/stories/custom-mui/radio-mui.js +59 -0
- package/lib/stories/custom-mui/suggester-mui/index.js +13 -0
- package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +290 -0
- package/lib/stories/custom-mui/switch-mui.js +41 -0
- package/lib/stories/custom-mui/table-mui.js +25 -0
- package/lib/stories/custom-mui/tbody-mui.js +21 -0
- package/lib/stories/custom-mui/td-mui.js +23 -0
- package/lib/stories/custom-mui/textarea-mui.js +42 -0
- package/lib/stories/custom-mui/th-mui.js +22 -0
- package/lib/stories/custom-mui/thead-mui.js +21 -0
- package/lib/stories/custom-mui/tr-mui.js +31 -0
- package/lib/stories/date-picker/data.json +3 -0
- package/lib/stories/date-picker/datepicker.stories.js +31 -0
- package/lib/stories/date-picker/source.json +91 -0
- package/lib/stories/dropdown/data.json +16 -0
- package/lib/stories/dropdown/dropdown.stories.js +32 -0
- package/lib/stories/dropdown/source.json +122 -0
- package/lib/stories/filter-description/filter-description.stories.js +49 -0
- package/lib/stories/filter-description/source-options.json +81 -0
- package/lib/stories/filter-description/source.json +11 -0
- package/lib/stories/input/data.json +1 -0
- package/lib/stories/input/input.stories.js +29 -0
- package/lib/stories/input/source.json +28 -0
- package/lib/stories/input-number/input-number.stories.js +34 -0
- package/lib/stories/input-number/source-euros.json +38 -0
- package/lib/stories/input-number/source.json +37 -0
- package/lib/stories/pairwise/data.json +12 -0
- package/lib/stories/pairwise/links.json +270 -0
- package/lib/stories/pairwise/pairwise-links.stories.js +30 -0
- package/lib/stories/paste-questionnaire/source.json +6290 -0
- package/lib/stories/paste-questionnaire/test.stories.js +83 -0
- package/lib/stories/questionnaires/logement/data.json +2686 -0
- package/lib/stories/questionnaires/logement/logement.stories.js +75 -0
- package/lib/stories/questionnaires/logement/source-sequence.json +34181 -0
- package/lib/stories/questionnaires/logement/source-sum.json +34612 -0
- package/lib/stories/questionnaires/logement/source.json +34191 -0
- 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 +63 -0
- package/lib/stories/questionnaires/simpsons/source.json +6290 -0
- package/lib/stories/questionnaires-test/V2_DeclarationsSimples.json +848 -0
- package/lib/stories/questionnaires-test/V2_MinMaxSum_Boucles.json +509 -0
- package/lib/stories/questionnaires-test/V2_QuestSimple_Boucles.json +4091 -0
- package/lib/stories/questionnaires-test/V2_TCMRallyeGames.json +2892 -0
- package/lib/stories/questionnaires-test/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +666 -0
- package/lib/stories/questionnaires-test/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +1957 -0
- package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees2_PasPageFin.json +709 -0
- package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees_PasPageFin.json +533 -0
- package/lib/stories/questionnaires-test/controls/boucles-n.json +202 -0
- package/lib/stories/questionnaires-test/controls/controls.stories.js +96 -0
- package/lib/stories/questionnaires-test/test-dylan.json +558 -0
- package/lib/stories/questionnaires-test/test.stories.js +92 -0
- package/lib/stories/radio/radio.stories.js +27 -0
- package/lib/stories/radio/source.json +36 -0
- package/lib/stories/roster-for-loop/roster-for-loop.stories.js +34 -0
- package/lib/stories/roster-for-loop/source-with-header.json +127 -0
- package/lib/stories/roster-for-loop/source.json +114 -0
- package/lib/stories/suggester/source.json +234 -0
- package/lib/stories/suggester/suggester-workers.stories.js +201 -0
- package/lib/stories/suggester/suggester.stories.js +49 -0
- package/{src/stories/checkbox-one → lib/stories/switch}/README.md +31 -31
- package/lib/stories/switch/SwitchMaterialUI.js +41 -0
- package/{src/stories/checkbox-boolean/data.json → lib/stories/switch/data-forced.json} +48 -48
- package/lib/stories/switch/data.json +80 -0
- package/lib/stories/switch/switch.js +85 -0
- package/lib/stories/table/data-roster.json +1 -0
- package/lib/stories/table/data.json +1 -0
- package/{src/stories/table/data-roster.json → lib/stories/table/source-roster.json} +504 -461
- package/{src/stories/table/data-default.json → lib/stories/table/source.json} +19 -19
- package/lib/stories/table/table-dynamique.json +67 -0
- package/lib/stories/table/table.stories.js +57 -0
- package/lib/stories/utils/custom-lunatic.scss +28 -0
- package/lib/stories/utils/default-arg-types.js +22 -0
- package/lib/stories/utils/options.js +32 -0
- package/lib/stories/utils/orchestrator.js +165 -0
- package/lib/stories/utils/waiting/index.js +13 -0
- package/lib/stories/utils/waiting/preloader.svg +1 -0
- package/lib/stories/utils/waiting/waiting.js +30 -0
- package/lib/stories/utils/waiting/waiting.scss +21 -0
- package/lib/tests/sample.spec.js +7 -0
- package/lib/use-lunatic/actions.js +90 -0
- package/lib/use-lunatic/commons/calculated-variables.js +100 -0
- package/lib/use-lunatic/commons/check-loops.js +87 -0
- package/lib/use-lunatic/commons/compose.js +24 -0
- package/lib/use-lunatic/commons/create-map-pages.js +87 -0
- package/lib/use-lunatic/commons/execute-condition-filter.js +27 -0
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +265 -0
- package/lib/use-lunatic/commons/execute-expression/create-memoizer.js +57 -0
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +138 -0
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +87 -0
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.js +37 -0
- package/lib/use-lunatic/commons/execute-expression/get-safety-expression.js +30 -0
- package/lib/use-lunatic/commons/execute-expression/index.js +13 -0
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +123 -0
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js +22 -0
- package/lib/use-lunatic/commons/fill-components/fill-components.js +34 -0
- package/lib/use-lunatic/commons/fill-components/fill-errors.js +27 -0
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +24 -0
- package/lib/use-lunatic/commons/fill-components/fill-management.js +23 -0
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +32 -0
- package/lib/use-lunatic/commons/fill-components/fill-pagination.js +21 -0
- package/lib/use-lunatic/commons/fill-components/index.js +13 -0
- package/lib/use-lunatic/commons/get-compatible-vtl-expression.js +25 -0
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +177 -0
- package/lib/use-lunatic/commons/get-component-value/index.js +13 -0
- package/lib/use-lunatic/commons/get-components-from-state.js +40 -0
- package/lib/use-lunatic/commons/get-data.js +75 -0
- package/lib/use-lunatic/commons/get-errors-without-empty-value.js +22 -0
- package/lib/use-lunatic/commons/index.js +109 -0
- package/lib/use-lunatic/commons/is-First-last-page.js +18 -0
- package/lib/use-lunatic/commons/is-paginated-loop.js +13 -0
- package/lib/use-lunatic/commons/load-suggesters.js +154 -0
- package/lib/use-lunatic/commons/page-tag.js +64 -0
- package/lib/use-lunatic/commons/use-components-from-state.js +41 -0
- package/lib/use-lunatic/index.js +13 -0
- package/lib/use-lunatic/initial-state.js +41 -0
- package/lib/use-lunatic/reducer/commons/index.js +36 -0
- package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +35 -0
- package/lib/use-lunatic/reducer/commons/resize-array-variable.js +38 -0
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.js +29 -0
- package/lib/use-lunatic/reducer/index.js +13 -0
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +183 -0
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +145 -0
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +50 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/index.js +13 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +61 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +129 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +81 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +70 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +99 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +41 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +25 -0
- package/lib/use-lunatic/reducer/reduce-on-init.js +225 -0
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +21 -0
- package/lib/use-lunatic/reducer/reducer.js +38 -0
- package/lib/use-lunatic/reducer/validate-controls/create-controls-reducer.js +60 -0
- package/lib/use-lunatic/reducer/validate-controls/create-modal-controls-reducer.js +84 -0
- package/lib/use-lunatic/reducer/validate-controls/index.js +20 -0
- package/lib/use-lunatic/reducer/validate-controls/validation-utils.js +60 -0
- package/lib/use-lunatic/use-lunatic.js +170 -0
- package/lib/utils/constants/features.js +12 -0
- package/lib/utils/constants/index.js +60 -0
- package/lib/utils/constants/links.js +10 -0
- package/lib/utils/constants/missing.js +10 -0
- package/lib/utils/constants/variable-status.js +16 -0
- package/lib/utils/constants/variable-types.js +8 -0
- package/lib/utils/idb-tools/clear-store.js +42 -0
- package/lib/utils/idb-tools/create-db-opener.js +47 -0
- package/lib/utils/idb-tools/create-open-db.js +29 -0
- package/lib/utils/idb-tools/get-entity.js +21 -0
- package/lib/utils/idb-tools/get-idb.js +13 -0
- package/lib/utils/idb-tools/idb-bulk-insert.js +134 -0
- package/lib/utils/idb-tools/index.js +64 -0
- package/lib/utils/idb-tools/insert-entity.js +21 -0
- package/lib/utils/idb-tools/open-db.js +24 -0
- package/lib/utils/idb-tools/open-or-create-db.js +42 -0
- package/lib/utils/is-element.js +10 -0
- package/lib/utils/store-tools/auto-load.js +168 -0
- package/lib/utils/store-tools/clear-store-data.js +35 -0
- package/lib/utils/store-tools/clear-store-info.js +35 -0
- package/lib/utils/store-tools/constantes.js +31 -0
- package/lib/utils/store-tools/create/create.js +53 -0
- package/lib/utils/store-tools/create/index.js +20 -0
- package/lib/utils/store-tools/create/update-store-info.js +27 -0
- package/lib/utils/store-tools/get-store-count.js +24 -0
- package/lib/utils/store-tools/index.js +54 -0
- package/lib/utils/store-tools/open-or-create-store.js +50 -0
- package/lib/utils/store-tools/use-store-index.js +60 -0
- package/lib/utils/suggester-workers/append-to-index/append.js +80 -0
- package/lib/utils/suggester-workers/append-to-index/append.worker.js +27 -0
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +58 -0
- package/lib/utils/suggester-workers/append-to-index/index.js +20 -0
- package/lib/utils/suggester-workers/append-to-index/prepare-entities.js +88 -0
- package/lib/utils/suggester-workers/append-to-index/store-messages.js +45 -0
- package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +54 -0
- package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +77 -0
- package/lib/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +36 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +21 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +36 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.spec.js +14 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.js +19 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-accents.spec.js +16 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.js +25 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +23 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.js +15 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +23 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.js +23 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.spec.js +16 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +53 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +14 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +16 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +14 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/index.js +20 -0
- package/lib/utils/suggester-workers/commons-tokenizer/filters/stop-words.js +9 -0
- package/lib/utils/suggester-workers/commons-tokenizer/get-regexp-from-pattern.js +14 -0
- package/lib/utils/suggester-workers/commons-tokenizer/get-stemmer.js +23 -0
- package/lib/utils/suggester-workers/commons-tokenizer/index.js +69 -0
- package/lib/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +18 -0
- package/lib/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +12 -0
- package/lib/utils/suggester-workers/create-worker.js +54 -0
- package/lib/utils/suggester-workers/find-best-label/find-best-label.js +63 -0
- package/lib/utils/suggester-workers/find-best-label/find-best-label.worker.js +53 -0
- package/lib/utils/suggester-workers/find-best-label/index.js +1 -0
- package/lib/utils/suggester-workers/find-best-label/tokenize.js +45 -0
- package/lib/utils/suggester-workers/find-best-label/tokenize.spec.js +24 -0
- package/lib/utils/suggester-workers/searching/compute-score.js +51 -0
- package/lib/utils/suggester-workers/searching/get-db.js +50 -0
- package/lib/utils/suggester-workers/searching/index.js +13 -0
- package/lib/utils/suggester-workers/searching/order/create-alphanumeric-orderer.js +28 -0
- package/lib/utils/suggester-workers/searching/order/index.js +25 -0
- package/lib/utils/suggester-workers/searching/query-parser/index.js +20 -0
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.js +12 -0
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-soft.spec.js +26 -0
- package/lib/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +35 -0
- package/lib/utils/suggester-workers/searching/resolve-query-parser.js +59 -0
- package/lib/utils/suggester-workers/searching/search-in-index.js +22 -0
- package/lib/utils/suggester-workers/searching/searching.js +135 -0
- package/lib/utils/suggester-workers/searching/searching.worker.js +20 -0
- package/lib/utils/vtl/dataset-builder.js +24 -0
- package/lib/utils/vtl/index.js +13 -0
- package/package.json +163 -140
- package/lib/index.js.map +0 -1
- package/src/components/breadcrumb/breadcrumb.scss +0 -22
- package/src/components/breadcrumb/component.js +0 -29
- package/src/components/breadcrumb/index.js +0 -1
- package/src/components/button/button.scss +0 -26
- package/src/components/button/component.js +0 -25
- package/src/components/button/index.js +0 -1
- package/src/components/checkbox/boolean.js +0 -139
- package/src/components/checkbox/checkbox.scss +0 -43
- package/src/components/checkbox/group.js +0 -168
- package/src/components/checkbox/index.js +0 -3
- package/src/components/checkbox/one.js +0 -27
- package/src/components/components.js +0 -15
- package/src/components/datepicker/component.js +0 -10
- package/src/components/datepicker/datepicker.scss +0 -16
- package/src/components/datepicker/index.js +0 -1
- package/src/components/declarations/component.js +0 -38
- package/src/components/declarations/declarations.scss +0 -34
- package/src/components/declarations/index.js +0 -1
- package/src/components/declarations/wrappers/index.js +0 -3
- package/src/components/declarations/wrappers/input-declarations-wrapper.js +0 -162
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +0 -159
- package/src/components/declarations/wrappers/simple-declarations-wrapper.js +0 -54
- package/src/components/dropdown/commons/actions.js +0 -56
- package/src/components/dropdown/commons/children-to-option.js +0 -9
- package/src/components/dropdown/commons/cleaner-callbacks.js +0 -58
- package/src/components/dropdown/commons/components/closed.icon.js +0 -24
- package/src/components/dropdown/commons/components/dropdown-container.js +0 -169
- package/src/components/dropdown/commons/components/label.js +0 -21
- package/src/components/dropdown/commons/components/opened.icon.js +0 -24
- package/src/components/dropdown/commons/components/panel.js +0 -78
- package/src/components/dropdown/commons/event-callbacks/index.js +0 -5
- package/src/components/dropdown/commons/event-callbacks/on-keydown-callback.js +0 -30
- package/src/components/dropdown/commons/event-callbacks/on-mousedown-callback.js +0 -11
- package/src/components/dropdown/commons/reducer.js +0 -149
- package/src/components/dropdown/commons/tools/index.js +0 -17
- package/src/components/dropdown/component.js +0 -117
- package/src/components/dropdown/dropdown-edit/cross.icon.js +0 -20
- package/src/components/dropdown/dropdown-edit/dropdown-edit.js +0 -174
- package/src/components/dropdown/dropdown-edit/icone.js +0 -33
- package/src/components/dropdown/dropdown-edit/index.js +0 -11
- package/src/components/dropdown/dropdown-edit/option.js +0 -62
- package/src/components/dropdown/dropdown-edit/prefix-tools.js +0 -51
- package/src/components/dropdown/dropdown-simple/dropdown.js +0 -155
- package/src/components/dropdown/dropdown-simple/index.js +0 -20
- package/src/components/dropdown/dropdown-simple/option.js +0 -15
- package/src/components/dropdown/dropdown.scss +0 -183
- package/src/components/dropdown/index.js +0 -1
- package/src/components/filter-description/component.js +0 -41
- package/src/components/filter-description/index.js +0 -1
- package/src/components/index.js +0 -4
- package/src/components/index.scss +0 -76
- package/src/components/input/index.js +0 -2
- package/src/components/input/input-number.js +0 -228
- package/src/components/input/input.js +0 -10
- package/src/components/input/input.scss +0 -27
- package/src/components/loops/index.js +0 -2
- package/src/components/loops/loop/build-components.js +0 -33
- package/src/components/loops/loop/component.js +0 -88
- package/src/components/loops/loop/index.js +0 -1
- package/src/components/loops/loop/loop.scss +0 -17
- package/src/components/loops/roster/build-components.js +0 -26
- package/src/components/loops/roster/component.js +0 -199
- package/src/components/loops/roster/index.js +0 -1
- package/src/components/progress-bar/component.js +0 -28
- package/src/components/progress-bar/index.js +0 -1
- package/src/components/progress-bar/progress-bar.scss +0 -54
- package/src/components/radio/component.js +0 -8
- package/src/components/radio/index.js +0 -1
- package/src/components/radio/radio.scss +0 -24
- package/src/components/sequence/component.js +0 -41
- package/src/components/sequence/index.js +0 -1
- package/src/components/sequence/sequence.scss +0 -15
- package/src/components/subsequence/component.js +0 -48
- package/src/components/subsequence/index.js +0 -1
- package/src/components/subsequence/subsequence.scss +0 -15
- package/src/components/table/index.js +0 -1
- package/src/components/table/table.js +0 -160
- package/src/components/table/table.scss +0 -23
- package/src/components/textarea/component.js +0 -10
- package/src/components/textarea/index.js +0 -1
- package/src/components/textarea/textarea.scss +0 -16
- package/src/components/tooltip/img/index.js +0 -4
- package/src/components/tooltip/index.js +0 -1
- package/src/components/tooltip/response.js +0 -42
- package/src/components/tooltip/tooltip.scss +0 -35
- package/src/constants/component-types.js +0 -1
- package/src/constants/declarations.js +0 -14
- package/src/constants/index.js +0 -4
- package/src/constants/supported-preferences.js +0 -10
- package/src/constants/value-types.js +0 -5
- package/src/constants/variable-types.js +0 -4
- package/src/stories/breadcrumb/README.md +0 -14
- package/src/stories/breadcrumb/breadcrumb.stories.js +0 -33
- package/src/stories/button/README.md +0 -14
- package/src/stories/button/button.stories.js +0 -63
- package/src/stories/checkbox-boolean/README.md +0 -27
- package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +0 -33
- package/src/stories/checkbox-group/README.md +0 -29
- package/src/stories/checkbox-group/checkbox-group.stories.js +0 -81
- package/src/stories/checkbox-group/data-vtl.json +0 -89
- package/src/stories/checkbox-group/data.json +0 -89
- package/src/stories/checkbox-one/checkbox-one.stories.js +0 -77
- package/src/stories/checkbox-one/data-vtl.json +0 -33
- package/src/stories/checkbox-one/data.json +0 -33
- package/src/stories/datepicker/README.md +0 -31
- package/src/stories/datepicker/data.json +0 -28
- package/src/stories/datepicker/datepicker.stories.js +0 -65
- package/src/stories/declarations/README.md +0 -19
- package/src/stories/declarations/declarations.stories.js +0 -112
- package/src/stories/dropdown/README.md +0 -44
- package/src/stories/dropdown/data-naf.json +0 -6963
- package/src/stories/dropdown/data-props.json +0 -81
- package/src/stories/dropdown/data.json +0 -78
- package/src/stories/dropdown/dropdown.stories.js +0 -65
- package/src/stories/filter-description/README.md +0 -15
- package/src/stories/filter-description/filter-description.stories.js +0 -70
- package/src/stories/input/README.md +0 -33
- package/src/stories/input/data.json +0 -28
- package/src/stories/input/input.stories.js +0 -67
- package/src/stories/input-number/README.md +0 -37
- package/src/stories/input-number/data.json +0 -30
- package/src/stories/input-number/input-number.stories.js +0 -75
- package/src/stories/loops/README.md +0 -29
- package/src/stories/loops/custom-lunatic.scss +0 -786
- package/src/stories/loops/data-loop-deeper.json +0 -298
- package/src/stories/loops/data-loop.json +0 -213
- package/src/stories/loops/data-roster.json +0 -69
- package/src/stories/loops/img/arrow.png +0 -0
- package/src/stories/loops/img/check_box.svg +0 -1
- package/src/stories/loops/img/check_box_outline.svg +0 -1
- package/src/stories/loops/img/lunatic-logo.png +0 -0
- package/src/stories/loops/img/menu-down.svg +0 -1
- package/src/stories/loops/img/menu-up.svg +0 -1
- package/src/stories/loops/img/radio_button_checked.svg +0 -1
- package/src/stories/loops/img/radio_button_unchecked.svg +0 -1
- package/src/stories/loops/loop.stories.js +0 -56
- package/src/stories/loops/vqs.json +0 -846
- package/src/stories/progress-bar/README.md +0 -13
- package/src/stories/progress-bar/progress-bar.stories.js +0 -24
- package/src/stories/radio/README.md +0 -31
- package/src/stories/radio/data-vtl.json +0 -32
- package/src/stories/radio/data.json +0 -32
- package/src/stories/radio/radio.stories.js +0 -81
- package/src/stories/sequence/README.md +0 -18
- package/src/stories/sequence/sequence.stories.js +0 -58
- package/src/stories/subsequence/README.md +0 -18
- package/src/stories/subsequence/subsequence.stories.js +0 -58
- package/src/stories/table/README.md +0 -29
- package/src/stories/table/data-one-axis-one-measure.json +0 -124
- package/src/stories/table/data-one-axis-two-measures.json +0 -193
- package/src/stories/table/data-one-hierarchical-axis.json +0 -204
- package/src/stories/table/data-two-axis-one-measure.json +0 -492
- package/src/stories/table/table.stories.js +0 -77
- package/src/stories/textarea/README.md +0 -33
- package/src/stories/textarea/data.json +0 -28
- package/src/stories/textarea/textarea.stories.js +0 -67
- package/src/stories/tooltip-response/README.md +0 -14
- package/src/stories/tooltip-response/tooltip.stories.js +0 -43
- package/src/stories/utils/options.js +0 -21
- package/src/stories/utils/orchestrator.js +0 -52
- package/src/tests/components/breadcrumb.spec.js +0 -13
- package/src/tests/components/button.spec.js +0 -11
- package/src/tests/components/checkbox-boolean.spec.js +0 -40
- package/src/tests/components/checkbox-group.spec.js +0 -48
- package/src/tests/components/checkbox-one.spec.js +0 -32
- package/src/tests/components/datepicker.spec.js +0 -22
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +0 -65
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +0 -47
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +0 -21
- package/src/tests/components/declarations.spec.js +0 -46
- package/src/tests/components/input-number.spec.js +0 -173
- package/src/tests/components/input.spec.js +0 -18
- package/src/tests/components/progress-bar.spec.js +0 -15
- package/src/tests/components/radio.spec.js +0 -27
- package/src/tests/components/sequence.spec.js +0 -9
- package/src/tests/components/subsequence.spec.js +0 -9
- package/src/tests/components/table.spec.js +0 -11
- package/src/tests/components/textarea.spec.js +0 -18
- package/src/tests/components/tooltip.spec.js +0 -25
- package/src/tests/setup/setupTests.js +0 -4
- package/src/tests/utils/lib/alphabet.spec.js +0 -36
- package/src/tests/utils/lib/checkbox/group.spec.js +0 -72
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +0 -12
- package/src/tests/utils/lib/items-positioning.spec.js +0 -17
- package/src/tests/utils/lib/label-position.spec.js +0 -22
- package/src/tests/utils/lib/loops/bindings.spec.js +0 -60
- package/src/tests/utils/lib/loops/shared.spec.js +0 -77
- package/src/tests/utils/lib/responses.spec.js +0 -58
- package/src/tests/utils/lib/style.spec.js +0 -26
- package/src/tests/utils/lib/table/roster.spec.js +0 -25
- package/src/tests/utils/lib/tooltip/build-response.spec.js +0 -95
- package/src/tests/utils/lib/tooltip/content.spec.js +0 -109
- package/src/tests/utils/to-expose/handler/handler.spec.js +0 -86
- package/src/tests/utils/to-expose/handler/questionnaire.json +0 -154
- package/src/tests/utils/to-expose/handler/results/index.js +0 -6
- package/src/tests/utils/to-expose/handler/results/res-double.json +0 -157
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +0 -154
- package/src/tests/utils/to-expose/handler/results/res-input-edited.json +0 -157
- package/src/tests/utils/to-expose/handler/results/res-loop.json +0 -157
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +0 -157
- package/src/tests/utils/to-expose/handler/results/res-responses.json +0 -157
- package/src/tests/utils/to-expose/init-questionnaire/data.json +0 -12
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +0 -19
- package/src/tests/utils/to-expose/init-questionnaire/questionnaire.json +0 -129
- package/src/tests/utils/to-expose/init-questionnaire/result.json +0 -162
- package/src/tests/utils/to-expose/interpret.spec.js +0 -42
- package/src/tests/utils/to-expose/state/questionnaire.json +0 -61
- package/src/tests/utils/to-expose/state/results.js +0 -78
- package/src/tests/utils/to-expose/state/state.spec.js +0 -59
- package/src/utils/lib/alphabet.js +0 -1
- package/src/utils/lib/checkbox/group.js +0 -21
- package/src/utils/lib/checkbox/index.js +0 -1
- package/src/utils/lib/decorator/index.js +0 -1
- package/src/utils/lib/decorator/title-decorator.js +0 -16
- package/src/utils/lib/index.js +0 -12
- package/src/utils/lib/label-position.js +0 -12
- package/src/utils/lib/loops/bindings.js +0 -47
- package/src/utils/lib/loops/index.js +0 -2
- package/src/utils/lib/loops/shared.js +0 -43
- package/src/utils/lib/memo-check.js +0 -24
- package/src/utils/lib/options-positioning.js +0 -9
- package/src/utils/lib/prop-types/declarations.js +0 -22
- package/src/utils/lib/prop-types/index.js +0 -5
- package/src/utils/lib/prop-types/lines.js +0 -6
- package/src/utils/lib/prop-types/options.js +0 -8
- package/src/utils/lib/prop-types/response.js +0 -6
- package/src/utils/lib/prop-types/value-type.js +0 -9
- package/src/utils/lib/responses.js +0 -9
- package/src/utils/lib/style.js +0 -10
- package/src/utils/lib/table/index.js +0 -1
- package/src/utils/lib/table/roster.js +0 -18
- package/src/utils/lib/tooltip/build-response.js +0 -23
- package/src/utils/lib/tooltip/content.js +0 -52
- package/src/utils/lib/tooltip/index.js +0 -5
- package/src/utils/to-expose/handler.js +0 -99
- package/src/utils/to-expose/hook.js +0 -55
- package/src/utils/to-expose/index.js +0 -10
- package/src/utils/to-expose/init-questionnaire.js +0 -114
- package/src/utils/to-expose/interpret.js +0 -32
- package/src/utils/to-expose/state.js +0 -58
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.interpretAllCalculatedVariables = void 0;
|
|
8
|
+
var _executeExpression = require("../commons/execute-expression/execute-expression");
|
|
9
|
+
var _vtl = _interopRequireDefault(require("../../utils/vtl"));
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
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
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
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."); }
|
|
19
|
+
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); }
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
21
|
+
function _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; } }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
var interpretAllCalculatedVariables = function interpretAllCalculatedVariables(_ref) {
|
|
24
|
+
var variables = _ref.variables,
|
|
25
|
+
partialVariables = _ref.partialVariables,
|
|
26
|
+
builtVariables = _ref.builtVariables;
|
|
27
|
+
return Object.entries(partialVariables || variables).reduce(function (acc, _ref2) {
|
|
28
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
29
|
+
k = _ref3[0],
|
|
30
|
+
v = _ref3[1];
|
|
31
|
+
if (k in acc) return acc;
|
|
32
|
+
var type = v.type;
|
|
33
|
+
if (type === _constants.CALCULATED) {
|
|
34
|
+
var _v$variable = v.variable,
|
|
35
|
+
expression = _v$variable.expression.value,
|
|
36
|
+
shapeFrom = _v$variable.shapeFrom,
|
|
37
|
+
_v$variable$bindingDe = _v$variable.bindingDependencies,
|
|
38
|
+
bindingDependencies = _v$variable$bindingDe === void 0 ? [] : _v$variable$bindingDe;
|
|
39
|
+
var bindings = buildBindings({
|
|
40
|
+
builtVariables: acc,
|
|
41
|
+
bindingDependencies: bindingDependencies,
|
|
42
|
+
variables: variables
|
|
43
|
+
});
|
|
44
|
+
if (shapeFrom) {
|
|
45
|
+
var result = acc[shapeFrom].map(function (_, index) {
|
|
46
|
+
var scopedBindings = buildScopedBindings({
|
|
47
|
+
bindings: bindings,
|
|
48
|
+
index: index
|
|
49
|
+
});
|
|
50
|
+
return (0, _executeExpression.executeVtlExpression)(expression, scopedBindings);
|
|
51
|
+
});
|
|
52
|
+
return _objectSpread(_objectSpread(_objectSpread({}, acc), bindings), {}, _defineProperty({}, k, result));
|
|
53
|
+
}
|
|
54
|
+
var vectorialBindings = buildVectorialBindings({
|
|
55
|
+
bindings: bindings
|
|
56
|
+
});
|
|
57
|
+
return _objectSpread(_objectSpread(_objectSpread({}, acc), bindings), {}, _defineProperty({}, k, (0, _executeExpression.executeVtlExpression)(expression, vectorialBindings)));
|
|
58
|
+
}
|
|
59
|
+
return acc;
|
|
60
|
+
}, builtVariables);
|
|
61
|
+
};
|
|
62
|
+
exports.interpretAllCalculatedVariables = interpretAllCalculatedVariables;
|
|
63
|
+
var buildBindings = function buildBindings(_ref4) {
|
|
64
|
+
var builtVariables = _ref4.builtVariables,
|
|
65
|
+
bindingDependencies = _ref4.bindingDependencies,
|
|
66
|
+
variables = _ref4.variables;
|
|
67
|
+
return bindingDependencies.reduce(function (acc, b) {
|
|
68
|
+
if (builtVariables[b] === undefined) {
|
|
69
|
+
var unresolvedVariable = _defineProperty({}, b, variables[b]);
|
|
70
|
+
var result = interpretAllCalculatedVariables({
|
|
71
|
+
partialVariables: unresolvedVariable,
|
|
72
|
+
variables: variables,
|
|
73
|
+
builtVariables: builtVariables
|
|
74
|
+
})[b];
|
|
75
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, b, result));
|
|
76
|
+
}
|
|
77
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, b, builtVariables[b]));
|
|
78
|
+
}, {});
|
|
79
|
+
};
|
|
80
|
+
var buildScopedBindings = function buildScopedBindings(_ref5) {
|
|
81
|
+
var bindings = _ref5.bindings,
|
|
82
|
+
index = _ref5.index;
|
|
83
|
+
return Object.entries(bindings).reduce(function (acc, _ref6) {
|
|
84
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
85
|
+
k = _ref7[0],
|
|
86
|
+
v = _ref7[1];
|
|
87
|
+
if (Array.isArray(v)) return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, k, v[index] !== undefined ? v[index] : null));
|
|
88
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, k, v));
|
|
89
|
+
}, {});
|
|
90
|
+
};
|
|
91
|
+
var buildVectorialBindings = function buildVectorialBindings(_ref8) {
|
|
92
|
+
var bindings = _ref8.bindings;
|
|
93
|
+
return Object.entries(bindings).reduce(function (acc, _ref9) {
|
|
94
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
95
|
+
k = _ref10[0],
|
|
96
|
+
v = _ref10[1];
|
|
97
|
+
if (Array.isArray(v)) return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, k, (0, _vtl["default"])(v)));
|
|
98
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, k, v));
|
|
99
|
+
}, {});
|
|
100
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _isPaginatedLoop = _interopRequireDefault(require("./is-paginated-loop"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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; }
|
|
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; }
|
|
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); }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
20
|
+
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."); }
|
|
21
|
+
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); }
|
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
+
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
|
+
function extractSubPages(component) {
|
|
26
|
+
var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
27
|
+
var components = component.components;
|
|
28
|
+
return components.reduce(function (pages, component) {
|
|
29
|
+
var page = component.page;
|
|
30
|
+
if (page && pages.indexOf(page) === -1) {
|
|
31
|
+
return [].concat(_toConsumableArray(pages), [page]);
|
|
32
|
+
}
|
|
33
|
+
return pages;
|
|
34
|
+
}, previous);
|
|
35
|
+
}
|
|
36
|
+
function extractLoop() {
|
|
37
|
+
var components = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
38
|
+
return components.reduce(function (_ref, component) {
|
|
39
|
+
var isLoop = _ref.isLoop,
|
|
40
|
+
subPages = _ref.subPages,
|
|
41
|
+
iterations = _ref.iterations,
|
|
42
|
+
loopDependencies = _ref.loopDependencies;
|
|
43
|
+
var currentIsLoop = (0, _isPaginatedLoop["default"])(component);
|
|
44
|
+
if (currentIsLoop) {
|
|
45
|
+
return {
|
|
46
|
+
isLoop: true,
|
|
47
|
+
subPages: extractSubPages(component, subPages),
|
|
48
|
+
iterations: iterations || component.iterations,
|
|
49
|
+
loopDependencies: loopDependencies || component.loopDependencies
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
isLoop: isLoop,
|
|
54
|
+
subPages: subPages,
|
|
55
|
+
iterations: iterations
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
isLoop: false,
|
|
59
|
+
subPages: undefined,
|
|
60
|
+
iterations: undefined,
|
|
61
|
+
loopDependencies: undefined
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function checkLoops(pages) {
|
|
65
|
+
return Object.entries(pages).reduce(function (map, current) {
|
|
66
|
+
var _current = _slicedToArray(current, 2),
|
|
67
|
+
number = _current[0],
|
|
68
|
+
content = _current[1];
|
|
69
|
+
if (number !== 'unpaged') {
|
|
70
|
+
var components = content.components;
|
|
71
|
+
var _extractLoop = extractLoop(components),
|
|
72
|
+
isLoop = _extractLoop.isLoop,
|
|
73
|
+
subPages = _extractLoop.subPages,
|
|
74
|
+
iterations = _extractLoop.iterations,
|
|
75
|
+
loopDependencies = _extractLoop.loopDependencies;
|
|
76
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, number, _objectSpread(_objectSpread({}, content), {}, {
|
|
77
|
+
isLoop: isLoop,
|
|
78
|
+
subPages: subPages,
|
|
79
|
+
iterations: iterations,
|
|
80
|
+
loopDependencies: loopDependencies
|
|
81
|
+
})));
|
|
82
|
+
}
|
|
83
|
+
return map;
|
|
84
|
+
}, {});
|
|
85
|
+
}
|
|
86
|
+
var _default = checkLoops;
|
|
87
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compose = compose;
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
function compose() {
|
|
9
|
+
for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
|
+
functions[_key] = arguments[_key];
|
|
11
|
+
}
|
|
12
|
+
return functions.reverse().reduce(function (next, current) {
|
|
13
|
+
return function (first) {
|
|
14
|
+
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
15
|
+
rest[_key2 - 1] = arguments[_key2];
|
|
16
|
+
}
|
|
17
|
+
return next.apply(void 0, [current.apply(void 0, [first].concat(rest))].concat(rest));
|
|
18
|
+
};
|
|
19
|
+
}, function (t) {
|
|
20
|
+
return t;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
var _default = compose;
|
|
24
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _isPaginatedLoop = _interopRequireDefault(require("./is-paginated-loop"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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); }
|
|
10
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
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."); }
|
|
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); }
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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; }
|
|
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; }
|
|
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; }
|
|
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); }
|
|
21
|
+
function isUnpaginated(questionnaire) {
|
|
22
|
+
var maxPage = questionnaire.maxPage;
|
|
23
|
+
return maxPage === undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {*} component: object
|
|
29
|
+
* @param {*} page: string
|
|
30
|
+
* @param {*} map Map<page,{ components: Array<component>, isLoop: boolean, subPages: Array<page> }>
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
function mergeComponent(component, page, map) {
|
|
34
|
+
if (!page) {
|
|
35
|
+
return _objectSpread(_objectSpread({}, map), {}, {
|
|
36
|
+
unpaged: [].concat(_toConsumableArray(map.unpaged), [component])
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (page in map) {
|
|
40
|
+
var current = map[page];
|
|
41
|
+
var components = current.components;
|
|
42
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, page, _objectSpread(_objectSpread({}, current), {}, {
|
|
43
|
+
components: [].concat(_toConsumableArray(components), [component])
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, page, {
|
|
47
|
+
components: [component]
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
function mergeNestedComponents(components, map) {
|
|
51
|
+
return components.reduce(function (current, component) {
|
|
52
|
+
var page = component.page;
|
|
53
|
+
if (page) {
|
|
54
|
+
return mergeComponent(component, page, current);
|
|
55
|
+
}
|
|
56
|
+
return current;
|
|
57
|
+
}, map);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param {*} components
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
function createPages(questionnaire) {
|
|
65
|
+
var components = questionnaire.components;
|
|
66
|
+
if (isUnpaginated(questionnaire)) {
|
|
67
|
+
return {
|
|
68
|
+
1: {
|
|
69
|
+
components: components
|
|
70
|
+
}
|
|
71
|
+
}; // no page -> one page ;)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var map = components.reduce(function (current, component) {
|
|
75
|
+
var components = component.components,
|
|
76
|
+
page = component.page;
|
|
77
|
+
if ((0, _isPaginatedLoop["default"])(component)) {
|
|
78
|
+
return mergeComponent(component, page, mergeNestedComponents(components, current));
|
|
79
|
+
}
|
|
80
|
+
return mergeComponent(component, page, current);
|
|
81
|
+
}, {
|
|
82
|
+
unpaged: []
|
|
83
|
+
});
|
|
84
|
+
return map;
|
|
85
|
+
}
|
|
86
|
+
var _default = createPages;
|
|
87
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _getCompatibleVtlExpression = _interopRequireDefault(require("./get-compatible-vtl-expression"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
function executeConditionFilter(filter, execute, iteration) {
|
|
10
|
+
if (filter && typeof execute === 'function') {
|
|
11
|
+
var logging = function logging() {
|
|
12
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
+
args[_key] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
console.warn(args);
|
|
16
|
+
console.warn('executeConditionFilter:', filter);
|
|
17
|
+
};
|
|
18
|
+
var value = filter.value;
|
|
19
|
+
return execute((0, _getCompatibleVtlExpression["default"])(value), {
|
|
20
|
+
iteration: iteration,
|
|
21
|
+
logging: logging
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
var _default = executeConditionFilter;
|
|
27
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _executeExpression = _interopRequireDefault(require("./execute-expression"));
|
|
8
|
+
var _getSafetyExpression = _interopRequireDefault(require("./get-safety-expression"));
|
|
9
|
+
var _getExpressionsVariables = _interopRequireDefault(require("./get-expressions-variables"));
|
|
10
|
+
var _createMemoizer3 = _interopRequireDefault(require("./create-memoizer"));
|
|
11
|
+
var _createRefreshCalculated = _interopRequireDefault(require("./create-refresh-calculated"));
|
|
12
|
+
var _vtl = _interopRequireDefault(require("../../../utils/vtl"));
|
|
13
|
+
var _constants = require("../../../utils/constants");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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; }
|
|
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; }
|
|
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); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
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; }
|
|
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; } }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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); }
|
|
27
|
+
function validateExpression(expObject) {
|
|
28
|
+
if (_typeof(expObject) === 'object') {
|
|
29
|
+
var type = expObject.type;
|
|
30
|
+
if (type === _constants.VTL || type === _constants.VTL_MD) {
|
|
31
|
+
return expObject;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (typeof expObject === 'string') return {
|
|
35
|
+
value: expObject,
|
|
36
|
+
type: _constants.VTL
|
|
37
|
+
};
|
|
38
|
+
console.warn("Non-VTL compatible expression : ".concat(expObject));
|
|
39
|
+
}
|
|
40
|
+
function createBindings(variables) {
|
|
41
|
+
return Object.entries(variables).reduce(function (bindings, _ref) {
|
|
42
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
43
|
+
name = _ref2[0],
|
|
44
|
+
value = _ref2[1].value;
|
|
45
|
+
return _objectSpread(_objectSpread({}, bindings), {}, _defineProperty({}, name, value));
|
|
46
|
+
}, {});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param {*} variables
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
function createExecuteExpression(variables, features) {
|
|
55
|
+
// on aimerait map d'expression, avec les bindings
|
|
56
|
+
var bindings = createBindings(variables);
|
|
57
|
+
var tokensMap = new Map();
|
|
58
|
+
var collectedUpdated = new Map();
|
|
59
|
+
var _createMemoizer = (0, _createMemoizer3["default"])(),
|
|
60
|
+
_createMemoizer2 = _slicedToArray(_createMemoizer, 2),
|
|
61
|
+
memoize = _createMemoizer2[0],
|
|
62
|
+
getMemoizedValue = _createMemoizer2[1];
|
|
63
|
+
var _createRefreshCalcula = (0, _createRefreshCalculated["default"])({
|
|
64
|
+
variables: variables,
|
|
65
|
+
execute: execute,
|
|
66
|
+
bindings: bindings
|
|
67
|
+
}),
|
|
68
|
+
_createRefreshCalcula2 = _slicedToArray(_createRefreshCalcula, 2),
|
|
69
|
+
refreshCalculated = _createRefreshCalcula2[0],
|
|
70
|
+
setToRefreshCalculated = _createRefreshCalcula2[1];
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param {*} name
|
|
75
|
+
*/
|
|
76
|
+
function pushToLazy(name) {
|
|
77
|
+
if (name in variables) {
|
|
78
|
+
var _variables$name$Calcu = variables[name].CalculatedLinked,
|
|
79
|
+
CalculatedLinked = _variables$name$Calcu === void 0 ? [] : _variables$name$Calcu;
|
|
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
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param {*} name
|
|
92
|
+
* @param {*} value
|
|
93
|
+
*/
|
|
94
|
+
function updateBindings(name, value) {
|
|
95
|
+
// update des bindings
|
|
96
|
+
if (name in bindings) {
|
|
97
|
+
bindings[name] = value;
|
|
98
|
+
collectedUpdated.set(name, []);
|
|
99
|
+
}
|
|
100
|
+
pushToLazy(name);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {*} variables
|
|
106
|
+
* @param {*} iteration
|
|
107
|
+
*/
|
|
108
|
+
function setLoopBindings(variables, iteration) {
|
|
109
|
+
Object.entries(bindings).forEach(function (_ref3) {
|
|
110
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
111
|
+
k = _ref4[0],
|
|
112
|
+
v = _ref4[1];
|
|
113
|
+
var _variables$k = variables[k],
|
|
114
|
+
type = _variables$k.type,
|
|
115
|
+
value = _variables$k.value;
|
|
116
|
+
if (!Array.isArray(v) && type === _constants.COLLECTED && Array.isArray(value)) {
|
|
117
|
+
bindings[k] = value[iteration];
|
|
118
|
+
pushToLazy(k);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @param {*} variables
|
|
126
|
+
*/
|
|
127
|
+
function resetLoopBindings(variables) {
|
|
128
|
+
Object.entries(bindings).forEach(function (_ref5) {
|
|
129
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
130
|
+
k = _ref6[0],
|
|
131
|
+
v = _ref6[1];
|
|
132
|
+
var _variables$k2 = variables[k],
|
|
133
|
+
type = _variables$k2.type,
|
|
134
|
+
value = _variables$k2.value;
|
|
135
|
+
if (type === _constants.COLLECTED && Array.isArray(value) && !Array.isArray(v)) {
|
|
136
|
+
bindings[k] = value;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function getVariablesAndCach(expression) {
|
|
141
|
+
if (tokensMap.has(expression)) {
|
|
142
|
+
return tokensMap.get(expression);
|
|
143
|
+
}
|
|
144
|
+
var tokens = (0, _getExpressionsVariables["default"])(expression, variables);
|
|
145
|
+
tokensMap.set(expression, tokens);
|
|
146
|
+
return tokens;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**/
|
|
150
|
+
function collecteVariables(dependencies) {
|
|
151
|
+
if (Array.isArray(dependencies)) {
|
|
152
|
+
return dependencies.reduce(function (map, name) {
|
|
153
|
+
if (name in variables) {
|
|
154
|
+
var data = variables[name];
|
|
155
|
+
var variable = data.variable,
|
|
156
|
+
type = data.type;
|
|
157
|
+
if (!(name in map)) {
|
|
158
|
+
if (type === 'CALCULATED') {
|
|
159
|
+
var expression = variable.expression;
|
|
160
|
+
var subDependencies = getVariablesAndCach(expression);
|
|
161
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, name, _objectSpread({}, variable)), collecteVariables(subDependencies));
|
|
162
|
+
}
|
|
163
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, name, _objectSpread({}, variable)));
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
throw new Error("Unknown variable ".concat(name));
|
|
167
|
+
}
|
|
168
|
+
return map;
|
|
169
|
+
}, {});
|
|
170
|
+
}
|
|
171
|
+
return {};
|
|
172
|
+
}
|
|
173
|
+
function resolveUseContext(name, _ref7) {
|
|
174
|
+
var iteration = _ref7.iteration,
|
|
175
|
+
linksIterations = _ref7.linksIterations;
|
|
176
|
+
var value = bindings[name];
|
|
177
|
+
if ([_constants.X_AXIS, _constants.Y_AXIS].includes(name) && linksIterations !== undefined) {
|
|
178
|
+
pushToLazy(name);
|
|
179
|
+
var _linksIterations = _slicedToArray(linksIterations, 2),
|
|
180
|
+
x = _linksIterations[0],
|
|
181
|
+
y = _linksIterations[1];
|
|
182
|
+
if (Array.isArray(value) && x < value.length) {
|
|
183
|
+
return value[name === _constants.X_AXIS ? x : y];
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
if (iteration !== undefined && Array.isArray(value)) {
|
|
188
|
+
pushToLazy(name);
|
|
189
|
+
if (iteration < value.length) {
|
|
190
|
+
return value[iteration];
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
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
|
+
}
|
|
207
|
+
return (0, _vtl["default"])(value);
|
|
208
|
+
}
|
|
209
|
+
function fillVariablesValues(map, _ref8) {
|
|
210
|
+
var iteration = _ref8.iteration,
|
|
211
|
+
linksIterations = _ref8.linksIterations;
|
|
212
|
+
return Object.entries(map).reduce(function (sub, _ref9) {
|
|
213
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
214
|
+
name = _ref10[0],
|
|
215
|
+
_ = _ref10[1];
|
|
216
|
+
return _objectSpread(_objectSpread({}, sub), {}, _defineProperty({}, name, resolveUseContext(name, {
|
|
217
|
+
iteration: iteration,
|
|
218
|
+
linksIterations: linksIterations
|
|
219
|
+
})));
|
|
220
|
+
}, {});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* @param {*} vtlObject
|
|
226
|
+
* @param {*} args
|
|
227
|
+
* @returns
|
|
228
|
+
*/
|
|
229
|
+
function execute(expObject) {
|
|
230
|
+
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
231
|
+
var _validateExpression = validateExpression((0, _getSafetyExpression["default"])(expObject)),
|
|
232
|
+
expression = _validateExpression.value,
|
|
233
|
+
type = _validateExpression.type;
|
|
234
|
+
var iteration = args.iteration,
|
|
235
|
+
linksIterations = args.linksIterations,
|
|
236
|
+
logging = args.logging;
|
|
237
|
+
var bindingDependencies = getVariablesAndCach(expression);
|
|
238
|
+
function loggingDefault(_, bindings, e) {
|
|
239
|
+
if (process.env.NODE_ENV === 'development') {
|
|
240
|
+
console.warn("VTL error : ".concat(expression), _objectSpread({}, args), {
|
|
241
|
+
bindings: bindings
|
|
242
|
+
});
|
|
243
|
+
console.warn(e);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
var vtlBindings = refreshCalculated(fillVariablesValues(collecteVariables(bindingDependencies), {
|
|
247
|
+
iteration: iteration,
|
|
248
|
+
linksIterations: linksIterations
|
|
249
|
+
}), {
|
|
250
|
+
rootExpression: expression,
|
|
251
|
+
iteration: iteration,
|
|
252
|
+
linksIterations: linksIterations
|
|
253
|
+
});
|
|
254
|
+
var memoized = getMemoizedValue(expression, vtlBindings);
|
|
255
|
+
if (memoized === undefined) {
|
|
256
|
+
var result = (0, _executeExpression["default"])(vtlBindings, expression, type, features, logging || loggingDefault);
|
|
257
|
+
memoize(expression, vtlBindings, result);
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
return memoized;
|
|
261
|
+
}
|
|
262
|
+
return [execute, updateBindings, setLoopBindings, resetLoopBindings];
|
|
263
|
+
}
|
|
264
|
+
var _default = createExecuteExpression;
|
|
265
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _objectHash = _interopRequireDefault(require("object-hash"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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; }
|
|
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; }
|
|
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); }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
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; }
|
|
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; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
function createMemoizer() {
|
|
22
|
+
var expresionsMap = new Map();
|
|
23
|
+
function refillBindings(bindings) {
|
|
24
|
+
return Object.entries(bindings).reduce(function (map, _ref) {
|
|
25
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
26
|
+
key = _ref2[0],
|
|
27
|
+
value = _ref2[1];
|
|
28
|
+
var dataPointsValue = value === null || value === void 0 ? void 0 : value.result;
|
|
29
|
+
if (dataPointsValue) {
|
|
30
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, dataPointsValue));
|
|
31
|
+
}
|
|
32
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, value));
|
|
33
|
+
}, {});
|
|
34
|
+
}
|
|
35
|
+
function memoize(expression, bindings, value) {
|
|
36
|
+
var refill = refillBindings(bindings);
|
|
37
|
+
var hash = (0, _objectHash["default"])(refill);
|
|
38
|
+
var map = expresionsMap.get(expression);
|
|
39
|
+
if (!map) {
|
|
40
|
+
map = new Map();
|
|
41
|
+
expresionsMap.set(expression, map);
|
|
42
|
+
}
|
|
43
|
+
map.set(hash, value);
|
|
44
|
+
}
|
|
45
|
+
function getMemoizedValue(expression, bindings) {
|
|
46
|
+
var map = expresionsMap.get(expression);
|
|
47
|
+
if (map) {
|
|
48
|
+
var refill = refillBindings(bindings);
|
|
49
|
+
var hash = (0, _objectHash["default"])(refill);
|
|
50
|
+
return map.get(hash);
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return [memoize, getMemoizedValue];
|
|
55
|
+
}
|
|
56
|
+
var _default = createMemoizer;
|
|
57
|
+
exports["default"] = _default;
|