@inseefr/lunatic 0.4.3-v2 → 0.4.6-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/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +6 -3
- package/lib/components/checkbox/checkbox-group/checkbox-group.js +6 -6
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +6 -3
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +15 -2
- package/lib/components/commons/components/errors/errors.js +35 -0
- package/lib/components/commons/components/errors/errors.scss +5 -0
- package/lib/components/commons/components/errors/index.js +15 -0
- package/lib/components/commons/index.js +8 -0
- package/lib/components/datepicker/datepicker.js +6 -2
- package/lib/components/datepicker/lunatic-datepicker.js +18 -1
- package/lib/components/dropdown/lunatic-dropdown.js +6 -3
- package/lib/components/input/lunatic-input.js +22 -4
- package/lib/components/input-number/input-number.js +1 -1
- package/lib/components/input-number/lunatic-input-number.js +19 -2
- package/lib/components/loop/block-for-loop/block-for-loop.js +6 -1
- package/lib/components/loop/loop.js +6 -3
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +7 -2
- package/lib/components/modal-controls/close-or-skip.js +13 -3
- package/lib/components/modal-controls/modal-controls.js +1 -2
- package/lib/components/modal-controls/modal-controls.scss +1 -1
- package/lib/components/pairwise/links/pairwise-links.js +6 -1
- package/lib/components/radio/lunatic-radio-group.js +6 -3
- package/lib/components/suggester/lunatic-suggester.js +6 -3
- package/lib/components/table/lunatic-table.js +5 -2
- package/lib/components/textarea/lunatic-textarea.js +24 -6
- package/lib/stories/date-picker/data.json +3 -0
- package/lib/stories/date-picker/datepicker.stories.js +38 -0
- package/lib/stories/date-picker/source.json +140 -0
- package/lib/stories/input/data.json +1 -5
- package/lib/stories/paste-questionnaire/test.stories.js +1 -1
- package/lib/stories/questionnaires-test/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +489 -451
- package/lib/stories/questionnaires-test/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +1956 -1688
- package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees_PasPageFin.json +3 -3
- package/lib/stories/questionnaires-test/controls/controls.stories.js +4 -4
- package/lib/stories/utils/default-arg-types.js +1 -1
- package/lib/stories/utils/orchestrator.js +18 -10
- package/lib/use-lunatic/actions.js +2 -2
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +2 -1
- package/lib/use-lunatic/commons/index.js +14 -2
- package/lib/use-lunatic/commons/page-tag.js +83 -0
- package/lib/use-lunatic/initial-state.js +3 -1
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +53 -37
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +25 -24
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +12 -4
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +4 -1
- package/lib/use-lunatic/reducer/reduce-on-init.js +2 -2
- package/lib/use-lunatic/reducer/validate-controls/create-controls-reducer.js +59 -0
- package/lib/use-lunatic/reducer/validate-controls/create-modal-controls-reducer.js +88 -0
- package/lib/use-lunatic/reducer/validate-controls/index.js +11 -3
- package/lib/use-lunatic/reducer/validate-controls/validation-utils.js +71 -0
- package/lib/use-lunatic/use-lunatic.js +15 -5
- package/package.json +1 -1
- package/lib/use-lunatic/commons/get-page-tag.js +0 -21
- package/lib/use-lunatic/reducer/validate-controls/create-validate-reducer.js +0 -146
|
@@ -5,28 +5,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
11
|
|
|
10
12
|
var _commons = require("../commons");
|
|
11
13
|
|
|
12
14
|
var _textarea = _interopRequireDefault(require("./textarea"));
|
|
13
15
|
|
|
16
|
+
var _excluded = ["errors"];
|
|
17
|
+
|
|
14
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
19
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var LunaticTextarea = function LunaticTextarea(_ref) {
|
|
25
|
+
var errors = _ref.errors,
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
|
|
28
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_textarea["default"], props), /*#__PURE__*/_react["default"].createElement(_commons.Errors, {
|
|
29
|
+
errors: errors
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
LunaticTextarea.defaultProps = {
|
|
20
34
|
rows: 1,
|
|
21
35
|
maxLength: 100,
|
|
22
36
|
cols: 32,
|
|
23
37
|
placeholder: 'Please enter your text here'
|
|
24
38
|
};
|
|
25
|
-
|
|
39
|
+
LunaticTextarea.propTypes = {
|
|
26
40
|
rows: _propTypes["default"].number,
|
|
27
41
|
maxLength: _propTypes["default"].number,
|
|
28
42
|
cols: _propTypes["default"].number,
|
|
29
43
|
placeholder: _propTypes["default"].string
|
|
30
44
|
};
|
|
31
|
-
|
|
45
|
+
|
|
46
|
+
var _default = (0, _commons.createLunaticComponent)(LunaticTextarea, {
|
|
47
|
+
inputId: 'lunatic-textarea'
|
|
48
|
+
});
|
|
49
|
+
|
|
32
50
|
exports["default"] = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
|
|
11
|
+
|
|
12
|
+
var _source = _interopRequireDefault(require("./source"));
|
|
13
|
+
|
|
14
|
+
var _data = _interopRequireDefault(require("./data"));
|
|
15
|
+
|
|
16
|
+
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
var stories = {
|
|
21
|
+
title: 'Components/DatePicker',
|
|
22
|
+
component: _orchestrator["default"],
|
|
23
|
+
argTypes: _defaultArgTypes["default"]
|
|
24
|
+
};
|
|
25
|
+
var _default = stories;
|
|
26
|
+
exports["default"] = _default;
|
|
27
|
+
|
|
28
|
+
var Template = function Template(args) {
|
|
29
|
+
return /*#__PURE__*/_react["default"].createElement(_orchestrator["default"], args);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var Default = Template.bind({});
|
|
33
|
+
exports.Default = Default;
|
|
34
|
+
Default.args = {
|
|
35
|
+
id: 'input',
|
|
36
|
+
source: _source["default"],
|
|
37
|
+
data: _data["default"]
|
|
38
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cleaning": {},
|
|
3
|
+
"variables": [
|
|
4
|
+
{
|
|
5
|
+
"variableType": "COLLECTED",
|
|
6
|
+
"values": {
|
|
7
|
+
"COLLECTED": null,
|
|
8
|
+
"EDITED": null,
|
|
9
|
+
"INPUTED": null,
|
|
10
|
+
"FORCED": null,
|
|
11
|
+
"PREVIOUS": null
|
|
12
|
+
},
|
|
13
|
+
"name": "COMMENT_QE"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"variableType": "COLLECTED",
|
|
17
|
+
"values": {
|
|
18
|
+
"COLLECTED": null,
|
|
19
|
+
"EDITED": null,
|
|
20
|
+
"INPUTED": null,
|
|
21
|
+
"FORCED": null,
|
|
22
|
+
"PREVIOUS": null
|
|
23
|
+
},
|
|
24
|
+
"name": "Q1"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"variableType": "CALCULATED",
|
|
28
|
+
"expression": { "type": "VTL", "value": "true" },
|
|
29
|
+
"name": "FILTER_RESULT_Q1",
|
|
30
|
+
"inFilter": "false"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"components": [
|
|
34
|
+
{
|
|
35
|
+
"componentType": "Sequence",
|
|
36
|
+
"hierarchy": {
|
|
37
|
+
"sequence": {
|
|
38
|
+
"id": "l7ovaca8",
|
|
39
|
+
"page": "1",
|
|
40
|
+
"label": { "type": "VTL|MD", "value": "\"I - \" || \"S1\"" }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
44
|
+
"id": "l7ovaca8",
|
|
45
|
+
"page": "1",
|
|
46
|
+
"label": { "type": "VTL|MD", "value": "\"I - \" || \"S1\"" }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"componentType": "Datepicker",
|
|
50
|
+
"controls": [
|
|
51
|
+
{
|
|
52
|
+
"criticality": "ERROR",
|
|
53
|
+
"errorMessage": {
|
|
54
|
+
"type": "VTL|MD",
|
|
55
|
+
"value": "Le format de la date YYYY-MM-DD n'est pas respecté."
|
|
56
|
+
},
|
|
57
|
+
"control": {
|
|
58
|
+
"type": "VTL",
|
|
59
|
+
"value": "not(cast(\\\"Q1\\\", date, \\\"YYYY-MM-DD\\\"))"
|
|
60
|
+
},
|
|
61
|
+
"id": "l7ovm2rv-format"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"criticality": "ERROR",
|
|
65
|
+
"errorMessage": {
|
|
66
|
+
"type": "VTL|MD",
|
|
67
|
+
"value": "La date saisie doit être comprise entre 1900-01-01 et 2100-01-01."
|
|
68
|
+
},
|
|
69
|
+
"control": {
|
|
70
|
+
"type": "VTL",
|
|
71
|
+
"value": "not(cast(\\\"Q1\\\", date, \\\"YYYY-MM-DD\\\")>cast(\\\"2100-01-01\\\", date, \\\"YYYY-MM-DD\\\") or cast(\\\"Q1\\\", date, \\\"YYYY-MM-DD\\\")<cast(\\\"1900-01-01\\\", date, \\\"YYYY-MM-DD\\\"))"
|
|
72
|
+
},
|
|
73
|
+
"id": "l7ovm2rv-formatborne"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"max": "2100-01-01",
|
|
77
|
+
"dateFormat": "YYYY-MM-DD",
|
|
78
|
+
"hierarchy": {
|
|
79
|
+
"sequence": {
|
|
80
|
+
"id": "l7ovaca8",
|
|
81
|
+
"page": "1",
|
|
82
|
+
"label": { "type": "VTL|MD", "value": "\"I - \" || \"S1\"" }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
86
|
+
"label": { "type": "VTL|MD", "value": "\"➡ 1. \" || \"Q1\"" },
|
|
87
|
+
"mandatory": false,
|
|
88
|
+
"bindingDependencies": ["Q1"],
|
|
89
|
+
"min": "1900-01-01",
|
|
90
|
+
"response": { "name": "Q1" },
|
|
91
|
+
"id": "l7ovm2rv",
|
|
92
|
+
"page": "2"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"componentType": "Sequence",
|
|
96
|
+
"hierarchy": {
|
|
97
|
+
"sequence": {
|
|
98
|
+
"id": "COMMENT-SEQ",
|
|
99
|
+
"page": "3",
|
|
100
|
+
"label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
104
|
+
"id": "COMMENT-SEQ",
|
|
105
|
+
"page": "3",
|
|
106
|
+
"label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"componentType": "Textarea",
|
|
110
|
+
"bindingDependencies": ["COMMENT_QE"],
|
|
111
|
+
"response": { "name": "COMMENT_QE" },
|
|
112
|
+
"hierarchy": {
|
|
113
|
+
"sequence": {
|
|
114
|
+
"id": "COMMENT-SEQ",
|
|
115
|
+
"page": "3",
|
|
116
|
+
"label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
120
|
+
"id": "COMMENT-QUESTION",
|
|
121
|
+
"page": "4",
|
|
122
|
+
"label": {
|
|
123
|
+
"type": "VTL|MD",
|
|
124
|
+
"value": "\"Avez-vous des remarques concernant l'enquête ou des commentaires ?\""
|
|
125
|
+
},
|
|
126
|
+
"mandatory": false,
|
|
127
|
+
"maxLength": 2000
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"pagination": "question",
|
|
131
|
+
"resizing": {},
|
|
132
|
+
"label": { "type": "VTL|MD", "value": "DatePicker" },
|
|
133
|
+
"lunaticModelVersion": "2.2.13",
|
|
134
|
+
"modele": "DATEPICKER",
|
|
135
|
+
"enoCoreVersion": "2.3.10",
|
|
136
|
+
"generatingDate": "05-09-2022 14:37:43",
|
|
137
|
+
"missing": false,
|
|
138
|
+
"id": "l7ovbqou",
|
|
139
|
+
"maxPage": "4"
|
|
140
|
+
}
|