@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
|
@@ -10,12 +10,6 @@ var _reactNumberFormat = require("react-number-format");
|
|
|
10
10
|
var _i18n = require("../../../i18n");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
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."); }
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
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
13
|
var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
20
14
|
var id = _ref.id,
|
|
21
15
|
onChange = _ref.onChange,
|
|
@@ -24,14 +18,9 @@ var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
|
24
18
|
readOnly = _ref.readOnly,
|
|
25
19
|
required = _ref.required,
|
|
26
20
|
labelId = _ref.labelId,
|
|
27
|
-
min = _ref.min,
|
|
28
21
|
max = _ref.max,
|
|
29
|
-
decimals = _ref.decimals
|
|
30
|
-
|
|
31
|
-
// Computing step attribute of input according to decimal number
|
|
32
|
-
var _useState = (0, _react.useState)(decimals ? 1 / Math.pow(10, decimals) : 1),
|
|
33
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
34
|
-
step = _useState2[0];
|
|
22
|
+
decimals = _ref.decimals,
|
|
23
|
+
invalid = _ref.invalid;
|
|
35
24
|
var handleChange = (0, _react.useCallback)(function (e) {
|
|
36
25
|
var _e$floatValue;
|
|
37
26
|
var val = (_e$floatValue = e.floatValue) !== null && _e$floatValue !== void 0 ? _e$floatValue : null;
|
|
@@ -49,9 +38,6 @@ var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
|
49
38
|
}),
|
|
50
39
|
onValueChange: handleChange,
|
|
51
40
|
value: value !== null && value !== void 0 ? value : '',
|
|
52
|
-
min: min,
|
|
53
|
-
max: max,
|
|
54
|
-
step: step,
|
|
55
41
|
"aria-labelledby": labelId,
|
|
56
42
|
disabled: disabled,
|
|
57
43
|
readOnly: readOnly,
|
|
@@ -63,7 +49,8 @@ var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
|
63
49
|
decimalScale: decimals,
|
|
64
50
|
allowLeadingZeros: true,
|
|
65
51
|
thousandSeparator: _i18n.inputNumberPropsI18N.thousandSeparator,
|
|
66
|
-
inputMode: decimals ? 'decimal' : 'numeric'
|
|
52
|
+
inputMode: decimals ? 'decimal' : 'numeric',
|
|
53
|
+
"aria-invalid": invalid
|
|
67
54
|
});
|
|
68
55
|
};
|
|
69
56
|
var _default = InputNumberThousand;
|
|
@@ -20,7 +20,6 @@ function InputNumber(_ref) {
|
|
|
20
20
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
21
21
|
_ref$readOnly = _ref.readOnly,
|
|
22
22
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
23
|
-
min = _ref.min,
|
|
24
23
|
max = _ref.max,
|
|
25
24
|
_ref$decimals = _ref.decimals,
|
|
26
25
|
decimals = _ref$decimals === void 0 ? 0 : _ref$decimals,
|
|
@@ -46,14 +45,13 @@ function InputNumber(_ref) {
|
|
|
46
45
|
readOnly: readOnly,
|
|
47
46
|
required: required,
|
|
48
47
|
labelId: labelId,
|
|
49
|
-
min: min,
|
|
50
48
|
max: max,
|
|
51
|
-
decimals: decimals
|
|
49
|
+
decimals: decimals,
|
|
50
|
+
invalid: !!errors
|
|
52
51
|
}), unit && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
53
52
|
children: unit
|
|
54
53
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.Errors, {
|
|
55
|
-
errors: errors
|
|
56
|
-
activeId: id
|
|
54
|
+
errors: errors
|
|
57
55
|
})]
|
|
58
56
|
});
|
|
59
57
|
}
|
|
@@ -7,6 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _lunaticComponentWithoutLabel = _interopRequireDefault(require("../commons/components/lunatic-component-without-label"));
|
|
8
8
|
var _useOnHandleChange = _interopRequireDefault(require("../commons/use-on-handle-change"));
|
|
9
9
|
var _inputNumber = _interopRequireDefault(require("./html/input-number"));
|
|
10
|
+
var _errors = require("../commons/components/errors/errors");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
13
|
function LunaticInputNumber(props) {
|
|
@@ -22,7 +23,6 @@ function LunaticInputNumber(props) {
|
|
|
22
23
|
missing = props.missing,
|
|
23
24
|
missingResponse = props.missingResponse,
|
|
24
25
|
management = props.management,
|
|
25
|
-
min = props.min,
|
|
26
26
|
max = props.max,
|
|
27
27
|
decimals = props.decimals,
|
|
28
28
|
unit = props.unit,
|
|
@@ -51,12 +51,11 @@ function LunaticInputNumber(props) {
|
|
|
51
51
|
label: label,
|
|
52
52
|
disabled: disabled,
|
|
53
53
|
readOnly: readOnly,
|
|
54
|
-
min: min,
|
|
55
54
|
max: max,
|
|
56
55
|
decimals: decimals,
|
|
57
56
|
unit: unit,
|
|
58
57
|
required: required,
|
|
59
|
-
errors: errors
|
|
58
|
+
errors: (0, _errors.getComponentErrors)(errors, id)
|
|
60
59
|
})
|
|
61
60
|
});
|
|
62
61
|
}
|
|
@@ -9,6 +9,7 @@ var _react = require("react");
|
|
|
9
9
|
var _i18n = _interopRequireDefault(require("../../i18n"));
|
|
10
10
|
var _commons = require("../commons");
|
|
11
11
|
var _declarations = require("../declarations");
|
|
12
|
+
var _getInitialNbRows = require("./utils/get-initial-nb-rows");
|
|
12
13
|
var _loopButton = require("./loop-button");
|
|
13
14
|
var _lunaticComponents = require("../lunatic-components");
|
|
14
15
|
var _array = require("../../utils/array");
|
|
@@ -28,7 +29,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /**
|
|
|
28
29
|
* Loop without specific markup
|
|
29
30
|
*/
|
|
30
31
|
var BlockForLoop = (0, _commons.createCustomizableLunaticField)(function (props) {
|
|
31
|
-
var _lines$min, _lines$max;
|
|
32
32
|
var declarations = props.declarations,
|
|
33
33
|
id = props.id,
|
|
34
34
|
label = props.label,
|
|
@@ -37,11 +37,15 @@ var BlockForLoop = (0, _commons.createCustomizableLunaticField)(function (props)
|
|
|
37
37
|
value = props.value,
|
|
38
38
|
iterations = props.iterations,
|
|
39
39
|
getComponents = props.getComponents;
|
|
40
|
-
var min =
|
|
41
|
-
var max =
|
|
42
|
-
var canControlRows = min !== max;
|
|
40
|
+
var min = lines === null || lines === void 0 ? void 0 : lines.min;
|
|
41
|
+
var max = lines === null || lines === void 0 ? void 0 : lines.max;
|
|
43
42
|
var _useState = (0, _react.useState)(function () {
|
|
44
|
-
|
|
43
|
+
if (iterations) {
|
|
44
|
+
//This should be an Integer
|
|
45
|
+
return Number.parseInt(iterations.toString());
|
|
46
|
+
}
|
|
47
|
+
var initLength = (0, _getInitialNbRows.getInitialNbRows)(value);
|
|
48
|
+
return Math.max(initLength, min);
|
|
45
49
|
}),
|
|
46
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
47
51
|
nbRows = _useState2[0],
|
|
@@ -90,7 +94,7 @@ var BlockForLoop = (0, _commons.createCustomizableLunaticField)(function (props)
|
|
|
90
94
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
91
95
|
declarations: declarations,
|
|
92
96
|
id: id
|
|
93
|
-
}),
|
|
97
|
+
}), Number.isInteger(min) && Number.isInteger(max) && min !== max && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
94
98
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_loopButton.LoopButton, {
|
|
95
99
|
onClick: addRow,
|
|
96
100
|
disabled: nbRows === max,
|
|
@@ -10,8 +10,9 @@ var _declarations = require("../../declarations");
|
|
|
10
10
|
var _commons = require("../../commons");
|
|
11
11
|
var _loopButton = require("../loop-button");
|
|
12
12
|
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
13
|
+
var _getInitialNbRows = require("../utils/get-initial-nb-rows");
|
|
13
14
|
var _htmlTable = require("../../commons/components/html-table");
|
|
14
|
-
var
|
|
15
|
+
var _header = _interopRequireDefault(require("../../table/header"));
|
|
15
16
|
var _array = require("../../../utils/array");
|
|
16
17
|
var _lunaticComponents = require("../../lunatic-components");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -40,12 +41,12 @@ var RosterForLoop = (0, _commons.createCustomizableLunaticField)(function (props
|
|
|
40
41
|
declarations = props.declarations,
|
|
41
42
|
label = props.label,
|
|
42
43
|
headers = props.headers,
|
|
43
|
-
|
|
44
|
-
id = props.id,
|
|
45
|
-
getComponents = props.getComponents;
|
|
44
|
+
id = props.id;
|
|
46
45
|
var min = (lines === null || lines === void 0 ? void 0 : lines.min) || DEFAULT_MIN_ROWS;
|
|
47
46
|
var max = (lines === null || lines === void 0 ? void 0 : lines.max) || DEFAULT_MAX_ROWS;
|
|
48
|
-
var _useState = (0, _react.useState)(
|
|
47
|
+
var _useState = (0, _react.useState)(function () {
|
|
48
|
+
return (0, _getInitialNbRows.getInitialNbRows)(valueMap);
|
|
49
|
+
}),
|
|
49
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50
51
|
nbRows = _useState2[0],
|
|
51
52
|
setNbRows = _useState2[1];
|
|
@@ -85,32 +86,16 @@ var RosterForLoop = (0, _commons.createCustomizableLunaticField)(function (props
|
|
|
85
86
|
id: id
|
|
86
87
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_htmlTable.Table, {
|
|
87
88
|
id: id,
|
|
88
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
89
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_header["default"], {
|
|
89
90
|
header: headers,
|
|
90
91
|
id: id
|
|
91
92
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Tbody, {
|
|
92
93
|
id: id,
|
|
93
94
|
children: (0, _array.times)(nbRows, function (n) {
|
|
94
|
-
return /*#__PURE__*/(0,
|
|
95
|
-
|
|
96
|
-
row: n
|
|
97
|
-
|
|
98
|
-
components: getComponents(n),
|
|
99
|
-
componentProps: function componentProps(c) {
|
|
100
|
-
return _objectSpread(_objectSpread(_objectSpread({}, props), c), {}, {
|
|
101
|
-
id: "".concat(c.id, "-").concat(n)
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
wrapper: function wrapper(_ref3) {
|
|
105
|
-
var id = _ref3.id,
|
|
106
|
-
children = _ref3.children;
|
|
107
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Td, {
|
|
108
|
-
id: "".concat(id, "-").concat(n),
|
|
109
|
-
children: children
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
});
|
|
95
|
+
return /*#__PURE__*/(0, _react.createElement)(Row, _objectSpread(_objectSpread({}, props), {}, {
|
|
96
|
+
key: n,
|
|
97
|
+
row: n
|
|
98
|
+
}));
|
|
114
99
|
})
|
|
115
100
|
})]
|
|
116
101
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
@@ -129,4 +114,27 @@ var RosterForLoop = (0, _commons.createCustomizableLunaticField)(function (props
|
|
|
129
114
|
})]
|
|
130
115
|
});
|
|
131
116
|
}, 'RosterforLoop');
|
|
132
|
-
exports.RosterForLoop = RosterForLoop;
|
|
117
|
+
exports.RosterForLoop = RosterForLoop;
|
|
118
|
+
function Row(props) {
|
|
119
|
+
var components = props.getComponents(props.row);
|
|
120
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Tr, {
|
|
121
|
+
id: props.id,
|
|
122
|
+
row: props.row,
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponents.LunaticComponents, {
|
|
124
|
+
components: components,
|
|
125
|
+
componentProps: function componentProps(c) {
|
|
126
|
+
return _objectSpread(_objectSpread(_objectSpread({}, props), c), {}, {
|
|
127
|
+
id: "".concat(c.id, "-").concat(props.row)
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
wrapper: function wrapper(_ref3) {
|
|
131
|
+
var id = _ref3.id,
|
|
132
|
+
children = _ref3.children;
|
|
133
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Td, {
|
|
134
|
+
id: "".concat(id, "-").concat(props.row),
|
|
135
|
+
children: children
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getInitialNbRows = getInitialNbRows;
|
|
7
|
+
/**
|
|
8
|
+
* Find the length of the variable (the biggest value sent to the loop)
|
|
9
|
+
*/
|
|
10
|
+
function getInitialNbRows(value) {
|
|
11
|
+
return Object.values(value).reduce(function (length, variable) {
|
|
12
|
+
if (Array.isArray(variable)) {
|
|
13
|
+
return Math.max(length, variable.length);
|
|
14
|
+
}
|
|
15
|
+
return length;
|
|
16
|
+
}, 1);
|
|
17
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.LunaticComponents = LunaticComponents;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var lunaticComponents = _interopRequireWildcard(require("./index"));
|
|
9
|
-
var
|
|
9
|
+
var _useAutoFocus = require("../hooks/use-auto-focus");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -33,37 +33,17 @@ function LunaticComponents(_ref) {
|
|
|
33
33
|
} : _ref$wrapper;
|
|
34
34
|
var wrapperRef = (0, _react.useRef)(null);
|
|
35
35
|
var hasComponents = components.length > 0;
|
|
36
|
-
(0, _react.useEffect)(function () {
|
|
37
|
-
var _wrapperRef$current;
|
|
38
|
-
if (!autoFocusKey || !hasComponents || !wrapperRef.current) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
var firstFocusableElement = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
42
|
-
// The first element can be focusable
|
|
43
|
-
if (firstFocusableElement) {
|
|
44
|
-
return firstFocusableElement.focus();
|
|
45
|
-
}
|
|
46
|
-
}, [autoFocusKey, hasComponents]);
|
|
47
36
|
var WrapperComponent = autoFocusKey ? 'div' : _react.Fragment;
|
|
37
|
+
(0, _useAutoFocus.useAutoFocus)(wrapperRef, hasComponents ? autoFocusKey : undefined);
|
|
48
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrapperComponent, {
|
|
49
39
|
ref: WrapperComponent === _react.Fragment ? undefined : wrapperRef,
|
|
50
40
|
children: components.map(function (component, k) {
|
|
51
|
-
|
|
52
|
-
var _props = _objectSpread(_objectSpread({}, component), componentProps === null || componentProps === void 0 ? void 0 : componentProps(component));
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
54
|
-
children: wrapper(_objectSpread({
|
|
55
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(LunaticComponent, _objectSpread({}, _props)),
|
|
56
|
-
index: k
|
|
57
|
-
}, _props))
|
|
58
|
-
}, 'id' in component ? component.id : "index-".concat(k));
|
|
59
|
-
}
|
|
60
|
-
// In some case (table for instance) we have static component that only have a label (no componentType)
|
|
41
|
+
var props = _objectSpread(_objectSpread({}, component), componentProps === null || componentProps === void 0 ? void 0 : componentProps(component));
|
|
61
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
62
|
-
children: wrapper({
|
|
63
|
-
children:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, "index-".concat(k));
|
|
43
|
+
children: wrapper(_objectSpread({
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(LunaticComponent, _objectSpread({}, props))
|
|
45
|
+
}, props))
|
|
46
|
+
}, 'id' in component ? component.id : "index-".concat(k));
|
|
67
47
|
})
|
|
68
48
|
});
|
|
69
49
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _pairwiseLinks["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _pairwiseLinks = _interopRequireDefault(require("./pairwise-links"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _row = _interopRequireDefault(require("./row"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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 _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); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
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; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
function LinksOrchestrator(props) {
|
|
18
|
+
var id = props.id,
|
|
19
|
+
components = props.components,
|
|
20
|
+
nbRows = props.nbRows,
|
|
21
|
+
valueMap = props.value,
|
|
22
|
+
handleChange = props.handleChange,
|
|
23
|
+
features = props.features,
|
|
24
|
+
missing = props.missing,
|
|
25
|
+
className = props.className,
|
|
26
|
+
shortcut = props.shortcut,
|
|
27
|
+
preferences = props.preferences,
|
|
28
|
+
executeExpression = props.executeExpression,
|
|
29
|
+
iteration = props.iteration,
|
|
30
|
+
xAxisIterations = props.xAxisIterations,
|
|
31
|
+
yAxisIterations = props.yAxisIterations,
|
|
32
|
+
errors = props.errors,
|
|
33
|
+
symLinks = props.symLinks;
|
|
34
|
+
var _useState = (0, _react.useState)([xAxisIterations, yAxisIterations]),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
lengths = _useState2[0],
|
|
37
|
+
setLenghts = _useState2[1];
|
|
38
|
+
(0, _react.useEffect)(function () {
|
|
39
|
+
setLenghts([xAxisIterations, yAxisIterations]);
|
|
40
|
+
}, [xAxisIterations, yAxisIterations]);
|
|
41
|
+
if (nbRows <= 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
var items = new Array(nbRows).fill(null);
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
46
|
+
children: items.map(function (_, index) {
|
|
47
|
+
var i = Math.trunc(index / xAxisIterations);
|
|
48
|
+
var j = index % xAxisIterations;
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_row["default"], {
|
|
50
|
+
id: id,
|
|
51
|
+
components: components,
|
|
52
|
+
value: valueMap,
|
|
53
|
+
handleChange: handleChange,
|
|
54
|
+
executeExpression: executeExpression,
|
|
55
|
+
iteration: iteration,
|
|
56
|
+
linksIterations: [i, j],
|
|
57
|
+
lengths: lengths
|
|
58
|
+
/** */,
|
|
59
|
+
features: features,
|
|
60
|
+
shortcut: shortcut,
|
|
61
|
+
className: className,
|
|
62
|
+
preferences: preferences,
|
|
63
|
+
missing: missing,
|
|
64
|
+
errors: errors,
|
|
65
|
+
symLinks: symLinks
|
|
66
|
+
}, index);
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
var _default = LinksOrchestrator;
|
|
71
|
+
exports["default"] = _default;
|
|
@@ -3,26 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _orchestrator = _interopRequireDefault(require("./orchestrator"));
|
|
7
8
|
var _declarations = require("../declarations");
|
|
8
9
|
var _nothingToDisplay = _interopRequireDefault(require("../commons/components/nothing-to-display"));
|
|
9
|
-
var _array = require("../../utils/array");
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _lunaticComponents = require("../lunatic-components");
|
|
12
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
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); }
|
|
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
12
|
var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
21
13
|
var declarations = _ref.declarations,
|
|
14
|
+
components = _ref.components,
|
|
15
|
+
handleChange = _ref.handleChange,
|
|
16
|
+
value = _ref.value,
|
|
17
|
+
missing = _ref.missing,
|
|
18
|
+
shortcut = _ref.shortcut,
|
|
19
|
+
features = _ref.features,
|
|
20
|
+
preferences = _ref.preferences,
|
|
21
|
+
management = _ref.management,
|
|
22
|
+
executeExpression = _ref.executeExpression,
|
|
22
23
|
xAxisIterations = _ref.xAxisIterations,
|
|
23
24
|
yAxisIterations = _ref.yAxisIterations,
|
|
24
25
|
id = _ref.id,
|
|
25
|
-
|
|
26
|
+
symLinks = _ref.symLinks;
|
|
26
27
|
var nbRows = xAxisIterations * yAxisIterations;
|
|
27
28
|
if (nbRows <= 1) {
|
|
28
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_nothingToDisplay["default"], {});
|
|
@@ -34,25 +35,27 @@ var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
|
34
35
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsAfterText, {
|
|
35
36
|
declarations: declarations,
|
|
36
37
|
id: id
|
|
37
|
-
}), (0,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_orchestrator["default"], {
|
|
39
|
+
id: id,
|
|
40
|
+
components: components,
|
|
41
|
+
handleChange: handleChange,
|
|
42
|
+
nbRows: nbRows,
|
|
43
|
+
value: value,
|
|
44
|
+
className: "pairwise-link",
|
|
45
|
+
management: management,
|
|
46
|
+
missing: missing,
|
|
47
|
+
shortcut: shortcut,
|
|
48
|
+
features: features,
|
|
49
|
+
preferences: preferences,
|
|
50
|
+
executeExpression: executeExpression,
|
|
51
|
+
xAxisIterations: xAxisIterations,
|
|
52
|
+
yAxisIterations: yAxisIterations,
|
|
53
|
+
symLinks: symLinks
|
|
52
54
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
53
55
|
declarations: declarations,
|
|
54
56
|
id: id
|
|
55
57
|
})]
|
|
56
58
|
});
|
|
57
59
|
};
|
|
58
|
-
|
|
60
|
+
var _default = PairwiseLinks;
|
|
61
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _commons = require("../commons");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
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 _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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
var empty = {};
|
|
17
|
+
function Row(_ref) {
|
|
18
|
+
var components = _ref.components,
|
|
19
|
+
_ref$value = _ref.value,
|
|
20
|
+
valueMap = _ref$value === void 0 ? empty : _ref$value,
|
|
21
|
+
handleChange = _ref.handleChange,
|
|
22
|
+
features = _ref.features,
|
|
23
|
+
missing = _ref.missing,
|
|
24
|
+
shortcut = _ref.shortcut,
|
|
25
|
+
management = _ref.management,
|
|
26
|
+
className = _ref.className,
|
|
27
|
+
preferences = _ref.preferences,
|
|
28
|
+
executeExpression = _ref.executeExpression,
|
|
29
|
+
linksIterations = _ref.linksIterations,
|
|
30
|
+
symLinks = _ref.symLinks,
|
|
31
|
+
lengths = _ref.lengths;
|
|
32
|
+
var _linksIterations = _slicedToArray(linksIterations, 2),
|
|
33
|
+
x = _linksIterations[0],
|
|
34
|
+
y = _linksIterations[1];
|
|
35
|
+
var handleChangeRow = (0, _react.useCallback)(function (response, value) {
|
|
36
|
+
handleChange(response, value, {
|
|
37
|
+
linksIterations: linksIterations,
|
|
38
|
+
symLinks: symLinks,
|
|
39
|
+
lengths: lengths
|
|
40
|
+
});
|
|
41
|
+
}, [handleChange, linksIterations, symLinks, lengths]);
|
|
42
|
+
if (x === y) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
46
|
+
children: components.map(function (component) {
|
|
47
|
+
var idComponent = "".concat(component.id, "-").concat(x + 1, "-").concat(y + 1, " ");
|
|
48
|
+
var value = undefined;
|
|
49
|
+
if ('response' in component) {
|
|
50
|
+
var name = component.response.name;
|
|
51
|
+
var valueArray = valueMap[name];
|
|
52
|
+
if (Array.isArray(valueArray) && Array.isArray(valueArray[x])) {
|
|
53
|
+
value = valueArray[x][y] || '';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.OrchestratedComponent, {
|
|
57
|
+
component: component,
|
|
58
|
+
handleChange: handleChangeRow,
|
|
59
|
+
features: features,
|
|
60
|
+
missing: missing,
|
|
61
|
+
shortcut: shortcut,
|
|
62
|
+
className: className,
|
|
63
|
+
management: management,
|
|
64
|
+
value: value,
|
|
65
|
+
id: idComponent,
|
|
66
|
+
preferences: preferences,
|
|
67
|
+
linksIterations: linksIterations,
|
|
68
|
+
executeExpression: executeExpression
|
|
69
|
+
}, idComponent);
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
var _default = Row;
|
|
74
|
+
exports["default"] = _default;
|
|
@@ -20,7 +20,8 @@ function RadioGroupContent(_ref) {
|
|
|
20
20
|
checkboxStyle = _ref$checkboxStyle === void 0 ? false : _ref$checkboxStyle,
|
|
21
21
|
shortcut = _ref.shortcut,
|
|
22
22
|
disabled = _ref.disabled,
|
|
23
|
-
readOnly = _ref.readOnly
|
|
23
|
+
readOnly = _ref.readOnly,
|
|
24
|
+
invalid = _ref.invalid;
|
|
24
25
|
var onKeyDown = (0, _commons.useOptionsKeydown)(options, onClick);
|
|
25
26
|
var maxIndex = options.length;
|
|
26
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -43,7 +44,8 @@ function RadioGroupContent(_ref) {
|
|
|
43
44
|
codeModality: shortcut ? codeModality : undefined,
|
|
44
45
|
shortcut: shortcut,
|
|
45
46
|
disabled: disabled,
|
|
46
|
-
readOnly: readOnly
|
|
47
|
+
readOnly: readOnly,
|
|
48
|
+
invalid: invalid
|
|
47
49
|
}, radioId);
|
|
48
50
|
})
|
|
49
51
|
});
|
|
@@ -35,10 +35,10 @@ function RadioGroup(_ref) {
|
|
|
35
35
|
options: options,
|
|
36
36
|
shortcut: shortcut,
|
|
37
37
|
disabled: disabled,
|
|
38
|
-
readOnly: readOnly
|
|
38
|
+
readOnly: readOnly,
|
|
39
|
+
invalid: !!errors
|
|
39
40
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.Errors, {
|
|
40
|
-
errors: errors
|
|
41
|
-
activeId: id
|
|
41
|
+
errors: errors
|
|
42
42
|
})]
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -30,7 +30,8 @@ function RadioOption(_ref) {
|
|
|
30
30
|
description = _ref.description,
|
|
31
31
|
shortcut = _ref.shortcut,
|
|
32
32
|
codeModality = _ref.codeModality,
|
|
33
|
-
readOnly = _ref.readOnly
|
|
33
|
+
readOnly = _ref.readOnly,
|
|
34
|
+
invalid = _ref.invalid;
|
|
34
35
|
var spanEl = (0, _react.useRef)(null);
|
|
35
36
|
var Icon = getIcon(checked, checkboxStyle);
|
|
36
37
|
var tabIndex = checked ? 0 : -1;
|
|
@@ -75,6 +76,7 @@ function RadioOption(_ref) {
|
|
|
75
76
|
onKeyDown: handleKeyDown,
|
|
76
77
|
"aria-labelledby": labelledBy,
|
|
77
78
|
ref: spanEl,
|
|
79
|
+
"aria-invalid": invalid,
|
|
78
80
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_commons.Label, {
|
|
79
81
|
id: labelledBy,
|
|
80
82
|
htmlFor: id,
|
|
@@ -8,6 +8,7 @@ var _radioGroup = _interopRequireDefault(require("./html/radio-group"));
|
|
|
8
8
|
var _lunaticComponentWithoutLabel = _interopRequireDefault(require("../commons/components/lunatic-component-without-label"));
|
|
9
9
|
var _useOnHandleChange = _interopRequireDefault(require("../commons/use-on-handle-change"));
|
|
10
10
|
var _commons = require("../commons");
|
|
11
|
+
var _errors = require("../commons/components/errors/errors");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
14
|
function LunaticRadioGroup(props) {
|
|
@@ -52,7 +53,7 @@ function LunaticRadioGroup(props) {
|
|
|
52
53
|
value: value,
|
|
53
54
|
onSelect: onChange,
|
|
54
55
|
checkboxStyle: checkboxStyle,
|
|
55
|
-
errors: errors,
|
|
56
|
+
errors: (0, _errors.getComponentErrors)(errors, id),
|
|
56
57
|
label: label,
|
|
57
58
|
className: className,
|
|
58
59
|
shortcut: shortcut,
|