@inseefr/lunatic 2.4.5-mvp-eap → 2.4.6-allDecla
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/combo-box/combo-box-content.js +5 -2
- package/lib/components/commons/components/combo-box/combo-box.js +16 -16
- package/lib/components/commons/components/combo-box/combo-box.scss +1 -0
- package/lib/components/commons/components/combo-box/panel/panel.js +4 -2
- package/lib/components/commons/components/combo-box/state-management/reduce-on-init.js +1 -4
- package/lib/components/commons/components/dragger/dragger.scss +7 -7
- package/lib/components/commons/components/is-network/use-online-status.spec.js +0 -4
- package/lib/components/commons/components/lunatic-component-without-label.js +4 -11
- package/lib/components/commons/components/md-label/md-label.js +2 -1
- package/lib/components/commons/components/orchestrated-component.js +3 -4
- package/lib/components/commons/create-row-orchestrator.js +2 -2
- package/lib/components/component-set/html/component-set-components.js +6 -2
- package/lib/components/component-set/lunatic-component-set.js +3 -1
- package/lib/components/declarations/declarations.spec.js +0 -1
- package/lib/components/dropdown/html/dropdown-simple/simple-label-renderer.js +1 -1
- package/lib/components/dropdown/html/dropdown-simple/simple-option-renderer.js +5 -7
- package/lib/components/dropdown/html/dropdown-writable/writable-label-renderer.js +1 -1
- package/lib/components/dropdown/html/dropdown-writable/writable-option-renderer.js +1 -1
- package/lib/components/dropdown/html/dropdown.scss +0 -3
- package/lib/components/dropdown/lunatic-dropdown.js +0 -1
- package/lib/components/index.js +14 -0
- package/lib/components/input-number/html/input-number.js +1 -2
- package/lib/components/input-number/html/input-number.scss +1 -1
- package/lib/components/input-number/lunatic-input-number.js +0 -2
- package/lib/components/loop/loop.js +4 -6
- package/lib/components/loop/roster-for-loop/body.js +52 -0
- package/lib/components/loop/roster-for-loop/header.js +34 -0
- package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +0 -1
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +33 -45
- package/lib/components/loop/roster-for-loop/roster-table.js +17 -22
- package/lib/components/loop/roster-for-loop/roster.scss +34 -30
- package/lib/components/loop/roster-for-loop/row.js +31 -84
- package/lib/components/modal-controls/modal-controls.spec.js +0 -14
- package/lib/components/pairwise-links/pairwise-links.js +3 -2
- package/lib/components/pairwise-links/row.js +0 -1
- package/lib/components/questions/question-context.js +21 -7
- package/lib/components/questions/question-context.scss +1 -0
- package/lib/components/questions/question-information.js +19 -5
- package/lib/components/questions/question-information.scss +1 -0
- package/lib/components/roundabout/components/roundabout.scss +0 -3
- package/lib/components/sequence/html/sequence.js +13 -6
- package/lib/components/sequence/html/sequence.scss +13 -0
- package/lib/components/sequence/lunatic-sequence.js +1 -5
- package/lib/components/sequence/sequence.spec.js +0 -3
- package/lib/components/suggester/html/default-style.scss +1 -6
- package/lib/components/suggester/html/suggester.js +12 -31
- package/lib/components/suggester/idb-suggester/check-store.js +2 -1
- package/lib/components/suggester/idb-suggester/idb-suggester.js +7 -10
- package/lib/components/suggester/lunatic-suggester.js +4 -31
- package/lib/components/suggester-loader-widget/loader-row.js +2 -1
- package/lib/components/switch/html/switch.scss +0 -2
- package/lib/components/switch/lunatic-switch.js +1 -1
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +4 -4
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/panel/panel.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/state-management/actions.d.ts +4 -4
- package/lib/src/components/commons/components/lunatic-component-without-label.d.ts +1 -1
- package/lib/src/components/commons/components/orchestrated-component.d.ts +3 -3
- package/lib/src/components/commons/create-row-orchestrator.d.ts +4 -5
- package/lib/src/components/component-set/html/component-set-components.d.ts +3 -2
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown.d.ts +1 -2
- package/lib/src/components/index.d.ts +2 -0
- package/lib/src/components/input-number/html/input-number.d.ts +0 -1
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +3 -11
- package/lib/src/components/loop/block-for-loop/block-for-loop.d.ts +1 -5
- package/lib/src/components/loop/commons/handle-row-button.d.ts +1 -2
- package/lib/src/components/loop/roster-for-loop/body.d.ts +12 -0
- package/lib/src/components/loop/roster-for-loop/header.d.ts +9 -0
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +3 -11
- package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +4 -8
- package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +3 -3
- package/lib/src/components/loop/roster-for-loop/row.d.ts +2 -3
- package/lib/src/components/questions/question-context.d.ts +1 -2
- package/lib/src/components/questions/question-information.d.ts +1 -2
- package/lib/src/components/sequence/html/sequence.d.ts +1 -1
- package/lib/src/components/sequence/lunatic-sequence.d.ts +1 -1
- package/lib/src/components/suggester/html/suggester.d.ts +4 -6
- package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +3 -4
- package/lib/src/components/suggester/idb-suggester/suggester-notification.d.ts +1 -3
- package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
- package/lib/src/components/type.d.ts +7 -28
- package/lib/src/hooks/use-ref-sync.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +16 -61
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +0 -36
- package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/commons/resize-array-variable.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/reduce-update-state.d.ts +1 -106
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +1 -1
- package/lib/src/use-lunatic/type-source.d.ts +1 -11
- package/lib/src/use-lunatic/type.d.ts +1 -1
- package/lib/src/utils/logger.d.ts +6 -0
- package/lib/stories/component-set/data2.json +7 -0
- package/lib/stories/component-set/source2.json +31 -31
- package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +0 -1
- package/lib/stories/input/input.stories.js +9 -1
- package/lib/stories/input/source-with-question.json +74 -0
- package/lib/stories/input-number/input-number.stories.js +1 -8
- package/lib/stories/loop/block-for-loop.stories.js +8 -1
- package/lib/stories/loop/roster-for-loop.stories.js +1 -8
- package/lib/stories/loop/source-with-header.json +3 -15
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +2 -1
- package/lib/stories/sequence/afterInSeq.json +293 -0
- package/lib/stories/sequence/sequence.stories.js +12 -8
- package/lib/stories/sequence/source-declarations.json +9 -0
- package/lib/stories/suggester/suggester-workers.stories.js +7 -6
- package/lib/stories/suggester/suggester.stories.js +5 -18
- package/lib/stories/utils/orchestrator.js +4 -3
- package/lib/use-lunatic/commons/calculated-variables.js +1 -1
- package/lib/use-lunatic/commons/compile-controls.js +1 -1
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +1 -4
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +1 -1
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +0 -8
- package/lib/use-lunatic/commons/load-suggesters.js +46 -46
- package/lib/use-lunatic/initial-state.js +0 -1
- package/lib/use-lunatic/reducer/reducer.js +0 -1
- package/lib/utils/logger.js +44 -0
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -1
- package/lib/utils/suggester-workers/create-worker-ts.js +2 -1
- package/lib/utils/suggester-workers/create-worker.js +2 -1
- package/package.json +1 -1
- package/lib/components/questions/type.js +0 -5
- package/lib/hooks/use-did-change.js +0 -19
- package/lib/src/components/questions/type.d.ts +0 -4
- package/lib/src/hooks/use-did-change.d.ts +0 -4
- package/lib/stories/input-number/source-dynamic.json +0 -41
- package/lib/stories/questionnaires/EAP/data-eap.json +0 -46
- package/lib/stories/questionnaires/EAP/eap.stories.js +0 -71
- package/lib/stories/questionnaires/EAP/source-eap.json +0 -433
- package/lib/stories/sequence/source-questions.json +0 -19
- package/lib/stories/suggester/multipleResponses.json +0 -100
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _declarations = require("../../declarations");
|
|
10
|
+
var _rosterTable = _interopRequireDefault(require("./roster-table"));
|
|
10
11
|
var _commons = require("../../commons");
|
|
11
|
-
var _lunaticComponentWithLabel = _interopRequireDefault(require("../../commons/components/lunatic-component-with-label"));
|
|
12
|
-
var _getInitLength = _interopRequireDefault(require("../commons/get-init-length"));
|
|
13
12
|
var _handleRowButton = _interopRequireDefault(require("../commons/handle-row-button"));
|
|
14
|
-
var
|
|
13
|
+
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
14
|
+
var _getInitLength = _interopRequireDefault(require("../commons/get-init-length"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
17
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
20
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
21
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -30,14 +32,12 @@ function RosterforLoop(_ref) {
|
|
|
30
32
|
label = _ref.label,
|
|
31
33
|
components = _ref.components,
|
|
32
34
|
executeExpression = _ref.executeExpression,
|
|
33
|
-
|
|
34
|
-
header = _ref.header,
|
|
35
|
+
headers = _ref.headers,
|
|
35
36
|
missing = _ref.missing,
|
|
37
|
+
shortcut = _ref.shortcut,
|
|
36
38
|
id = _ref.id,
|
|
37
39
|
management = _ref.management,
|
|
38
|
-
errors = _ref.errors
|
|
39
|
-
missingResponse = _ref.missingResponse,
|
|
40
|
-
description = _ref.description;
|
|
40
|
+
errors = _ref.errors;
|
|
41
41
|
var min = (lines === null || lines === void 0 ? void 0 : lines.min) || DEFAULT_MIN_ROWS;
|
|
42
42
|
var max = (lines === null || lines === void 0 ? void 0 : lines.max) || DEFAULT_MAX_ROWS;
|
|
43
43
|
var _useState = (0, _react.useState)(function () {
|
|
@@ -47,13 +47,6 @@ function RosterforLoop(_ref) {
|
|
|
47
47
|
nbRows = _useState2[0],
|
|
48
48
|
setNbRows = _useState2[1];
|
|
49
49
|
var showButtons = min && max && min !== max;
|
|
50
|
-
/**
|
|
51
|
-
* ToDo : perf by row
|
|
52
|
-
*/
|
|
53
|
-
/* disable improve perf by cell
|
|
54
|
-
const valueMapRef = useRefSync(valueMap);
|
|
55
|
-
*/
|
|
56
|
-
var nbRowsRef = (0, _useRefSync.useRefSync)(nbRows);
|
|
57
50
|
var addRow = (0, _react.useCallback)(function () {
|
|
58
51
|
if (nbRows < max) {
|
|
59
52
|
setNbRows(nbRows + 1);
|
|
@@ -61,14 +54,12 @@ function RosterforLoop(_ref) {
|
|
|
61
54
|
}, [max, nbRows]);
|
|
62
55
|
var handleChangeLoop = (0, _react.useCallback)(function (response, value, args) {
|
|
63
56
|
var v = valueMap[response.name];
|
|
64
|
-
// disable perf by cell
|
|
65
|
-
// const v = valueMapRef.current.[response.name];
|
|
66
57
|
v[args.index] = value;
|
|
67
58
|
handleChange(response, v, {
|
|
68
59
|
loop: true,
|
|
69
|
-
length:
|
|
60
|
+
length: nbRows
|
|
70
61
|
}); // TODO: a retaper pour déplacer cette compléxité
|
|
71
|
-
}, [handleChange,
|
|
62
|
+
}, [handleChange, nbRows, valueMap]);
|
|
72
63
|
var removeRow = (0, _react.useCallback)(function () {
|
|
73
64
|
if (nbRows > 1) {
|
|
74
65
|
var newNbRows = nbRows - 1;
|
|
@@ -88,35 +79,32 @@ function RosterforLoop(_ref) {
|
|
|
88
79
|
}, [nbRows, handleChange, valueMap]);
|
|
89
80
|
if (nbRows > 0) {
|
|
90
81
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
91
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
92
|
-
id: id,
|
|
93
|
-
label: label,
|
|
82
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsBeforeText, {
|
|
94
83
|
declarations: declarations,
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
id: id
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsAfterText, {
|
|
86
|
+
declarations: declarations,
|
|
87
|
+
id: id
|
|
88
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_rosterTable["default"], {
|
|
89
|
+
id: id,
|
|
90
|
+
components: components,
|
|
91
|
+
nbRows: nbRows,
|
|
92
|
+
executeExpression: executeExpression,
|
|
93
|
+
headers: headers,
|
|
94
|
+
handleChange: handleChangeLoop,
|
|
95
|
+
value: valueMap,
|
|
97
96
|
management: management,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
nbRows: nbRows,
|
|
105
|
-
executeExpression: executeExpression,
|
|
106
|
-
header: header,
|
|
107
|
-
handleChange: handleChangeLoop,
|
|
108
|
-
value: valueMap,
|
|
109
|
-
missing: missing,
|
|
110
|
-
errors: errors
|
|
111
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.Errors, {
|
|
112
|
-
errors: errors,
|
|
113
|
-
activeId: id
|
|
114
|
-
})]
|
|
97
|
+
missing: missing,
|
|
98
|
+
shortcut: shortcut,
|
|
99
|
+
errors: errors
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
101
|
+
declarations: declarations,
|
|
102
|
+
id: id
|
|
115
103
|
}), showButtons && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
116
104
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_handleRowButton["default"], {
|
|
117
105
|
onClick: addRow,
|
|
118
106
|
disabled: nbRows === max,
|
|
119
|
-
children: _i18n["default"].DEFAULT_BUTTON_ADD
|
|
107
|
+
children: label || _i18n["default"].DEFAULT_BUTTON_ADD
|
|
120
108
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_handleRowButton["default"], {
|
|
121
109
|
onClick: removeRow,
|
|
122
110
|
disabled: nbRows === min,
|
|
@@ -4,48 +4,43 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _htmlTable = require("../../commons/components/html-table");
|
|
9
|
-
var _header = _interopRequireDefault(require("
|
|
10
|
-
var
|
|
9
|
+
var _header = _interopRequireDefault(require("./header"));
|
|
10
|
+
var _body = _interopRequireDefault(require("./body"));
|
|
11
11
|
require("./roster.scss");
|
|
12
|
+
var _commons = require("../../commons");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
var preferences = ['COLLECTED'];
|
|
15
15
|
function RosterTable(_ref) {
|
|
16
16
|
var components = _ref.components,
|
|
17
17
|
nbRows = _ref.nbRows,
|
|
18
18
|
executeExpression = _ref.executeExpression,
|
|
19
|
-
getSuggesterStatus = _ref.getSuggesterStatus,
|
|
20
19
|
id = _ref.id,
|
|
21
|
-
|
|
20
|
+
headers = _ref.headers,
|
|
22
21
|
valueMap = _ref.value,
|
|
22
|
+
shortcut = _ref.shortcut,
|
|
23
23
|
missing = _ref.missing,
|
|
24
|
+
management = _ref.management,
|
|
24
25
|
handleChange = _ref.handleChange;
|
|
25
26
|
if (nbRows <= 0) {
|
|
26
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.NothingToDisplay, {});
|
|
27
28
|
}
|
|
28
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_htmlTable.Table, {
|
|
29
30
|
id: id,
|
|
30
|
-
className: "rosterTable",
|
|
31
31
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_header["default"], {
|
|
32
|
-
header:
|
|
32
|
+
header: headers,
|
|
33
33
|
id: id
|
|
34
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
34
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_body["default"], {
|
|
35
35
|
id: id,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
getSuggesterStatus: getSuggesterStatus,
|
|
45
|
-
valueMap: valueMap,
|
|
46
|
-
missing: missing,
|
|
47
|
-
preferences: preferences
|
|
48
|
-
})
|
|
36
|
+
components: components,
|
|
37
|
+
handleChange: handleChange,
|
|
38
|
+
nbRows: nbRows,
|
|
39
|
+
value: valueMap,
|
|
40
|
+
management: management,
|
|
41
|
+
missing: missing,
|
|
42
|
+
shortcut: shortcut,
|
|
43
|
+
executeExpression: executeExpression
|
|
49
44
|
})]
|
|
50
45
|
});
|
|
51
46
|
}
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
.lunatic-component {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
border-right: 1px solid;
|
|
22
|
-
}
|
|
1
|
+
// .lunatic-component {
|
|
2
|
+
// .table-lunatic {
|
|
3
|
+
// table-layout: fixed;
|
|
4
|
+
// border-collapse: collapse;
|
|
5
|
+
// margin-top: 0.3em;
|
|
6
|
+
// margin-bottom: 0.3em;
|
|
7
|
+
// & td,
|
|
8
|
+
// th {
|
|
9
|
+
// border: 0.15em solid var(--color-primary-dark);
|
|
10
|
+
// padding: 0.2em;
|
|
11
|
+
// }
|
|
12
|
+
// & td {
|
|
13
|
+
// .field,
|
|
14
|
+
// .field-with-tooltip {
|
|
15
|
+
// display: flex;
|
|
16
|
+
// justify-content: center;
|
|
17
|
+
// align-items: center;
|
|
18
|
+
// }
|
|
19
|
+
// }
|
|
20
|
+
// }
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
// .table-lunatic .tooltip-lunatic img {
|
|
23
|
+
// height: 20px;
|
|
24
|
+
// width: 20px;
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
.lunatic-table {
|
|
29
|
+
table-layout: fixed;
|
|
30
|
+
border-collapse: collapse;
|
|
31
|
+
margin-top: 0.3em;
|
|
32
|
+
margin-bottom: 0.3em;
|
|
33
|
+
.lunatic-table-thead {
|
|
34
|
+
.lunatic-table-th {
|
|
35
|
+
border: 0.15em solid var(--color-primary-dark);
|
|
36
|
+
padding: 0.2em;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _htmlTable = require("../../commons/components/html-table");
|
|
9
10
|
var _commons = require("../../commons");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
11
14
|
var emptyValue = {};
|
|
12
15
|
function Row(_ref) {
|
|
13
16
|
var id = _ref.id,
|
|
@@ -22,7 +25,6 @@ function Row(_ref) {
|
|
|
22
25
|
management = _ref.management,
|
|
23
26
|
preferences = _ref.preferences,
|
|
24
27
|
executeExpression = _ref.executeExpression,
|
|
25
|
-
getSuggesterStatus = _ref.getSuggesterStatus,
|
|
26
28
|
errors = _ref.errors;
|
|
27
29
|
var handleChangeRow = (0, _react.useCallback)(function (response, value) {
|
|
28
30
|
handleChange(response, value, {
|
|
@@ -34,103 +36,48 @@ function Row(_ref) {
|
|
|
34
36
|
id: id
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
|
-
// @ts-ignore
|
|
38
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Tr, {
|
|
39
40
|
id: id,
|
|
40
41
|
row: rowIndex,
|
|
41
42
|
children: components.map(function (component) {
|
|
42
|
-
if (!('response' in component
|
|
43
|
+
if (!('response' in component)) {
|
|
43
44
|
return null;
|
|
44
45
|
}
|
|
45
|
-
var
|
|
46
|
+
var response = component.response,
|
|
47
|
+
id = component.id;
|
|
46
48
|
var idComponent = "".concat(id, "-").concat(rowIndex);
|
|
49
|
+
var value = undefined;
|
|
47
50
|
var key = "".concat(id, "-").concat(rowIndex);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (name in valueMap) {
|
|
57
|
-
var v = valueMap[name];
|
|
58
|
-
if (Array.isArray(v)) {
|
|
59
|
-
value[name] = v[rowIndex] || '';
|
|
60
|
-
} else {
|
|
61
|
-
value[name] = '';
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if ('response' in component) {
|
|
67
|
-
var _response = component.response;
|
|
68
|
-
if (_response) {
|
|
69
|
-
var name = _response.name;
|
|
70
|
-
if (name in valueMap) {
|
|
71
|
-
var v = valueMap[name];
|
|
72
|
-
if (Array.isArray(v)) {
|
|
73
|
-
value = v[rowIndex] || '';
|
|
74
|
-
} else {
|
|
75
|
-
value = '';
|
|
76
|
-
}
|
|
51
|
+
if (response) {
|
|
52
|
+
var name = response.name;
|
|
53
|
+
if (name in valueMap) {
|
|
54
|
+
var v = valueMap[name];
|
|
55
|
+
if (Array.isArray(v)) {
|
|
56
|
+
value = v[rowIndex] || '';
|
|
57
|
+
} else {
|
|
58
|
+
value = '';
|
|
77
59
|
}
|
|
78
60
|
}
|
|
79
61
|
}
|
|
80
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Td, {
|
|
81
63
|
id: idComponent,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.OrchestratedComponent, {
|
|
65
|
+
component: component,
|
|
66
|
+
handleChange: handleChangeRow,
|
|
67
|
+
features: features,
|
|
68
|
+
missing: missing,
|
|
69
|
+
shortcut: shortcut,
|
|
70
|
+
management: management,
|
|
71
|
+
value: value,
|
|
72
|
+
id: idComponent,
|
|
73
|
+
preferences: preferences,
|
|
74
|
+
iteration: rowIndex,
|
|
75
|
+
executeExpression: executeExpression,
|
|
76
|
+
errors: errors
|
|
77
|
+
})
|
|
94
78
|
}, key);
|
|
95
79
|
})
|
|
96
80
|
});
|
|
97
81
|
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Memoïzed version of a cell (for optimisation)
|
|
101
|
-
*/
|
|
102
|
-
var RowCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
103
|
-
var id = _ref2.id,
|
|
104
|
-
component = _ref2.component,
|
|
105
|
-
handleChange = _ref2.handleChange,
|
|
106
|
-
features = _ref2.features,
|
|
107
|
-
missing = _ref2.missing,
|
|
108
|
-
shortcut = _ref2.shortcut,
|
|
109
|
-
management = _ref2.management,
|
|
110
|
-
value = _ref2.value,
|
|
111
|
-
preferences = _ref2.preferences,
|
|
112
|
-
rowIndex = _ref2.rowIndex,
|
|
113
|
-
getSuggesterStatus = _ref2.getSuggesterStatus,
|
|
114
|
-
executeExpression = _ref2.executeExpression,
|
|
115
|
-
errors = _ref2.errors;
|
|
116
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Td, {
|
|
117
|
-
id: id,
|
|
118
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.OrchestratedComponent, {
|
|
119
|
-
component: component,
|
|
120
|
-
handleChange: handleChange,
|
|
121
|
-
features: features,
|
|
122
|
-
missing: missing,
|
|
123
|
-
shortcut: shortcut,
|
|
124
|
-
management: management,
|
|
125
|
-
value: value,
|
|
126
|
-
id: id,
|
|
127
|
-
preferences: preferences,
|
|
128
|
-
iteration: rowIndex,
|
|
129
|
-
executeExpression: executeExpression,
|
|
130
|
-
getSuggesterStatus: getSuggesterStatus,
|
|
131
|
-
errors: errors
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
82
|
var _default = Row;
|
|
136
83
|
exports["default"] = _default;
|
|
@@ -44,20 +44,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
44
44
|
(0, _vitest.expect)(queryByText('Error message 1')).toBeNull();
|
|
45
45
|
(0, _vitest.expect)(queryByText('Error message 2')).toBeNull();
|
|
46
46
|
});
|
|
47
|
-
/*
|
|
48
|
-
it('should call the goNext function with block:true when the close button is clicked', () => {
|
|
49
|
-
const errors = {
|
|
50
|
-
field1: [{ criticality: 'ERROR', errorMessage: 'Error message 1' }],
|
|
51
|
-
field2: [{ criticality: 'ERROR', errorMessage: 'Error message 2' }],
|
|
52
|
-
};
|
|
53
|
-
const goNext = vi.fn();
|
|
54
|
-
const { getByText } = render(
|
|
55
|
-
<ModalControls errors={errors} goNext={goNext} />
|
|
56
|
-
);
|
|
57
|
-
fireEvent.click(getByText('Correct'));
|
|
58
|
-
expect(goNext).toHaveBeenCalledWith({ block: true });
|
|
59
|
-
});
|
|
60
|
-
*/
|
|
61
47
|
(0, _vitest.it)('should call the goNext function when the skip button is clicked', function () {
|
|
62
48
|
var errors = {
|
|
63
49
|
field1: [{
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _declarations = require("../declarations");
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _orchestrator = _interopRequireDefault(require("./orchestrator"));
|
|
9
|
+
var _declarations = require("../declarations");
|
|
10
|
+
var _nothingToDisplay = _interopRequireDefault(require("../commons/components/nothing-to-display"));
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
13
|
var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
@@ -49,7 +49,6 @@ function Row(_ref) {
|
|
|
49
49
|
var idComponent = "".concat(component.id, "-").concat(x + 1, "-").concat(y + 1, " ");
|
|
50
50
|
var value = undefined;
|
|
51
51
|
if ('response' in component) {
|
|
52
|
-
// @ts-ignore
|
|
53
52
|
var name = component.response.name;
|
|
54
53
|
var valueArray = valueMap[name];
|
|
55
54
|
if (Array.isArray(valueArray) && Array.isArray(valueArray[x])) {
|
|
@@ -7,15 +7,29 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _commons = require("../commons");
|
|
8
8
|
require("./question-context.scss");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
function
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
function Description(_ref) {
|
|
11
|
+
var description = _ref.description;
|
|
12
|
+
if (!description) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
16
|
+
children: description
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function QuestionContext(props) {
|
|
20
|
+
var label = props.label,
|
|
21
|
+
description = props.description;
|
|
22
|
+
if (label) {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
24
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
25
|
+
className: "lunatic-call-out",
|
|
26
|
+
children: [label, /*#__PURE__*/(0, _jsxRuntime.jsx)(Description, {
|
|
27
|
+
description: description
|
|
28
|
+
})]
|
|
29
|
+
})
|
|
16
30
|
});
|
|
17
31
|
}
|
|
18
32
|
return null;
|
|
19
33
|
}
|
|
20
|
-
var _default = (0, _commons.createCustomizableLunaticField)(
|
|
34
|
+
var _default = (0, _commons.createCustomizableLunaticField)(QuestionContext, 'QuestionContext');
|
|
21
35
|
exports["default"] = _default;
|
|
@@ -7,12 +7,26 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _commons = require("../commons");
|
|
8
8
|
require("./question-information.scss");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function Description(_ref) {
|
|
11
|
+
var description = _ref.description;
|
|
12
|
+
if (!description) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
16
|
+
children: description
|
|
17
|
+
});
|
|
18
|
+
}
|
|
10
19
|
function QuestionInformation(props) {
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
children:
|
|
20
|
+
var label = props.label,
|
|
21
|
+
description = props.description;
|
|
22
|
+
if (label) {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
24
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
25
|
+
className: "lunatic-alert-information",
|
|
26
|
+
children: [label, /*#__PURE__*/(0, _jsxRuntime.jsx)(Description, {
|
|
27
|
+
description: description
|
|
28
|
+
})]
|
|
29
|
+
})
|
|
16
30
|
});
|
|
17
31
|
}
|
|
18
32
|
return null;
|
|
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _commons = require("../../commons");
|
|
8
8
|
require("./sequence.scss");
|
|
9
|
+
var _description = _interopRequireDefault(require("../../commons/components/description"));
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
12
|
function Sequence(_ref) {
|
|
11
13
|
var label = _ref.label,
|
|
12
14
|
id = _ref.id,
|
|
13
|
-
style = _ref.style
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
description = _ref.description;
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
18
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
19
|
+
className: "sequence-lunatic",
|
|
20
|
+
id: "sequence-".concat(id),
|
|
21
|
+
style: style,
|
|
22
|
+
children: label
|
|
23
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_description["default"], {
|
|
24
|
+
value: description
|
|
25
|
+
})]
|
|
19
26
|
});
|
|
20
27
|
}
|
|
21
28
|
var _default = (0, _commons.createCustomizableLunaticField)(Sequence, 'Sequence');
|
|
@@ -13,17 +13,13 @@ function LunaticSequence(_ref) {
|
|
|
13
13
|
var declarations = _ref.declarations,
|
|
14
14
|
label = _ref.label,
|
|
15
15
|
id = _ref.id,
|
|
16
|
-
style = _ref.style
|
|
17
|
-
questionContext = _ref.questionContext,
|
|
18
|
-
questionInformation = _ref.questionInformation;
|
|
16
|
+
style = _ref.style;
|
|
19
17
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponentWithoutLabel["default"], {
|
|
20
18
|
id: id,
|
|
21
19
|
label: label,
|
|
22
20
|
declarations: declarations,
|
|
23
21
|
handleChange: empty,
|
|
24
22
|
value: undefined,
|
|
25
|
-
questionContext: questionContext,
|
|
26
|
-
questionInformation: questionInformation,
|
|
27
23
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sequence["default"], {
|
|
28
24
|
label: label,
|
|
29
25
|
id: id,
|
|
@@ -30,7 +30,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
30
30
|
style: {
|
|
31
31
|
backgroundColor: 'red'
|
|
32
32
|
},
|
|
33
|
-
questionContext: 'question-context',
|
|
34
33
|
questionInformation: 'question-information'
|
|
35
34
|
};
|
|
36
35
|
(0, _vitest.it)('renders the label and declarations in the correct order', function () {
|
|
@@ -40,10 +39,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
40
39
|
var sequenceLabel = getByText('Test Sequence Label');
|
|
41
40
|
var declaration1 = getByText('Declaration 1');
|
|
42
41
|
var declaration3 = getByText('Declaration 3');
|
|
43
|
-
var questionContext = getByText('question-context');
|
|
44
42
|
var questionInformation = getByText('question-information');
|
|
45
43
|
(0, _vitest.expect)(sequenceLabel).toBeInTheDocument();
|
|
46
|
-
(0, _vitest.expect)(questionContext).toBeInTheDocument();
|
|
47
44
|
(0, _vitest.expect)(questionInformation).toBeInTheDocument();
|
|
48
45
|
// Declarations before text should appear before the label
|
|
49
46
|
(0, _vitest.expect)(declaration1).toBeInTheDocument();
|