@inseefr/lunatic 2.4.5 → 2.4.6-beta
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/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 -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/index.js +14 -0
- package/lib/components/loop/roster-for-loop/roster-table.js +0 -1
- package/lib/components/loop/roster-for-loop/roster.scss +0 -3
- package/lib/components/modal-controls/modal-controls.spec.js +0 -14
- package/lib/components/pairwise-links/pairwise-links.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 +8 -3
- 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/idb-suggester/check-store.js +2 -1
- 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/lunatic-component-without-label.d.ts +1 -1
- package/lib/src/components/commons/components/orchestrated-component.d.ts +1 -1
- package/lib/src/components/commons/create-row-orchestrator.d.ts +2 -2
- package/lib/src/components/component-set/html/component-set-components.d.ts +3 -2
- package/lib/src/components/index.d.ts +2 -0
- package/lib/src/components/loop/commons/handle-row-button.d.ts +1 -2
- 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/idb-suggester/suggester-notification.d.ts +1 -3
- package/lib/src/components/type.d.ts +2 -3
- package/lib/src/hooks/use-ref-sync.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/commons/resize-array-variable.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/questionnaires/simpsons/simpsons.stories.js +2 -1
- package/lib/stories/sequence/sequence.stories.js +1 -8
- package/lib/stories/sequence/source-declarations.json +9 -0
- package/lib/stories/suggester/suggester-workers.stories.js +6 -5
- package/lib/stories/suggester/suggester.stories.js +0 -1
- 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/load-suggesters.js +46 -46
- 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/src/components/questions/type.d.ts +0 -4
- package/lib/stories/sequence/source-questions.json +0 -19
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.lunatic-dragger {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
display: inline-block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
-moz-user-select: -moz-none;
|
|
6
|
+
-khtml-user-select: none;
|
|
7
|
+
-webkit-user-select: none;
|
|
8
|
+
}
|
|
@@ -6,12 +6,8 @@ var _useOnlineStatus = _interopRequireDefault(require("./use-online-status"));
|
|
|
6
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
7
7
|
(0, _vitest.describe)('useOnlineStatus', function () {
|
|
8
8
|
var originalNavigator;
|
|
9
|
-
var onlineCallback;
|
|
10
|
-
var offlineCallback;
|
|
11
9
|
(0, _vitest.beforeEach)(function () {
|
|
12
10
|
originalNavigator = window.navigator;
|
|
13
|
-
onlineCallback = _vitest.vi.fn();
|
|
14
|
-
offlineCallback = _vitest.vi.fn();
|
|
15
11
|
});
|
|
16
12
|
(0, _vitest.afterEach)(function () {
|
|
17
13
|
_vitest.vi.restoreAllMocks();
|
|
@@ -9,7 +9,6 @@ var _fieldContainer = _interopRequireDefault(require("./field-container"));
|
|
|
9
9
|
var _missing = _interopRequireDefault(require("./missing"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _variableStatus = _interopRequireDefault(require("./variable-status"));
|
|
12
|
-
var _questions = require("../../questions");
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
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); }
|
|
@@ -24,24 +23,18 @@ function LunaticComponent(props) {
|
|
|
24
23
|
children = props.children,
|
|
25
24
|
management = props.management,
|
|
26
25
|
description = props.description,
|
|
27
|
-
handleChange = props.handleChange
|
|
28
|
-
questionContext = props.questionContext,
|
|
29
|
-
questionInformation = props.questionInformation;
|
|
26
|
+
handleChange = props.handleChange;
|
|
30
27
|
var content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
31
28
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsBeforeText, {
|
|
32
29
|
declarations: declarations,
|
|
33
30
|
id: id
|
|
34
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
35
|
-
|
|
36
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_fieldContainer["default"], {
|
|
37
|
-
children: [/*#__PURE__*/_react["default"].cloneElement(children, {
|
|
31
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_fieldContainer["default"], {
|
|
32
|
+
children: /*#__PURE__*/_react["default"].cloneElement(children, {
|
|
38
33
|
description: getDescription({
|
|
39
34
|
declarations: declarations,
|
|
40
35
|
description: description
|
|
41
36
|
})
|
|
42
|
-
})
|
|
43
|
-
text: questionInformation
|
|
44
|
-
})]
|
|
37
|
+
})
|
|
45
38
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_declarations.DeclarationsDetachable, {
|
|
46
39
|
declarations: declarations,
|
|
47
40
|
id: id
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _reactMarkdown = _interopRequireDefault(require("react-markdown"));
|
|
8
8
|
var _link = _interopRequireDefault(require("./link"));
|
|
9
|
+
var _function = require("../../../../utils/function");
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
12
|
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); }
|
|
@@ -29,7 +30,7 @@ var renderers = function renderers(otherProps) {
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
|
-
var DEFAULT_LOG_FUNCTION =
|
|
33
|
+
var DEFAULT_LOG_FUNCTION = _function.voidFunction;
|
|
33
34
|
var MdLabel = function MdLabel(_ref) {
|
|
34
35
|
var expression = _ref.expression,
|
|
35
36
|
_ref$logFunction = _ref.logFunction,
|
|
@@ -38,7 +38,7 @@ function OrchestratedComponent(_ref) {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
var conditionFilter = componentFilled.conditionFilter;
|
|
41
|
-
var hasToBeDisplay = conditionFilter !==
|
|
41
|
+
var hasToBeDisplay = conditionFilter !== null && conditionFilter !== void 0 ? conditionFilter : true;
|
|
42
42
|
if (componentType in lunatic && hasToBeDisplay) {
|
|
43
43
|
var Component = lunatic[componentType]; // This is too dynamic, orchestration has no way to check props
|
|
44
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread(_objectSpread({}, componentFilled), {}, {
|
|
@@ -51,7 +51,8 @@ function OrchestratedComponent(_ref) {
|
|
|
51
51
|
shortcut: shortcut,
|
|
52
52
|
value: value,
|
|
53
53
|
executeExpression: executeExpression,
|
|
54
|
-
errors: errors
|
|
54
|
+
errors: errors,
|
|
55
|
+
iteration: iteration
|
|
55
56
|
}));
|
|
56
57
|
}
|
|
57
58
|
return null;
|
|
@@ -37,7 +37,9 @@ function ComponentSetComponents(_ref) {
|
|
|
37
37
|
executeExpression = _ref.executeExpression,
|
|
38
38
|
errors = _ref.errors,
|
|
39
39
|
className = _ref.className,
|
|
40
|
-
handleChange = _ref.handleChange
|
|
40
|
+
handleChange = _ref.handleChange,
|
|
41
|
+
componentClassName = _ref.componentClassName,
|
|
42
|
+
iteration = _ref.iteration;
|
|
41
43
|
if (!Array.isArray(components)) {
|
|
42
44
|
return null;
|
|
43
45
|
}
|
|
@@ -54,11 +56,13 @@ function ComponentSetComponents(_ref) {
|
|
|
54
56
|
shortcut: shortcut,
|
|
55
57
|
management: management,
|
|
56
58
|
value: componentValue,
|
|
59
|
+
iteration: iteration,
|
|
57
60
|
id: id,
|
|
58
61
|
preferences: preferences,
|
|
59
62
|
executeExpression: executeExpression,
|
|
60
63
|
errors: errors,
|
|
61
|
-
handleChange: handleChange
|
|
64
|
+
handleChange: handleChange,
|
|
65
|
+
className: componentClassName
|
|
62
66
|
})
|
|
63
67
|
}, id);
|
|
64
68
|
})
|
|
@@ -24,7 +24,8 @@ function LunaticComponentSet(props) {
|
|
|
24
24
|
errors = props.errors,
|
|
25
25
|
description = props.description,
|
|
26
26
|
handleChange = props.handleChange,
|
|
27
|
-
className = props.className
|
|
27
|
+
className = props.className,
|
|
28
|
+
iteration = props.iteration;
|
|
28
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponentWithoutLabel["default"], {
|
|
29
30
|
id: id,
|
|
30
31
|
preferences: preferences,
|
|
@@ -44,6 +45,7 @@ function LunaticComponentSet(props) {
|
|
|
44
45
|
features: features,
|
|
45
46
|
errors: errors,
|
|
46
47
|
value: value,
|
|
48
|
+
iteration: iteration,
|
|
47
49
|
executeExpression: executeExpression,
|
|
48
50
|
preferences: preferences,
|
|
49
51
|
management: management,
|
|
@@ -71,7 +71,6 @@ var declarations = [{
|
|
|
71
71
|
declarations: []
|
|
72
72
|
})]
|
|
73
73
|
})),
|
|
74
|
-
getByTestId = _render3.getByTestId,
|
|
75
74
|
queryByTestId = _render3.queryByTestId;
|
|
76
75
|
var declarationsElement = queryByTestId('declarations-1-DETACHABLE');
|
|
77
76
|
(0, _vitest.expect)(declarationsElement.nextElementSibling).toBeNull();
|
|
@@ -21,13 +21,11 @@ function SimpleOptionRenderer(_ref) {
|
|
|
21
21
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22
22
|
className: "id",
|
|
23
23
|
children: value
|
|
24
|
-
}),
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children: label
|
|
30
|
-
})]
|
|
24
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
25
|
+
children: "\xA0\u2014\xA0"
|
|
26
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
27
|
+
className: "label",
|
|
28
|
+
children: label
|
|
31
29
|
})]
|
|
32
30
|
});
|
|
33
31
|
}
|
|
@@ -18,7 +18,7 @@ function getContent(option, search) {
|
|
|
18
18
|
}
|
|
19
19
|
return label ? "".concat(value, " - ").concat(label) : value;
|
|
20
20
|
}
|
|
21
|
-
if (search && search.trim().length) {
|
|
21
|
+
if (search !== null && search !== void 0 && search.trim().length) {
|
|
22
22
|
return search;
|
|
23
23
|
}
|
|
24
24
|
return null;
|
|
@@ -109,7 +109,7 @@ function WritableOptionRenderer(_ref4) {
|
|
|
109
109
|
(0, _react.useEffect)(function () {
|
|
110
110
|
setParts(hightlightSearch(label, search));
|
|
111
111
|
}, [search, label]);
|
|
112
|
-
if (parts && parts.length) {
|
|
112
|
+
if (parts !== null && parts !== void 0 && parts.length) {
|
|
113
113
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
114
114
|
className: (0, _classnames["default"])('lunatic-dropdown-option', {
|
|
115
115
|
selected: selected
|
package/lib/components/index.js
CHANGED
|
@@ -87,6 +87,18 @@ Object.defineProperty(exports, "PairwiseLinks", {
|
|
|
87
87
|
return _pairwiseLinks["default"];
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
+
Object.defineProperty(exports, "QuestionContext", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _questionContext["default"];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "QuestionInformation", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _questionInformation["default"];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
90
102
|
Object.defineProperty(exports, "Radio", {
|
|
91
103
|
enumerable: true,
|
|
92
104
|
get: function get() {
|
|
@@ -170,4 +182,6 @@ var _suggesterLoaderWidget = _interopRequireDefault(require("./suggester-loader-
|
|
|
170
182
|
var _roundabout = _interopRequireDefault(require("./roundabout"));
|
|
171
183
|
var _table = _interopRequireDefault(require("./table"));
|
|
172
184
|
var _componentSet = _interopRequireDefault(require("./component-set"));
|
|
185
|
+
var _questionInformation = _interopRequireDefault(require("./questions/question-information"));
|
|
186
|
+
var _questionContext = _interopRequireDefault(require("./questions/question-context"));
|
|
173
187
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -23,7 +23,6 @@ function RosterTable(_ref) {
|
|
|
23
23
|
missing = _ref.missing,
|
|
24
24
|
management = _ref.management,
|
|
25
25
|
handleChange = _ref.handleChange;
|
|
26
|
-
console.log('lunatic', 'roster-table', headers);
|
|
27
26
|
if (nbRows <= 0) {
|
|
28
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.NothingToDisplay, {});
|
|
29
28
|
}
|
|
@@ -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: [{
|
|
@@ -26,7 +26,6 @@ var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
|
26
26
|
id = _ref.id,
|
|
27
27
|
symLinks = _ref.symLinks;
|
|
28
28
|
var nbRows = xAxisIterations * yAxisIterations;
|
|
29
|
-
console.log('lunatic', 'pairwise', value);
|
|
30
29
|
if (nbRows <= 1) {
|
|
31
30
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_nothingToDisplay["default"], {});
|
|
32
31
|
}
|
|
@@ -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,21 @@ 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
|
+
style = _ref.style,
|
|
16
|
+
description = _ref.description;
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
15
18
|
className: "sequence-lunatic",
|
|
16
19
|
id: "sequence-".concat(id),
|
|
17
20
|
style: style,
|
|
18
|
-
children: label
|
|
21
|
+
children: [label, /*#__PURE__*/(0, _jsxRuntime.jsx)(_description["default"], {
|
|
22
|
+
value: description
|
|
23
|
+
})]
|
|
19
24
|
});
|
|
20
25
|
}
|
|
21
26
|
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();
|
|
@@ -53,14 +53,12 @@
|
|
|
53
53
|
min-width: 260px;
|
|
54
54
|
width: 100%;
|
|
55
55
|
.lunatic-suggester-content {
|
|
56
|
-
/* */
|
|
57
56
|
|
|
58
57
|
&.focused {
|
|
59
58
|
.lunatic-suggester-selection {
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
/* */
|
|
64
62
|
.lunatic-suggester-selection {
|
|
65
63
|
border-radius: 5px;
|
|
66
64
|
border: 2px solid var(--color-primary-dark);
|
|
@@ -69,7 +67,7 @@
|
|
|
69
67
|
border-color: var(--color-primary-main);
|
|
70
68
|
}
|
|
71
69
|
.lunatic-suggester-input {
|
|
72
|
-
height:
|
|
70
|
+
height: 34px;
|
|
73
71
|
line-height: 34px;
|
|
74
72
|
font-size: 15px;
|
|
75
73
|
padding-left: 4px;
|
|
@@ -104,7 +102,6 @@
|
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
/* */
|
|
108
105
|
.lunatic-suggester-panel {
|
|
109
106
|
@include defaultFont();
|
|
110
107
|
height: 0;
|
|
@@ -168,8 +165,6 @@
|
|
|
168
165
|
font-size: large;
|
|
169
166
|
margin-bottom: 3px;
|
|
170
167
|
}
|
|
171
|
-
.descrition {
|
|
172
|
-
}
|
|
173
168
|
}
|
|
174
169
|
}
|
|
175
170
|
}
|
|
@@ -8,6 +8,7 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _idbTools = require("../../../utils/idb-tools");
|
|
10
10
|
var _storeTools = require("../../../utils/store-tools");
|
|
11
|
+
var _logger = require("../../../utils/logger");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
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
14
|
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; }
|
|
@@ -86,7 +87,7 @@ function CheckStore(_ref) {
|
|
|
86
87
|
};
|
|
87
88
|
}();
|
|
88
89
|
setRefresh(false);
|
|
89
|
-
go();
|
|
90
|
+
go()["catch"](_logger.Logger.error);
|
|
90
91
|
}
|
|
91
92
|
}, [refresh, checkStore]);
|
|
92
93
|
if (ready === 0) {
|
|
@@ -10,6 +10,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _storeTools = require("../../utils/store-tools");
|
|
11
11
|
var _icons = require("../commons/icons");
|
|
12
12
|
var _loader = _interopRequireDefault(require("./loader"));
|
|
13
|
+
var _logger = require("../../utils/logger");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
16
|
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); }
|
|
@@ -43,7 +44,7 @@ function LoaderRow(_ref) {
|
|
|
43
44
|
}, [onRefresh, name]);
|
|
44
45
|
var clear = (0, _react.useCallback)(function () {
|
|
45
46
|
if (db) {
|
|
46
|
-
(0, _storeTools.clearStoreData)(db);
|
|
47
|
+
(0, _storeTools.clearStoreData)(db)["catch"](_logger.Logger.error);
|
|
47
48
|
setNbEntities(0);
|
|
48
49
|
}
|
|
49
50
|
}, [db]);
|
|
@@ -28,7 +28,7 @@ function LunaticSwitch(_ref) {
|
|
|
28
28
|
description = _ref.description,
|
|
29
29
|
label = _ref.label,
|
|
30
30
|
errors = _ref.errors;
|
|
31
|
-
var booleanValue = value
|
|
31
|
+
var booleanValue = value !== null && value !== void 0 ? value : false;
|
|
32
32
|
var onClick = (0, _useOnHandleChange["default"])({
|
|
33
33
|
handleChange: handleChange,
|
|
34
34
|
response: response,
|
|
@@ -7,6 +7,6 @@ type Props = {
|
|
|
7
7
|
handleChange: (response: {
|
|
8
8
|
name: string;
|
|
9
9
|
}, value: any, args?: Record<string, unknown>) => void;
|
|
10
|
-
} & Pick<LunaticBaseProps, 'description' | 'declarations' | 'management' | 'id' | 'label' | 'missingResponse' | 'preferences' | 'value' | 'missing'
|
|
10
|
+
} & Pick<LunaticBaseProps, 'description' | 'declarations' | 'management' | 'id' | 'label' | 'missingResponse' | 'preferences' | 'value' | 'missing'>;
|
|
11
11
|
declare function LunaticComponent(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default LunaticComponent;
|
|
@@ -4,6 +4,6 @@ type Props = {
|
|
|
4
4
|
linksIterations?: [number, number];
|
|
5
5
|
component: LunaticComponentDefinition;
|
|
6
6
|
features?: string[];
|
|
7
|
-
} & Pick<LunaticBaseProps, 'id' | 'iteration' | 'executeExpression' | 'handleChange' | 'missing' | 'shortcut' | 'management' | 'preferences' | 'value' | 'errors'>;
|
|
7
|
+
} & Pick<LunaticBaseProps, 'id' | 'iteration' | 'executeExpression' | 'handleChange' | 'missing' | 'shortcut' | 'management' | 'preferences' | 'value' | 'errors' | 'className'>;
|
|
8
8
|
declare function OrchestratedComponent({ id, component, handleChange, features, missing, shortcut, management, preferences, value, iteration, linksIterations, executeExpression, errors, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
export default OrchestratedComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { LunaticComponentProps } from '../type';
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import type { LunaticComponentProps } from '../type';
|
|
3
3
|
import { LunaticComponentDefinition, LunaticState } from '../../use-lunatic/type';
|
|
4
4
|
type OriginalProps = {
|
|
5
5
|
key: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LunaticComponentProps } from '../../type';
|
|
2
2
|
type Props = {
|
|
3
3
|
className?: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
componentClassName?: string;
|
|
5
|
+
} & Pick<LunaticComponentProps<'ComponentSet'>, 'components' | 'value' | 'features' | 'missing' | 'shortcut' | 'management' | 'preferences' | 'executeExpression' | 'errors' | 'className' | 'handleChange' | 'iteration'>;
|
|
6
|
+
declare function ComponentSetComponents({ components, value, features, missing, shortcut, management, preferences, executeExpression, errors, className, handleChange, componentClassName, iteration, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
6
7
|
export default ComponentSetComponents;
|
|
@@ -22,3 +22,5 @@ export { default as SuggesterLoaderWidget } from './suggester-loader-widget';
|
|
|
22
22
|
export { default as Roundabout } from './roundabout';
|
|
23
23
|
export { default as Table } from './table';
|
|
24
24
|
export { default as ComponentSet } from './component-set';
|
|
25
|
+
export { default as QuestionInformation } from './questions/question-information';
|
|
26
|
+
export { default as QuestionContext } from './questions/question-context';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MouseEventHandler } from 'react';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { MouseEventHandler, PropsWithChildren } from 'react';
|
|
3
2
|
type Props = PropsWithChildren<{
|
|
4
3
|
disabled?: boolean;
|
|
5
4
|
onClick: MouseEventHandler<HTMLButtonElement | HTMLInputElement>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MessageType } from './type';
|
|
3
2
|
import './question-context.scss';
|
|
4
|
-
declare const _default: import("react").ComponentType<
|
|
3
|
+
declare const _default: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<unknown>, "label" | "description">>;
|
|
5
4
|
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MessageType } from './type';
|
|
3
2
|
import './question-information.scss';
|
|
4
|
-
declare const _default: import("react").ComponentType<
|
|
3
|
+
declare const _default: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<unknown>, "label" | "description">>;
|
|
5
4
|
export default _default;
|