@inseefr/lunatic 0.3.17-v2 → 0.4.1-v2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/commons/components/lunatic-component.js +3 -0
- package/lib/components/commons/components/lunatic-fieldset-component.js +3 -0
- package/lib/components/commons/components/orchestrated-component.js +3 -2
- package/lib/components/declarations/declarations.js +1 -1
- package/lib/components/dropdown/dropdown-simple/simple-label-renderer.js +1 -1
- package/lib/components/dropdown/dropdown-simple/simple-option-renderer.js +1 -1
- package/lib/components/filter-description/component.js +3 -4
- package/lib/components/loop/block-for-loop/block-for-loop.js +15 -3
- package/lib/components/loop/loop.js +4 -2
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +4 -12
- package/lib/components/pairwise/links/pairwise-links.js +3 -0
- package/lib/components/radio/radio-option.js +3 -2
- package/lib/components/sequence/sequence.js +8 -7
- package/lib/components/subsequence/subsequence.js +9 -6
- package/lib/index.js.map +1 -0
- package/lib/stories/checkboxOne/checkboxOne.stories.js +35 -0
- package/lib/stories/checkboxOne/source.json +36 -0
- package/lib/stories/dropdown/source.json +50 -26
- package/lib/stories/filter-description/filter-description.stories.js +58 -0
- package/lib/stories/filter-description/source-options.json +81 -0
- package/lib/stories/filter-description/source.json +11 -0
- package/lib/stories/questionnaires/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +452 -0
- package/lib/stories/questionnaires/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +1689 -0
- package/lib/stories/questionnaires/controls/V2_Controles_BouclesLiees2_PasPageFin.json +775 -0
- package/lib/stories/questionnaires/controls/V2_Controles_BouclesLiees_PasPageFin.json +412 -0
- package/lib/stories/questionnaires/controls/controls.stories.js +95 -0
- package/lib/stories/questionnaires/logement/source-sequence.json +34180 -33113
- package/lib/stories/questionnaires/logement/source.json +34190 -33123
- package/lib/stories/questionnaires/samples/sample.json +430 -0
- package/lib/stories/questionnaires/samples/samples.stories.js +64 -0
- package/lib/stories/questionnaires/test/source.json +6290 -0
- package/lib/stories/questionnaires/test/test.stories.js +87 -0
- package/lib/stories/questionnaires-test/sources.json +203 -0
- package/lib/stories/questionnaires-test/test.stories.js +87 -0
- package/lib/stories/radio/radio.stories.js +35 -0
- package/lib/stories/radio/source.json +36 -0
- package/lib/use-lunatic/commons/calculated-variables.js +124 -0
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +11 -0
- package/lib/use-lunatic/commons/execute-expression/execute-expression.js +1 -0
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +3 -2
- package/lib/use-lunatic/use-lunatic.js +19 -5
- package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +1 -3
- package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +3 -1
- package/lib/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +1 -1
- package/package.json +3 -3
|
@@ -38,6 +38,7 @@ function LunaticComponent(props) {
|
|
|
38
38
|
|
|
39
39
|
var content = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
40
40
|
declarations: declarations,
|
|
41
|
+
id: id,
|
|
41
42
|
custom: custom
|
|
42
43
|
}), /*#__PURE__*/_react["default"].createElement(_label["default"], {
|
|
43
44
|
id: labelId,
|
|
@@ -46,6 +47,7 @@ function LunaticComponent(props) {
|
|
|
46
47
|
custom: custom
|
|
47
48
|
}, (0, _safetyLabel["default"])(label, id)), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
48
49
|
declarations: declarations,
|
|
50
|
+
id: id,
|
|
49
51
|
custom: custom
|
|
50
52
|
}), /*#__PURE__*/_react["default"].createElement(_fieldContainer["default"], {
|
|
51
53
|
value: value,
|
|
@@ -54,6 +56,7 @@ function LunaticComponent(props) {
|
|
|
54
56
|
preferences: preferences
|
|
55
57
|
}, children), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
56
58
|
declarations: declarations,
|
|
59
|
+
id: id,
|
|
57
60
|
custom: custom
|
|
58
61
|
}), missing && missingResponse && /*#__PURE__*/_react["default"].createElement(_missing["default"], props));
|
|
59
62
|
|
|
@@ -33,6 +33,7 @@ function LunaticFieldsetComponent(props) {
|
|
|
33
33
|
|
|
34
34
|
var content = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
35
35
|
declarations: declarations,
|
|
36
|
+
id: id,
|
|
36
37
|
custom: custom
|
|
37
38
|
}), /*#__PURE__*/_react["default"].createElement(_fieldContainer["default"], {
|
|
38
39
|
value: value,
|
|
@@ -44,9 +45,11 @@ function LunaticFieldsetComponent(props) {
|
|
|
44
45
|
custom: custom
|
|
45
46
|
}, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
46
47
|
declarations: declarations,
|
|
48
|
+
id: id,
|
|
47
49
|
custom: custom
|
|
48
50
|
}), children)), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
49
51
|
declarations: declarations,
|
|
52
|
+
id: id,
|
|
50
53
|
custom: custom
|
|
51
54
|
}), missing && missingResponse && /*#__PURE__*/_react["default"].createElement(_missing["default"], props));
|
|
52
55
|
|
|
@@ -44,9 +44,10 @@ function OrchestratedComponent(_ref) {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
var Component = lunatic[componentType];
|
|
47
|
-
var
|
|
47
|
+
var conditionFilter = componentFilled.conditionFilter;
|
|
48
|
+
var hasToBeDisplay = conditionFilter !== undefined ? conditionFilter : true;
|
|
48
49
|
|
|
49
|
-
if (componentType in lunatic &&
|
|
50
|
+
if (componentType in lunatic && hasToBeDisplay) {
|
|
50
51
|
return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, componentFilled, {
|
|
51
52
|
id: id,
|
|
52
53
|
handleChange: handleChange,
|
|
@@ -33,7 +33,7 @@ function Declarations(_ref) {
|
|
|
33
33
|
if (filtered.length === 0) return null;
|
|
34
34
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
35
35
|
id: "declarations-".concat(id, "-").concat(type),
|
|
36
|
-
className: "lunatic
|
|
36
|
+
className: "declarations-lunatic"
|
|
37
37
|
}, filtered.map(function (_ref3) {
|
|
38
38
|
var idD = _ref3.id,
|
|
39
39
|
label = _ref3.label,
|
|
@@ -11,13 +11,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
11
11
|
|
|
12
12
|
var FilterDescription = function FilterDescription(_ref) {
|
|
13
13
|
var id = _ref.id,
|
|
14
|
-
label = _ref.label
|
|
15
|
-
|
|
16
|
-
return filterDescription ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
14
|
+
label = _ref.label;
|
|
15
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
17
16
|
id: "filter-description-".concat(id),
|
|
18
17
|
"aria-label": "filter-description",
|
|
19
18
|
className: "filter-description-lunatic"
|
|
20
|
-
}, label)
|
|
19
|
+
}, label);
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
var _default = FilterDescription;
|
|
@@ -39,6 +39,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
39
39
|
|
|
40
40
|
function BlockForLoop(_ref) {
|
|
41
41
|
var declarations = _ref.declarations,
|
|
42
|
+
id = _ref.id,
|
|
42
43
|
lines = _ref.lines,
|
|
43
44
|
components = _ref.components,
|
|
44
45
|
handleChange = _ref.handleChange,
|
|
@@ -50,7 +51,8 @@ function BlockForLoop(_ref) {
|
|
|
50
51
|
management = _ref.management,
|
|
51
52
|
executeExpression = _ref.executeExpression,
|
|
52
53
|
iterations = _ref.iterations,
|
|
53
|
-
custom = _ref.custom
|
|
54
|
+
custom = _ref.custom,
|
|
55
|
+
paginatedLoop = _ref.paginatedLoop;
|
|
54
56
|
|
|
55
57
|
var _useState = (0, _react.useState)(-1),
|
|
56
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -86,18 +88,27 @@ function BlockForLoop(_ref) {
|
|
|
86
88
|
}
|
|
87
89
|
}, [min, max, iterations]);
|
|
88
90
|
var handleChangeLoop = (0, _react.useCallback)(function (response, value, args) {
|
|
89
|
-
|
|
91
|
+
if (!paginatedLoop) {
|
|
92
|
+
var v = valueMap[response.name];
|
|
93
|
+
v[args.index] = value;
|
|
94
|
+
handleChange(response, v, {
|
|
95
|
+
loop: true,
|
|
96
|
+
length: nbRows
|
|
97
|
+
});
|
|
98
|
+
} else handleChange(response, value, _objectSpread(_objectSpread({}, args), {}, {
|
|
90
99
|
loop: true,
|
|
91
100
|
length: nbRows
|
|
92
101
|
}));
|
|
93
|
-
}, [handleChange, nbRows]);
|
|
102
|
+
}, [handleChange, nbRows, paginatedLoop, valueMap]);
|
|
94
103
|
|
|
95
104
|
if (nbRows > 0) {
|
|
96
105
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
97
106
|
declarations: declarations,
|
|
107
|
+
id: id,
|
|
98
108
|
custom: custom
|
|
99
109
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
100
110
|
declarations: declarations,
|
|
111
|
+
id: id,
|
|
101
112
|
custom: custom
|
|
102
113
|
}), /*#__PURE__*/_react["default"].createElement(_blockForLoopOchestrator["default"], {
|
|
103
114
|
components: components,
|
|
@@ -113,6 +124,7 @@ function BlockForLoop(_ref) {
|
|
|
113
124
|
custom: custom
|
|
114
125
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
115
126
|
declarations: declarations,
|
|
127
|
+
id: id,
|
|
116
128
|
custom: custom
|
|
117
129
|
}));
|
|
118
130
|
}
|
|
@@ -36,7 +36,8 @@ function Loop(props) {
|
|
|
36
36
|
missing = props.missing,
|
|
37
37
|
features = props.features,
|
|
38
38
|
preferences = props.preferences,
|
|
39
|
-
custom = props.custom
|
|
39
|
+
custom = props.custom,
|
|
40
|
+
paginatedLoop = props.paginatedLoop;
|
|
40
41
|
|
|
41
42
|
switch (componentType) {
|
|
42
43
|
case LoopTypes.blockForLoop:
|
|
@@ -56,7 +57,8 @@ function Loop(props) {
|
|
|
56
57
|
shortcut: shortcut,
|
|
57
58
|
features: features,
|
|
58
59
|
preferences: preferences,
|
|
59
|
-
custom: custom
|
|
60
|
+
custom: custom,
|
|
61
|
+
paginatedLoop: paginatedLoop
|
|
60
62
|
});
|
|
61
63
|
|
|
62
64
|
case LoopTypes.rosterForLoop:
|
|
@@ -15,12 +15,8 @@ var _rosterTable = _interopRequireDefault(require("./roster-table"));
|
|
|
15
15
|
|
|
16
16
|
var _handleRowButton = _interopRequireDefault(require("./handle-row-button"));
|
|
17
17
|
|
|
18
|
-
var _useOnHandleChange = _interopRequireDefault(require("../../commons/use-on-handle-change"));
|
|
19
|
-
|
|
20
18
|
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
21
19
|
|
|
22
|
-
var _excluded = ["valueMap", "loopDependencies", "lines", "handleChange", "declarations", "label", "components", "executeExpression", "headers", "missing", "shortcut", "id", "management", "custom"];
|
|
23
|
-
|
|
24
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
21
|
|
|
26
22
|
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); }
|
|
@@ -47,10 +43,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
47
43
|
|
|
48
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
45
|
|
|
50
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
51
|
-
|
|
52
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
53
|
-
|
|
54
46
|
var DEFAULT_MAX_ROWS = 12;
|
|
55
47
|
|
|
56
48
|
function getTableLength(value) {
|
|
@@ -65,7 +57,6 @@ function getTableLength(value) {
|
|
|
65
57
|
|
|
66
58
|
function RosterforLoop(_ref) {
|
|
67
59
|
var valueMap = _ref.valueMap,
|
|
68
|
-
loopDependencies = _ref.loopDependencies,
|
|
69
60
|
lines = _ref.lines,
|
|
70
61
|
handleChange = _ref.handleChange,
|
|
71
62
|
declarations = _ref.declarations,
|
|
@@ -77,9 +68,7 @@ function RosterforLoop(_ref) {
|
|
|
77
68
|
shortcut = _ref.shortcut,
|
|
78
69
|
id = _ref.id,
|
|
79
70
|
management = _ref.management,
|
|
80
|
-
custom = _ref.custom
|
|
81
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
82
|
-
|
|
71
|
+
custom = _ref.custom;
|
|
83
72
|
var max = (lines === null || lines === void 0 ? void 0 : lines.max) || DEFAULT_MAX_ROWS;
|
|
84
73
|
|
|
85
74
|
var _useState = (0, _react.useState)(false),
|
|
@@ -126,9 +115,11 @@ function RosterforLoop(_ref) {
|
|
|
126
115
|
if (nbRows > 0) {
|
|
127
116
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
128
117
|
declarations: declarations,
|
|
118
|
+
id: id,
|
|
129
119
|
custom: custom
|
|
130
120
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
131
121
|
declarations: declarations,
|
|
122
|
+
id: id,
|
|
132
123
|
custom: custom
|
|
133
124
|
}), /*#__PURE__*/_react["default"].createElement(_rosterTable["default"], {
|
|
134
125
|
id: id,
|
|
@@ -144,6 +135,7 @@ function RosterforLoop(_ref) {
|
|
|
144
135
|
custom: custom
|
|
145
136
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
146
137
|
declarations: declarations,
|
|
138
|
+
id: id,
|
|
147
139
|
custom: custom
|
|
148
140
|
}), /*#__PURE__*/_react["default"].createElement(_handleRowButton["default"], {
|
|
149
141
|
onClick: addRow,
|
|
@@ -40,9 +40,11 @@ var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
|
40
40
|
}, [handleChange]);
|
|
41
41
|
if (nbRows > 0) return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
42
42
|
declarations: declarations,
|
|
43
|
+
id: id,
|
|
43
44
|
custom: custom
|
|
44
45
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
45
46
|
declarations: declarations,
|
|
47
|
+
id: id,
|
|
46
48
|
custom: custom
|
|
47
49
|
}), /*#__PURE__*/_react["default"].createElement(_linksOrchestrator["default"], {
|
|
48
50
|
id: id,
|
|
@@ -60,6 +62,7 @@ var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
|
60
62
|
xAxisIterations: xAxisIterations
|
|
61
63
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
62
64
|
declarations: declarations,
|
|
65
|
+
id: id,
|
|
63
66
|
custom: custom
|
|
64
67
|
}));
|
|
65
68
|
return null;
|
|
@@ -49,8 +49,9 @@ function RadioOption(_ref) {
|
|
|
49
49
|
var Icon = getIcon(checked, checkboxStyle);
|
|
50
50
|
var tabIndex = checked ? '0' : '-1';
|
|
51
51
|
var onClickOption = (0, _react.useCallback)(function () {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
// on checkboxStyle, clicking on checked value unchecks it, so it acts as if empty answer was clicked
|
|
53
|
+
checkboxStyle && checked ? onClick(null) : onClick(value);
|
|
54
|
+
}, [value, onClick, checked, checkboxStyle]);
|
|
54
55
|
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
55
56
|
var key = e.key;
|
|
56
57
|
var current = spanEl.current;
|
|
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _declarations = require("../declarations");
|
|
11
11
|
|
|
12
|
-
var _commons = require("../commons");
|
|
13
|
-
|
|
14
12
|
require("./sequence.scss");
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -21,15 +19,18 @@ function Sequence(_ref) {
|
|
|
21
19
|
id = _ref.id,
|
|
22
20
|
style = _ref.style;
|
|
23
21
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
24
|
-
declarations: declarations
|
|
25
|
-
|
|
22
|
+
declarations: declarations,
|
|
23
|
+
id: id
|
|
24
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
26
25
|
className: "sequence-lunatic",
|
|
27
26
|
id: "sequence-".concat(id),
|
|
28
27
|
style: style
|
|
29
|
-
},
|
|
30
|
-
declarations: declarations
|
|
28
|
+
}, label), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
29
|
+
declarations: declarations,
|
|
30
|
+
id: id
|
|
31
31
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
32
|
-
declarations: declarations
|
|
32
|
+
declarations: declarations,
|
|
33
|
+
id: id
|
|
33
34
|
}));
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -16,15 +16,18 @@ function Subsequence(_ref) {
|
|
|
16
16
|
declarations = _ref.declarations,
|
|
17
17
|
label = _ref.label;
|
|
18
18
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
|
|
19
|
-
declarations: declarations
|
|
19
|
+
declarations: declarations,
|
|
20
|
+
id: id
|
|
20
21
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
21
|
-
"aria-label": "
|
|
22
|
-
className: "
|
|
23
|
-
id: "
|
|
22
|
+
"aria-label": "subsequence-".concat(id),
|
|
23
|
+
className: "subsequence-lunatic",
|
|
24
|
+
id: "subsequence-".concat(id)
|
|
24
25
|
}, label), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
|
|
25
|
-
declarations: declarations
|
|
26
|
+
declarations: declarations,
|
|
27
|
+
id: id
|
|
26
28
|
}), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
|
|
27
|
-
declarations: declarations
|
|
29
|
+
declarations: declarations,
|
|
30
|
+
id: id
|
|
28
31
|
}));
|
|
29
32
|
}
|
|
30
33
|
|