@inseefr/lunatic 2.6.3-rc.1 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -3
- package/lib/components/checkbox/checkbox-boolean/html/checkbox-boolean.js +3 -3
- package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +7 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group-content.js +0 -2
- package/lib/components/checkbox/checkbox-group/html/checkbox-group-content.js +4 -2
- package/lib/components/checkbox/checkbox-group/html/checkbox-group.js +3 -3
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +2 -1
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +2 -1
- package/lib/components/checkbox/commons/checkbox-option.js +3 -1
- package/lib/components/commons/components/combo-box/combo-box-container.js +1 -2
- package/lib/components/commons/components/combo-box/combo-box.js +2 -2
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.js +3 -1
- package/lib/components/commons/components/combo-box/selection/input.js +3 -1
- package/lib/components/commons/components/combo-box/selection/selection.js +3 -1
- package/lib/components/commons/components/errors/errors.js +12 -10
- package/lib/components/commons/components/errors/errors.spec.js +6 -6
- package/lib/components/component-set/html/__snapshots__/component-set.spec.tsx.snap +2 -0
- package/lib/components/component-set/html/component-set.js +2 -2
- package/lib/components/datepicker/html/__snapshots__/datepicker.spec.tsx.snap +2 -0
- package/lib/components/datepicker/html/datepicker-input.js +4 -2
- package/lib/components/datepicker/html/datepicker.js +3 -3
- package/lib/components/datepicker/lunatic-datepicker.js +2 -1
- package/lib/components/dropdown/lunatic-dropdown.js +2 -1
- package/lib/components/index.js +4 -4
- package/lib/components/input/html/__snapshots__/input.spec.tsx.snap +2 -0
- package/lib/components/input/html/input.js +3 -3
- package/lib/components/input/lunatic-input.js +2 -1
- package/lib/components/input-number/html/__snapshots__/input-number.spec.tsx.snap +2 -2
- package/lib/components/input-number/html/input-number-thousand.js +4 -17
- package/lib/components/input-number/html/input-number.js +3 -5
- package/lib/components/input-number/lunatic-input-number.js +2 -3
- package/lib/components/loop/block-for-loop.js +10 -6
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +35 -27
- package/lib/components/loop/utils/get-initial-nb-rows.js +17 -0
- package/lib/components/lunatic-components.js +7 -27
- package/lib/components/pairwise-links/index.js +13 -0
- package/lib/components/pairwise-links/orchestrator.js +71 -0
- package/lib/components/pairwise-links/pairwise-links.js +30 -27
- package/lib/components/pairwise-links/row.js +74 -0
- package/lib/components/radio/html/radio-group-content.js +4 -2
- package/lib/components/radio/html/radio-group.js +3 -3
- package/lib/components/radio/html/radio-option.js +3 -1
- package/lib/components/radio/lunatic-radio-group.js +2 -1
- package/lib/components/suggester/find-best-label/find-best-label.js +6 -6
- package/lib/components/suggester/idb-suggester/idb-suggester.js +4 -3
- package/lib/components/suggester/lunatic-suggester.js +7 -4
- package/lib/components/suggester/searching/create-searching.js +20 -39
- package/lib/components/switch/html/switch.js +2 -2
- package/lib/components/switch/lunatic-switch.js +2 -1
- package/lib/components/table/cell.js +89 -0
- package/lib/components/table/{table-header.js → header.js} +5 -3
- package/lib/components/table/index.js +13 -0
- package/lib/components/table/lunatic-table.js +15 -24
- package/lib/components/table/row.js +40 -0
- package/lib/components/table/table-orchestrator.js +35 -0
- package/lib/components/textarea/html/__snapshots__/textarea.spec.tsx.snap +2 -0
- package/lib/components/textarea/html/textarea.js +6 -4
- package/lib/components/textarea/lunatic-textarea.js +6 -3
- package/lib/hooks/use-auto-focus.js +26 -0
- package/lib/src/components/checkbox/checkbox-boolean/html/checkbox-boolean.d.ts +1 -1
- package/lib/src/components/checkbox/checkbox-group/html/checkbox-group-content.d.ts +2 -1
- package/lib/src/components/checkbox/checkbox-group/html/checkbox-group.d.ts +1 -1
- package/lib/src/components/checkbox/commons/checkbox-option.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/combo-box-container.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +4 -6
- package/lib/src/components/commons/components/combo-box/selection/LabelOrInput.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/selection/input.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/selection/selection.d.ts +2 -1
- package/lib/src/components/commons/components/errors/errors.d.ts +6 -3
- package/lib/src/components/datepicker/html/datepicker-input.d.ts +2 -1
- package/lib/src/components/datepicker/html/datepicker.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown.d.ts +3 -1
- package/lib/src/components/index.d.ts +2 -2
- package/lib/src/components/input/html/input.d.ts +2 -2
- package/lib/src/components/input-number/html/input-number-thousand.d.ts +2 -2
- package/lib/src/components/input-number/html/input-number.d.ts +2 -3
- package/lib/src/components/loop/block-for-loop.d.ts +4 -3
- package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +4 -3
- package/lib/src/components/loop/utils/get-initial-nb-rows.d.ts +4 -0
- package/lib/src/components/lunatic-components.d.ts +3 -5
- package/lib/src/components/pairwise-links/index.d.ts +1 -0
- package/lib/src/components/pairwise-links/orchestrator.d.ts +6 -0
- package/lib/src/components/pairwise-links/pairwise-links.d.ts +2 -1
- package/lib/src/components/pairwise-links/row.d.ts +7 -0
- package/lib/src/components/radio/html/radio-group-content.d.ts +2 -1
- package/lib/src/components/radio/html/radio-group.d.ts +1 -1
- package/lib/src/components/radio/html/radio-option.d.ts +1 -0
- package/lib/src/components/suggester/find-best-label/find-best-label.d.ts +1 -1
- package/lib/src/components/suggester/html/suggester.d.ts +1 -1
- package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +5 -2
- package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
- package/lib/src/components/suggester/searching/create-searching.d.ts +1 -1
- package/lib/src/components/switch/html/switch.d.ts +1 -1
- package/lib/src/components/table/cell.d.ts +19 -0
- package/lib/src/components/table/{table-header.d.ts → header.d.ts} +2 -2
- package/lib/src/components/table/index.d.ts +1 -0
- package/lib/src/components/table/lunatic-table.d.ts +1 -1
- package/lib/src/components/table/row.d.ts +18 -0
- package/lib/src/components/table/table-orchestrator.d.ts +4 -0
- package/lib/src/components/textarea/html/textarea.d.ts +3 -2
- package/lib/src/components/type.d.ts +9 -7
- package/lib/src/hooks/use-auto-focus.d.ts +6 -0
- package/lib/src/use-lunatic/actions.d.ts +19 -3
- package/lib/src/use-lunatic/commons/calculated-variables.d.ts +8 -0
- package/lib/src/use-lunatic/commons/compile-controls.d.ts +2 -3
- package/lib/src/use-lunatic/commons/execute-expression/create-execute-expression.d.ts +9 -0
- package/lib/src/use-lunatic/commons/execute-expression/create-memoizer.d.ts +8 -0
- package/lib/src/use-lunatic/commons/execute-expression/create-refresh-calculated.d.ts +24 -0
- package/lib/src/use-lunatic/commons/execute-expression/execute-expression.d.ts +11 -0
- package/lib/src/use-lunatic/commons/execute-expression/get-expressions-variables.d.ts +7 -0
- package/lib/src/use-lunatic/commons/execute-expression/get-expressions-variables.spec.d.ts +1 -0
- package/lib/src/use-lunatic/commons/execute-expression/get-safety-expression.d.ts +6 -0
- package/lib/src/use-lunatic/commons/execute-expression/index.d.ts +1 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +418 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-component-value.d.ts +3 -2
- package/lib/src/use-lunatic/commons/fill-components/fill-components.d.ts +0 -6
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +142 -107
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +89 -53
- package/lib/src/use-lunatic/commons/get-compatible-vtl-expression.d.ts +0 -1
- package/lib/src/use-lunatic/commons/get-component-value/get-component-value.d.ts +6 -0
- package/lib/src/use-lunatic/commons/get-component-value/index.d.ts +1 -0
- package/lib/src/use-lunatic/commons/get-data.d.ts +26 -0
- package/lib/src/use-lunatic/commons/index.d.ts +3 -0
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +9 -10
- package/lib/src/use-lunatic/reducer/reduce-handle-change/index.d.ts +1 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.d.ts +7 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.spec.d.ts +1 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.d.ts +4 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.d.ts +15 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-missing.d.ts +7 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-resizing.d.ts +4 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.d.ts +14 -0
- package/lib/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.d.ts +9 -0
- package/lib/src/use-lunatic/reducer/reduce-on-init.d.ts +12 -1
- package/lib/src/use-lunatic/reducer/reduce-on-init.spec.d.ts +1 -0
- package/lib/src/use-lunatic/type-source.d.ts +21 -7
- package/lib/src/use-lunatic/type.d.ts +12 -13
- package/lib/src/use-lunatic/use-lunatic.d.ts +62 -36
- package/lib/src/use-lunatic/use-suggesters.d.ts +2 -1
- package/lib/src/utils/array.d.ts +1 -6
- package/lib/src/utils/number.d.ts +0 -4
- package/lib/src/utils/suggester-workers/append-to-index/create-append-task.d.ts +1 -1
- package/lib/src/utils/suggester-workers/searching/meloto-order.d.ts +2 -1
- package/lib/src/utils/suggester-workers/worker-path.d.ts +6 -0
- package/lib/src/utils/vtl/dataset-builder.d.ts +5 -0
- package/lib/src/utils/vtl/index.d.ts +1 -0
- package/lib/stories/behaviour/cleaning/source.json +151 -0
- package/lib/stories/behaviour/cleaning/test.stories.js +84 -0
- package/lib/stories/{questionnaires-test → behaviour}/controls/controls.stories.js +5 -5
- package/lib/stories/{questionnaires-test → behaviour/others}/test.stories.js +7 -7
- package/lib/stories/{paste-questionnaire → behaviour/paste}/test.stories.js +3 -3
- package/lib/stories/{resizing-questionnaire → behaviour/resizing}/test.stories.js +3 -3
- package/lib/stories/suggester/suggester-workers.stories.js +36 -1
- package/lib/stories/suggester/suggester.stories.js +8 -4
- package/lib/use-lunatic/actions.js +3 -3
- package/lib/use-lunatic/commons/calculated-variables.js +104 -0
- package/lib/use-lunatic/commons/compile-controls.js +5 -3
- package/lib/use-lunatic/commons/execute-condition-filter.js +9 -1
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +233 -0
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.spec.js +155 -0
- package/lib/use-lunatic/commons/execute-expression/create-memoizer.js +63 -0
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +149 -0
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.spec.js +130 -0
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +90 -0
- package/lib/use-lunatic/commons/execute-expression/execute-expression.spec.js +38 -0
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.js +40 -0
- package/lib/use-lunatic/commons/execute-expression/get-expressions-variables.spec.js +31 -0
- package/lib/use-lunatic/commons/{fill-components/fill-iterations.js → execute-expression/get-safety-expression.js} +20 -30
- package/lib/use-lunatic/commons/execute-expression/index.js +13 -0
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +3 -2
- package/lib/use-lunatic/{reducer/reduce-handle-change.js → commons/fill-components/fill-component-required.js} +8 -14
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js +7 -21
- package/lib/use-lunatic/commons/fill-components/fill-components.js +4 -5
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +2 -0
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +13 -6
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +5 -58
- package/lib/use-lunatic/commons/get-compatible-vtl-expression.js +0 -1
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +174 -0
- package/lib/use-lunatic/commons/get-component-value/index.js +13 -0
- package/lib/use-lunatic/commons/get-data.js +80 -0
- package/lib/use-lunatic/commons/index.js +21 -0
- package/lib/use-lunatic/initial-state.js +4 -6
- package/lib/use-lunatic/reducer/overview/overview-on-change.js +1 -1
- package/lib/use-lunatic/reducer/reduce-handle-change/__mocks__/source-cleaning-loop.json +792 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/index.js +13 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +78 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.spec.js +46 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +115 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +89 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +88 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +119 -0
- package/lib/use-lunatic/{commons/variables/get-questionnaire-data.js → reducer/reduce-handle-change/reduce-variables-array.js} +32 -53
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +28 -0
- package/lib/use-lunatic/reducer/reduce-on-init.js +184 -90
- package/lib/use-lunatic/reducer/reduce-on-init.spec.js +17 -0
- package/lib/use-lunatic/reducer/reducer.js +2 -2
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +4 -2
- package/lib/use-lunatic/use-lunatic.js +29 -22
- package/lib/use-lunatic/use-lunatic.test.js +36 -133
- package/lib/use-lunatic/use-suggesters.js +4 -3
- package/lib/utils/array.js +6 -57
- package/lib/utils/get-component-value.js +9 -3
- package/lib/utils/number.js +1 -13
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +4 -3
- package/lib/utils/suggester-workers/searching/meloto-order.js +6 -5
- package/lib/utils/suggester-workers/worker-path.js +29 -0
- package/lib/utils/vtl/dataset-builder.js +27 -0
- package/lib/utils/vtl/index.js +13 -0
- package/package.json +15 -10
- package/scripts/build/add-workers-to-public.js +44 -0
- package/scripts/build/workers-paths.js +44 -0
- package/workers-release/lunatic-append-worker-0.3.0-experimental.js +2 -0
- package/workers-release/lunatic-append-worker-0.3.0-experimental.js.LICENSE.txt +34 -0
- package/workers-release/lunatic-label-worker-0.3.0-experimental.js +2 -0
- package/workers-release/lunatic-label-worker-0.3.0-experimental.js.LICENSE.txt +13 -0
- package/workers-release/lunatic-searching-worker-0.3.0-experimental.js +2 -0
- package/workers-release/lunatic-searching-worker-0.3.0-experimental.js.LICENSE.txt +34 -0
- package/lib/hooks/use-track-changes.js +0 -50
- package/lib/src/hooks/use-track-changes.d.ts +0 -9
- package/lib/src/use-lunatic/commons/component.d.ts +0 -22
- package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +0 -112
- package/lib/src/use-lunatic/commons/variables/behaviours/cleaning-behaviour.d.ts +0 -7
- package/lib/src/use-lunatic/commons/variables/behaviours/missing-behaviour.d.ts +0 -7
- package/lib/src/use-lunatic/commons/variables/behaviours/resizing-behaviour.d.ts +0 -7
- package/lib/src/use-lunatic/commons/variables/get-questionnaire-data.d.ts +0 -4
- package/lib/src/use-lunatic/commons/variables/lunatic-variables-store.d.ts +0 -77
- package/lib/src/use-lunatic/reducer/reduce-handle-change.d.ts +0 -6
- package/lib/src/utils/env.d.ts +0 -1
- package/lib/src/utils/store-tools/worker-path.d.ts +0 -1
- package/lib/src/utils/variables.d.ts +0 -5
- package/lib/src/utils/vtl.d.ts +0 -14
- package/lib/use-lunatic/commons/component.js +0 -22
- package/lib/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +0 -39
- package/lib/use-lunatic/commons/variables/behaviours/missing-behaviour.js +0 -47
- package/lib/use-lunatic/commons/variables/behaviours/resizing-behaviour.js +0 -78
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.js +0 -330
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.spec.js +0 -216
- package/lib/utils/array.spec.js +0 -30
- package/lib/utils/env.js +0 -10
- package/lib/utils/store-tools/worker-path.js +0 -13
- package/lib/utils/suggester-workers/create-worker.js +0 -55
- package/lib/utils/variables.js +0 -37
- package/lib/utils/vtl.js +0 -100
- /package/lib/src/use-lunatic/commons/{variables/lunatic-variables-store.spec.d.ts → execute-expression/create-refresh-calculated.spec.d.ts} +0 -0
- /package/lib/src/{utils/array.spec.d.ts → use-lunatic/commons/execute-expression/execute-expression.spec.d.ts} +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_Controles_BouclesLiees2_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_Controles_BouclesLiees_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/boucles-n.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/controls-externes.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/controls-externes.stories.js +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_DeclarationsSimples.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_MinMaxSum_Boucles.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_QuestSimple_Boucles.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_TCMRallyeGames.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/test-dylan.json +0 -0
- /package/lib/stories/{paste-questionnaire → behaviour/paste}/source.json +0 -0
- /package/lib/stories/{resizing-questionnaire → behaviour/resizing}/source.json +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Snowball JavaScript Library v0.3
|
|
3
|
+
* http://code.google.com/p/urim/
|
|
4
|
+
* http://snowball.tartarus.org/
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2010, Oleg Mazko
|
|
7
|
+
* http://www.mozilla.org/MPL/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*!
|
|
11
|
+
* array-last <https://github.com/jonschlinkert/array-last>
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
14
|
+
* Released under the MIT License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/*!
|
|
18
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
21
|
+
* Released under the MIT License.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useTrackChanges = useTrackChanges;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _useRefSync = require("./use-ref-sync");
|
|
9
|
-
/**
|
|
10
|
-
* Allow tracking changed while interacting with Lunatic forms
|
|
11
|
-
*/
|
|
12
|
-
function useTrackChanges(enabled, store, getData) {
|
|
13
|
-
// Saves the list of changed variable
|
|
14
|
-
var changedVariables = (0, _react.useRef)(new Set());
|
|
15
|
-
// Use ref to avoid dependencies in useCallback
|
|
16
|
-
var enabledRef = (0, _useRefSync.useRefSync)(enabled);
|
|
17
|
-
var getDataRef = (0, _useRefSync.useRefSync)(getData);
|
|
18
|
-
(0, _react.useEffect)(function () {
|
|
19
|
-
if (!enabled || !store) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
var handleChange = function handleChange(e) {
|
|
23
|
-
changedVariables.current.add(e.detail.name);
|
|
24
|
-
};
|
|
25
|
-
store.on('change', handleChange);
|
|
26
|
-
return function () {
|
|
27
|
-
return store.off('change', handleChange);
|
|
28
|
-
};
|
|
29
|
-
}, [enabled, store]);
|
|
30
|
-
|
|
31
|
-
// Reset list of changed variables
|
|
32
|
-
var resetChangedData = (0, _react.useCallback)(function () {
|
|
33
|
-
changedVariables.current.clear();
|
|
34
|
-
}, [changedVariables]);
|
|
35
|
-
var getChangedData = (0, _react.useCallback)(function () {
|
|
36
|
-
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
37
|
-
if (!enabledRef.current) {
|
|
38
|
-
throw new Error('getChangedData() cannot be used without enabling tracking mode, add "trackChanges: true" to useLunatic options');
|
|
39
|
-
}
|
|
40
|
-
var data = getDataRef.current(Array.from(changedVariables.current));
|
|
41
|
-
if (reset) {
|
|
42
|
-
resetChangedData();
|
|
43
|
-
}
|
|
44
|
-
return data;
|
|
45
|
-
}, [enabledRef, getDataRef, resetChangedData]);
|
|
46
|
-
return {
|
|
47
|
-
getChangedData: getChangedData,
|
|
48
|
-
resetChangedData: resetChangedData
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LunaticVariablesStore } from '../use-lunatic/commons/variables/lunatic-variables-store';
|
|
2
|
-
import type { LunaticData } from '../use-lunatic/type';
|
|
3
|
-
/**
|
|
4
|
-
* Allow tracking changed while interacting with Lunatic forms
|
|
5
|
-
*/
|
|
6
|
-
export declare function useTrackChanges(enabled: boolean, store: LunaticVariablesStore, getData: (names: string[]) => LunaticData): {
|
|
7
|
-
getChangedData: (reset?: boolean) => LunaticData;
|
|
8
|
-
resetChangedData: () => void;
|
|
9
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { LunaticComponentDefinition } from '../type';
|
|
3
|
-
export declare function hasResponse(component: unknown): component is {
|
|
4
|
-
response: {
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export declare function hasResponses(component: unknown): component is {
|
|
9
|
-
responses?: Array<{
|
|
10
|
-
label: ReactNode;
|
|
11
|
-
description?: ReactNode;
|
|
12
|
-
response: {
|
|
13
|
-
name: string;
|
|
14
|
-
};
|
|
15
|
-
}>;
|
|
16
|
-
};
|
|
17
|
-
export declare function hasBody(component: unknown): component is {
|
|
18
|
-
body: LunaticComponentDefinition<'Table'>['body'];
|
|
19
|
-
};
|
|
20
|
-
export declare function hasComponentType(component: unknown): component is {
|
|
21
|
-
componentType: string;
|
|
22
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { LunaticComponentDefinition, LunaticState } from '../../type';
|
|
2
|
-
/**
|
|
3
|
-
* Fill the number of iterations for loop components without "iterations" expression
|
|
4
|
-
*/
|
|
5
|
-
export declare function fillIterations(component: LunaticComponentDefinition, state: LunaticState): (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentSequenceType & {
|
|
6
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
7
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentSubSequenceType & {
|
|
8
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
9
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentTableType & {
|
|
10
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
11
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentNumberType & {
|
|
12
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
13
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentDatePickerType & {
|
|
14
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
15
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentCheckboxGroupType & {
|
|
16
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
17
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentCheckboxBooleanType & {
|
|
18
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
19
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentRadioType & {
|
|
20
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
21
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentFilterDescriptionType & {
|
|
22
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
23
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentDropdownType & {
|
|
24
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
25
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentPairWiseLinksType & {
|
|
26
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
27
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentRoundaboutType & {
|
|
28
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
29
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentSuggesterType & {
|
|
30
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
31
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentInputOrTextareaType & {
|
|
32
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
33
|
-
}) | (import("../../type-source").ComponentTypeBase & {
|
|
34
|
-
componentType: "CheckboxOne";
|
|
35
|
-
} & {
|
|
36
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
37
|
-
}) | (import("../../type-source").ComponentTypeBase & {
|
|
38
|
-
componentType: "ConfirmationModal";
|
|
39
|
-
} & {
|
|
40
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
41
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentComponentSetType & {
|
|
42
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
43
|
-
}) | (import("../../type-source").ComponentTypeBase & import("../../type-source").ComponentQuestionExplicationType & {
|
|
44
|
-
componentType: "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Suggester" | "ConfirmationModal" | "ComponentSet" | "Roundabout" | "QuestionExplication";
|
|
45
|
-
}) | {
|
|
46
|
-
iterations: number;
|
|
47
|
-
label: import("../../type-source").LabelType;
|
|
48
|
-
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
49
|
-
conditionFilter: import("../../type-source").ConditionFilterType;
|
|
50
|
-
controls?: import("../../type-source").ControlType[] | undefined;
|
|
51
|
-
id: string;
|
|
52
|
-
bindingDependencies?: string[] | undefined;
|
|
53
|
-
hierarchy: import("../../type-source").Hierarchy;
|
|
54
|
-
mandatory?: boolean | undefined;
|
|
55
|
-
page: string;
|
|
56
|
-
componentType: "Loop";
|
|
57
|
-
loopDependencies: string[];
|
|
58
|
-
lines: {
|
|
59
|
-
min: import("../../type-source").LabelType;
|
|
60
|
-
max: import("../../type-source").LabelType;
|
|
61
|
-
};
|
|
62
|
-
components: import("../../type-source").ComponentType[];
|
|
63
|
-
maxPage: string;
|
|
64
|
-
depth: number;
|
|
65
|
-
paginatedLoop: boolean;
|
|
66
|
-
} | {
|
|
67
|
-
iterations: number;
|
|
68
|
-
label: import("../../type-source").LabelType;
|
|
69
|
-
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
70
|
-
conditionFilter: import("../../type-source").ConditionFilterType;
|
|
71
|
-
controls?: import("../../type-source").ControlType[] | undefined;
|
|
72
|
-
id: string;
|
|
73
|
-
bindingDependencies?: string[] | undefined;
|
|
74
|
-
hierarchy: import("../../type-source").Hierarchy;
|
|
75
|
-
mandatory?: boolean | undefined;
|
|
76
|
-
page: string;
|
|
77
|
-
componentType: "Roundabout";
|
|
78
|
-
components: import("../../type-source").ComponentType[];
|
|
79
|
-
locked: boolean;
|
|
80
|
-
expressions: Record<string, import("../../type-source").LabelType>;
|
|
81
|
-
} | {
|
|
82
|
-
iterations: number;
|
|
83
|
-
label: import("../../type-source").LabelType;
|
|
84
|
-
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
85
|
-
conditionFilter: import("../../type-source").ConditionFilterType;
|
|
86
|
-
controls?: import("../../type-source").ControlType[] | undefined;
|
|
87
|
-
id: string;
|
|
88
|
-
bindingDependencies?: string[] | undefined;
|
|
89
|
-
hierarchy: import("../../type-source").Hierarchy;
|
|
90
|
-
mandatory?: boolean | undefined;
|
|
91
|
-
page: string;
|
|
92
|
-
componentType: "RosterForLoop";
|
|
93
|
-
components: import("../../type-source").ComponentType[];
|
|
94
|
-
lines: {
|
|
95
|
-
min: import("../../type-source").LabelType;
|
|
96
|
-
max: import("../../type-source").LabelType;
|
|
97
|
-
};
|
|
98
|
-
header: {
|
|
99
|
-
value: string;
|
|
100
|
-
label: string | import("../../type-source").LabelType;
|
|
101
|
-
options: {
|
|
102
|
-
value: string;
|
|
103
|
-
label: import("../../type-source").LabelType;
|
|
104
|
-
}[];
|
|
105
|
-
colspan?: number | undefined;
|
|
106
|
-
rowspan?: number | undefined;
|
|
107
|
-
}[];
|
|
108
|
-
body: (import("../../type-source").ComponentType | {
|
|
109
|
-
label: import("../../type-source").LabelType;
|
|
110
|
-
})[][];
|
|
111
|
-
positioning: "HORIZONTAL";
|
|
112
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LunaticVariablesStore } from '../lunatic-variables-store';
|
|
2
|
-
import type { LunaticSource } from '../../../type-source';
|
|
3
|
-
/**
|
|
4
|
-
* Cleaning behaviour for the store
|
|
5
|
-
* When a variable changes, other variables can be reset
|
|
6
|
-
*/
|
|
7
|
-
export declare function cleaningBehaviour(store: LunaticVariablesStore, cleaning: LunaticSource['cleaning'], initialValues?: Record<string, unknown>): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LunaticVariablesStore } from '../lunatic-variables-store';
|
|
2
|
-
import type { LunaticSource } from '../../../type-source';
|
|
3
|
-
/**
|
|
4
|
-
* Add missing behaviour to the store
|
|
5
|
-
* Missing works as a simplified cleaning that reset a linked variable
|
|
6
|
-
*/
|
|
7
|
-
export declare function missingBehaviour(store: LunaticVariablesStore, missing: LunaticSource['missingBlock']): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LunaticVariablesStore } from '../lunatic-variables-store';
|
|
2
|
-
import type { LunaticSource } from '../../../type-source';
|
|
3
|
-
/**
|
|
4
|
-
* Resizing behaviour for the store
|
|
5
|
-
* When a variable changes, multiple other variables can change size (size of the array)
|
|
6
|
-
*/
|
|
7
|
-
export declare function resizingBehaviour(store: LunaticVariablesStore, resizing: LunaticSource['resizing']): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LunaticVariablesStore } from './lunatic-variables-store';
|
|
2
|
-
import type { LunaticSource } from '../../type-source';
|
|
3
|
-
import type { LunaticData } from '../../type';
|
|
4
|
-
export declare function getQuestionnaireData(store: LunaticVariablesStore, variables: LunaticSource['variables'], withCalculated?: boolean, variableNames?: string[]): LunaticData;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { LunaticSource } from '../../type-source';
|
|
2
|
-
import type { LunaticData } from '../../type';
|
|
3
|
-
type IterationLevel = number[];
|
|
4
|
-
type EventArgs = {
|
|
5
|
-
change: {
|
|
6
|
-
name: string;
|
|
7
|
-
value: unknown;
|
|
8
|
-
iteration?: IterationLevel | undefined;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export type LunaticVariablesStoreEvent<T extends keyof EventArgs> = {
|
|
12
|
-
detail: EventArgs[T];
|
|
13
|
-
};
|
|
14
|
-
export declare class LunaticVariablesStore {
|
|
15
|
-
private dictionary;
|
|
16
|
-
private eventTarget;
|
|
17
|
-
constructor();
|
|
18
|
-
static makeFromSource(source: LunaticSource, data: LunaticData): LunaticVariablesStore;
|
|
19
|
-
/**
|
|
20
|
-
* Retrieve variable value
|
|
21
|
-
*/
|
|
22
|
-
get<T>(name: string, iteration?: IterationLevel): T | null;
|
|
23
|
-
/**
|
|
24
|
-
* Set variable value
|
|
25
|
-
*/
|
|
26
|
-
set(name: string, value: unknown, args?: Pick<EventArgs['change'], 'iteration'>): LunaticVariable;
|
|
27
|
-
/**
|
|
28
|
-
* Register calculated variable
|
|
29
|
-
*/
|
|
30
|
-
setCalculated(name: string, expression: string, { dependencies, iterationDepth, }?: {
|
|
31
|
-
dependencies?: string[];
|
|
32
|
-
iterationDepth?: number;
|
|
33
|
-
}): LunaticVariable;
|
|
34
|
-
/**
|
|
35
|
-
* Run a VTL expression
|
|
36
|
-
*/
|
|
37
|
-
run(expression: string, args?: {
|
|
38
|
-
iteration?: IterationLevel;
|
|
39
|
-
deps?: string[];
|
|
40
|
-
}): unknown;
|
|
41
|
-
/**
|
|
42
|
-
* Bind event listeners
|
|
43
|
-
*/
|
|
44
|
-
on<T extends keyof EventArgs>(eventName: T, cb: (e: CustomEvent<EventArgs[T]>) => void): void;
|
|
45
|
-
/**
|
|
46
|
-
* Detach a listener
|
|
47
|
-
*/
|
|
48
|
-
off<T extends keyof EventArgs>(eventName: T, cb: (e: CustomEvent<EventArgs[T]>) => void): void;
|
|
49
|
-
get interpretCount(): number;
|
|
50
|
-
}
|
|
51
|
-
declare class LunaticVariable {
|
|
52
|
-
updatedAt: Map<string | undefined, number>;
|
|
53
|
-
private calculatedAt;
|
|
54
|
-
private value;
|
|
55
|
-
private dependencies?;
|
|
56
|
-
private readonly expression?;
|
|
57
|
-
private readonly dictionary?;
|
|
58
|
-
private readonly iterationDepth?;
|
|
59
|
-
private readonly name?;
|
|
60
|
-
constructor(args?: {
|
|
61
|
-
expression?: string;
|
|
62
|
-
dependencies?: string[];
|
|
63
|
-
dictionary?: Map<string, LunaticVariable>;
|
|
64
|
-
iterationDepth?: number;
|
|
65
|
-
name?: string;
|
|
66
|
-
});
|
|
67
|
-
getValue(iteration?: IterationLevel): unknown;
|
|
68
|
-
/**
|
|
69
|
-
* Set the value and returns true if the variable is touched
|
|
70
|
-
*/
|
|
71
|
-
setValue(value: unknown, iteration?: IterationLevel): boolean;
|
|
72
|
-
private getSavedValue;
|
|
73
|
-
private getDependencies;
|
|
74
|
-
private getDependenciesValues;
|
|
75
|
-
private isOutdated;
|
|
76
|
-
}
|
|
77
|
-
export {};
|
package/lib/src/utils/env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isTestEnv(): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getWorkerPath(): string;
|
package/lib/src/utils/vtl.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simplified version of interpret (that converts binding and value)
|
|
3
|
-
*/
|
|
4
|
-
export declare function interpretVTL<T>(expression: string, bindings: Record<string, unknown>): T;
|
|
5
|
-
/**
|
|
6
|
-
* Extract variables used in a VTL expression
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseVTLVariables(expression: string): string[];
|
|
9
|
-
/**
|
|
10
|
-
* Transform a value to make it compatible with VTL (for bindings)
|
|
11
|
-
*/
|
|
12
|
-
export declare function getVTLCompatibleValue(value: unknown): {} | null;
|
|
13
|
-
export declare function getExpressionType(expression: unknown): string;
|
|
14
|
-
export declare function getExpressionAsString(expression: unknown): string;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.hasBody = hasBody;
|
|
7
|
-
exports.hasComponentType = hasComponentType;
|
|
8
|
-
exports.hasResponse = hasResponse;
|
|
9
|
-
exports.hasResponses = hasResponses;
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
11
|
-
function hasResponse(component) {
|
|
12
|
-
return !!component && _typeof(component) === 'object' && 'response' in component && 'name' in component.response;
|
|
13
|
-
}
|
|
14
|
-
function hasResponses(component) {
|
|
15
|
-
return !!component && _typeof(component) === 'object' && 'responses' in component;
|
|
16
|
-
}
|
|
17
|
-
function hasBody(component) {
|
|
18
|
-
return !!component && _typeof(component) === 'object' && 'body' in component && Array.isArray(component.body);
|
|
19
|
-
}
|
|
20
|
-
function hasComponentType(component) {
|
|
21
|
-
return !!component && _typeof(component) === 'object' && 'componentType' in component && typeof component.componentType === 'string';
|
|
22
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cleaningBehaviour = cleaningBehaviour;
|
|
7
|
-
/**
|
|
8
|
-
* Cleaning behaviour for the store
|
|
9
|
-
* When a variable changes, other variables can be reset
|
|
10
|
-
*/
|
|
11
|
-
function cleaningBehaviour(store, cleaning) {
|
|
12
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
13
|
-
if (!cleaning) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Create a map to improve performance
|
|
18
|
-
var cleaningMap = new Map(Object.entries(cleaning));
|
|
19
|
-
store.on('change', function (e) {
|
|
20
|
-
var cleaningInfo = cleaningMap.get(e.detail.name);
|
|
21
|
-
|
|
22
|
-
// The variable does not have cleaning
|
|
23
|
-
if (!cleaningInfo) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
for (var variableName in cleaningInfo) {
|
|
27
|
-
var _initialValues$variab;
|
|
28
|
-
var skipCleaning = store.run(cleaningInfo[variableName], {
|
|
29
|
-
iteration: e.detail.iteration
|
|
30
|
-
});
|
|
31
|
-
if (skipCleaning) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
store.set(variableName, (_initialValues$variab = initialValues[variableName]) !== null && _initialValues$variab !== void 0 ? _initialValues$variab : null, {
|
|
35
|
-
iteration: e.detail.iteration
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.missingBehaviour = missingBehaviour;
|
|
7
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
10
|
-
/**
|
|
11
|
-
* Add missing behaviour to the store
|
|
12
|
-
* Missing works as a simplified cleaning that reset a linked variable
|
|
13
|
-
*/
|
|
14
|
-
function missingBehaviour(store, missing) {
|
|
15
|
-
if (!missing) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Create a map to improve performance
|
|
20
|
-
var missingMap = new Map(Object.entries(missing));
|
|
21
|
-
store.on('change', function (e) {
|
|
22
|
-
// Only clean if a value is set
|
|
23
|
-
if (e.detail.value === null || e.detail.value === undefined) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
var linkedVariables = missingMap.get(e.detail.name);
|
|
27
|
-
|
|
28
|
-
// The variable does not have missing variable linked
|
|
29
|
-
if (!linkedVariables) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
var _iterator = _createForOfIteratorHelper(linkedVariables),
|
|
33
|
-
_step;
|
|
34
|
-
try {
|
|
35
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
36
|
-
var variableName = _step.value;
|
|
37
|
-
store.set(variableName, null, {
|
|
38
|
-
iteration: e.detail.iteration
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
} catch (err) {
|
|
42
|
-
_iterator.e(err);
|
|
43
|
-
} finally {
|
|
44
|
-
_iterator.f();
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.resizingBehaviour = resizingBehaviour;
|
|
7
|
-
var _number = require("../../../../utils/number");
|
|
8
|
-
var _commons = require("../../../reducer/commons");
|
|
9
|
-
var _vtl = require("../../../../utils/vtl");
|
|
10
|
-
var _array = require("../../../../utils/array");
|
|
11
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
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."); }
|
|
13
|
-
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; } }
|
|
14
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
16
|
-
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
|
-
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; }
|
|
18
|
-
/**
|
|
19
|
-
* Resizing behaviour for the store
|
|
20
|
-
* When a variable changes, multiple other variables can change size (size of the array)
|
|
21
|
-
*/
|
|
22
|
-
function resizingBehaviour(store, resizing) {
|
|
23
|
-
if (!resizing) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Create a map to improve performance
|
|
28
|
-
var resizingMap = new Map(Object.entries(resizing));
|
|
29
|
-
store.on('change', function (e) {
|
|
30
|
-
// The variable does not have resizing
|
|
31
|
-
var resizingInfo = resizingMap.get(e.detail.name);
|
|
32
|
-
if (!resizingInfo) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Pairwise resizing
|
|
37
|
-
if ('sizeForLinksVariables' in resizingInfo) {
|
|
38
|
-
resizePairwise(store, resizingInfo, e.detail);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!resizingInfo.size) {
|
|
42
|
-
throw new Error("Cannot resize ".concat(e.detail.name, " missing \"size\" property"));
|
|
43
|
-
}
|
|
44
|
-
var newSize = (0, _number.forceInt)(store.run(resizingInfo.size));
|
|
45
|
-
var _iterator = _createForOfIteratorHelper(resizingInfo.variables),
|
|
46
|
-
_step;
|
|
47
|
-
try {
|
|
48
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
49
|
-
var variableName = _step.value;
|
|
50
|
-
var value = store.get(variableName);
|
|
51
|
-
if (!Array.isArray(value) || value.length !== newSize) {
|
|
52
|
-
store.set(variableName, (0, _commons.resizeArrayVariable)(value, newSize, null));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
} catch (err) {
|
|
56
|
-
_iterator.e(err);
|
|
57
|
-
} finally {
|
|
58
|
-
_iterator.f();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function resizePairwise(store, resizingInfo, args) {
|
|
63
|
-
var _resizingInfo$sizeFor = resizingInfo.sizeForLinksVariables.map(function (expression) {
|
|
64
|
-
return (0, _number.forceInt)(store.run((0, _vtl.getExpressionAsString)(expression)));
|
|
65
|
-
}),
|
|
66
|
-
_resizingInfo$sizeFor2 = _slicedToArray(_resizingInfo$sizeFor, 2),
|
|
67
|
-
xSize = _resizingInfo$sizeFor2[0],
|
|
68
|
-
ySize = _resizingInfo$sizeFor2[1];
|
|
69
|
-
resizingInfo.linksVariables.forEach(function (variable) {
|
|
70
|
-
var value = store.get(variable, args.iteration);
|
|
71
|
-
var resizedValue = (0, _array.resizeArray)(
|
|
72
|
-
// The value is not an array, force an array
|
|
73
|
-
Array.isArray(value) ? value.map(function (i) {
|
|
74
|
-
return (0, _array.resizeArray)(i, ySize, null);
|
|
75
|
-
}) : [], xSize, new Array(ySize).fill(null));
|
|
76
|
-
store.set(variable, resizedValue);
|
|
77
|
-
});
|
|
78
|
-
}
|