@inseefr/lunatic 0.4.10-v2 → 0.4.11-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/input/input.scss +2 -1
- package/lib/components/input-number/input-number.js +7 -4
- package/lib/components/input-number/input-number.scss +7 -0
- package/lib/components/loop/block-for-loop/block-for-loop.js +9 -3
- package/lib/stories/input-number/input-number.stories.js +9 -1
- package/lib/stories/input-number/source-euros.json +38 -0
- package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees_PasPageFin.json +461 -257
- package/lib/stories/questionnaires-test/controls/boucles-n.json +572 -0
- package/lib/stories/questionnaires-test/controls/controls.stories.js +11 -1
- package/lib/stories/questionnaires-test/test.stories.js +1 -10
- package/lib/use-lunatic/commons/page-tag.js +1 -1
- package/package.json +1 -1
- package/lib/stories/questionnaires-test/boucles-n.json +0 -334
|
@@ -29,14 +29,17 @@ function InputNumber(_ref) {
|
|
|
29
29
|
labelId = _ref.labelId,
|
|
30
30
|
min = _ref.min,
|
|
31
31
|
max = _ref.max,
|
|
32
|
-
step = _ref.step
|
|
32
|
+
step = _ref.step,
|
|
33
|
+
unit = _ref.unit;
|
|
33
34
|
var valueEffective = value !== null && value !== void 0 ? value : '';
|
|
34
35
|
var handleChange = (0, _react.useCallback)(function (e) {
|
|
35
36
|
var val = e.target.valueAsNumber;
|
|
36
37
|
onChange(val);
|
|
37
38
|
}, [onChange]);
|
|
38
|
-
return /*#__PURE__*/_react["default"].createElement("
|
|
39
|
-
className:
|
|
39
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
40
|
+
className: "lunatic-input-number-container"
|
|
41
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
42
|
+
className: (0, _classnames["default"])('lunatic-input-number', {
|
|
40
43
|
disabled: disabled,
|
|
41
44
|
readOnly: readOnly
|
|
42
45
|
}),
|
|
@@ -49,7 +52,7 @@ function InputNumber(_ref) {
|
|
|
49
52
|
min: min,
|
|
50
53
|
max: max,
|
|
51
54
|
step: step
|
|
52
|
-
});
|
|
55
|
+
}), unit && /*#__PURE__*/_react["default"].createElement("span", null, unit));
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
var _default = (0, _commons.createCustomizableLunaticField)(InputNumber);
|
|
@@ -71,16 +71,22 @@ function BlockForLoop(_ref) {
|
|
|
71
71
|
custom = _ref.custom,
|
|
72
72
|
paginatedLoop = _ref.paginatedLoop,
|
|
73
73
|
errors = _ref.errors;
|
|
74
|
+
var min = lines === null || lines === void 0 ? void 0 : lines.min;
|
|
75
|
+
var max = lines === null || lines === void 0 ? void 0 : lines.max;
|
|
74
76
|
|
|
75
77
|
var _useState = (0, _react.useState)(function () {
|
|
76
|
-
|
|
78
|
+
if (iterations) {
|
|
79
|
+
//This should be an Integer
|
|
80
|
+
return Number.parseInt(iterations);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var initLength = (0, _getInitLength["default"])(valueMap);
|
|
84
|
+
return Math.max(initLength, min);
|
|
77
85
|
}),
|
|
78
86
|
_useState2 = _slicedToArray(_useState, 2),
|
|
79
87
|
nbRows = _useState2[0],
|
|
80
88
|
setNbRows = _useState2[1];
|
|
81
89
|
|
|
82
|
-
var min = lines === null || lines === void 0 ? void 0 : lines.min;
|
|
83
|
-
var max = lines === null || lines === void 0 ? void 0 : lines.max;
|
|
84
90
|
var addRow = (0, _react.useCallback)(function () {
|
|
85
91
|
if (nbRows < max) {
|
|
86
92
|
setNbRows(nbRows + 1);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.Default = void 0;
|
|
6
|
+
exports["default"] = exports.UnitEuros = exports.Default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -13,6 +13,8 @@ var _source = _interopRequireDefault(require("./source"));
|
|
|
13
13
|
|
|
14
14
|
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
15
15
|
|
|
16
|
+
var _sourceEuros = _interopRequireDefault(require("./source-euros"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
19
|
|
|
18
20
|
var stories = {
|
|
@@ -32,4 +34,10 @@ exports.Default = Default;
|
|
|
32
34
|
Default.args = {
|
|
33
35
|
id: 'input-number',
|
|
34
36
|
source: _source["default"]
|
|
37
|
+
};
|
|
38
|
+
var UnitEuros = Template.bind({});
|
|
39
|
+
exports.UnitEuros = UnitEuros;
|
|
40
|
+
UnitEuros.args = {
|
|
41
|
+
id: 'input-number-euro',
|
|
42
|
+
source: _sourceEuros["default"]
|
|
35
43
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "kze792d8",
|
|
5
|
+
"componentType": "InputNumber",
|
|
6
|
+
"mandatory": false,
|
|
7
|
+
"page": "2",
|
|
8
|
+
"min": 0,
|
|
9
|
+
"max": 10,
|
|
10
|
+
"decimals": 0,
|
|
11
|
+
"unit":"€",
|
|
12
|
+
"label": { "value": "\"➡ 1. \" || \"NB \"", "type": "VTL|MD" },
|
|
13
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
14
|
+
"hierarchy": {
|
|
15
|
+
"sequence": {
|
|
16
|
+
"id": "ksyjs7vy",
|
|
17
|
+
"page": "1",
|
|
18
|
+
"label": { "value": "S0", "type": "VTL|MD" }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"bindingDependencies": ["NB"],
|
|
22
|
+
"response": { "name": "NB" }
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"variables": [
|
|
26
|
+
{
|
|
27
|
+
"variableType": "COLLECTED",
|
|
28
|
+
"name": "NB",
|
|
29
|
+
"values": {
|
|
30
|
+
"PREVIOUS": null,
|
|
31
|
+
"COLLECTED": null,
|
|
32
|
+
"FORCED": null,
|
|
33
|
+
"EDITED": null,
|
|
34
|
+
"INPUTED": null
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|