@inseefr/lunatic 2.0.0-v2 → 2.0.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/button/lunatic-button.js +5 -1
- package/lib/components/checkbox/checkbox-boolean/checkbox-boolean.js +4 -2
- package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +2 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.js +7 -7
- package/lib/components/checkbox/checkbox-group/checkbox.scss +1 -0
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +3 -2
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +5 -2
- package/lib/components/checkbox/commons/checkbox-option.js +12 -3
- package/lib/components/checkbox/commons/checkbox-option.scss +3 -0
- package/lib/components/commons/components/combo-box/combo-box.js +1 -1
- package/lib/components/commons/components/combo-box/combo-box.scss +0 -10
- package/lib/components/commons/components/combo-box/selection/label-selection.js +1 -1
- package/lib/components/commons/components/errors/errors.js +26 -6
- package/lib/components/commons/components/fieldset.scss +2 -0
- package/lib/components/commons/components/orchestrated-component.js +4 -2
- package/lib/components/commons/create-row-orchestrator.js +4 -2
- package/lib/components/datepicker/datepicker.js +4 -1
- package/lib/components/datepicker/lunatic-datepicker.js +4 -2
- package/lib/components/declarations/declarations.js +5 -1
- package/lib/components/dropdown/lunatic-dropdown.js +3 -2
- package/lib/components/filter-description/component.js +4 -1
- package/lib/components/input/lunatic-input.js +3 -1
- package/lib/components/input-number/lunatic-input-number.js +4 -2
- package/lib/components/loop/block-for-loop/block-for-loop.js +7 -6
- package/lib/components/loop/block-for-loop/row.js +5 -3
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +5 -5
- package/lib/components/loop/roster-for-loop/row.js +5 -3
- package/lib/components/modal-controls/modal-controls.scss +8 -30
- package/lib/components/pairwise/index.js +0 -8
- package/lib/components/pairwise/links/{links-orchestrator.js → orchestrator.js} +0 -0
- package/lib/components/pairwise/links/pairwise-links.js +5 -7
- package/lib/components/radio/lunatic-radio-group.js +3 -2
- package/lib/components/radio/radio-group.js +3 -5
- package/lib/components/radio/radio-option.js +6 -2
- package/lib/components/radio/radio.scss +3 -1
- package/lib/components/sequence/sequence.js +4 -1
- package/lib/components/subsequence/subsequence.js +4 -1
- package/lib/components/suggester/check-store.js +1 -6
- package/lib/components/suggester/lunatic-suggester.js +2 -1
- package/lib/components/table/lunatic-table.js +5 -2
- package/lib/components/textarea/lunatic-textarea.js +3 -1
- package/lib/stories/pairwise/data.json +13 -0
- package/lib/stories/pairwise/{links/links.json → links.json} +90 -24
- package/lib/stories/pairwise/{links/pairwise-links.stories.js → pairwise-links.stories.js} +3 -3
- package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees_PasPageFin.json +13 -52
- package/lib/stories/questionnaires-test/controls/boucles-n.json +74 -444
- package/lib/stories/questionnaires-test/controls/controls.stories.js +8 -8
- package/lib/use-lunatic/commons/get-errors-without-empty-value.js +31 -0
- package/lib/use-lunatic/commons/index.js +8 -0
- package/lib/use-lunatic/initial-state.js +1 -0
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +16 -9
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +2 -1
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +8 -1
- package/lib/use-lunatic/reducer/validate-controls/create-controls-reducer.js +21 -11
- package/lib/use-lunatic/reducer/validate-controls/create-modal-controls-reducer.js +19 -7
- package/lib/use-lunatic/reducer/validate-controls/validation-utils.js +5 -3
- package/package.json +2 -2
- package/lib/components/checkbox/checkbox-group/checkbox-option.js +0 -57
- package/lib/components/checkbox/checkbox.scss +0 -1
- package/lib/components/pairwise/block/index.js +0 -15
- package/lib/components/pairwise/block/pairwise-block.js +0 -17
- package/lib/stories/pairwise/block/block.json +0 -3
- package/lib/stories/pairwise/block/pairwise-block.stories.js +0 -36
- package/lib/stories/pairwise/links/data.json +0 -12
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
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."); }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
|
+
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
+
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
|
|
20
|
+
function getErrorsWithoutEmptyValue(errors) {
|
|
21
|
+
return errors ? Object.fromEntries(Object.entries(errors).filter(function (_ref) {
|
|
22
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
23
|
+
key = _ref2[0],
|
|
24
|
+
value = _ref2[1];
|
|
25
|
+
|
|
26
|
+
return Array.isArray(value) && value.length;
|
|
27
|
+
})) : {};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var _default = getErrorsWithoutEmptyValue;
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "getComponentsFromState", {
|
|
|
45
45
|
return _getComponentsFromState["default"];
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "getErrorsWithoutEmptyValue", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _getErrorsWithoutEmptyValue["default"];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "getNewReachedPage", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function get() {
|
|
@@ -112,4 +118,6 @@ var _loadSuggesters = _interopRequireDefault(require("./load-suggesters"));
|
|
|
112
118
|
|
|
113
119
|
var _getCompatibleVtlExpression = _interopRequireDefault(require("./get-compatible-vtl-expression"));
|
|
114
120
|
|
|
121
|
+
var _getErrorsWithoutEmptyValue = _interopRequireDefault(require("./get-errors-without-empty-value"));
|
|
122
|
+
|
|
115
123
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -36,7 +36,8 @@ function reduceNextSubPage(state) {
|
|
|
36
36
|
var subPage = pager.subPage;
|
|
37
37
|
|
|
38
38
|
var newPager = _objectSpread(_objectSpread({}, pager), {}, {
|
|
39
|
-
subPage: subPage + 1
|
|
39
|
+
subPage: subPage + 1,
|
|
40
|
+
shallowIteration: undefined
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -73,7 +74,8 @@ function reduceNextPage(state, _ref) {
|
|
|
73
74
|
iteration: undefined,
|
|
74
75
|
nbIterations: undefined,
|
|
75
76
|
subPage: undefined,
|
|
76
|
-
nbSubPages: undefined
|
|
77
|
+
nbSubPages: undefined,
|
|
78
|
+
shallowIteration: undefined
|
|
77
79
|
});
|
|
78
80
|
|
|
79
81
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -102,7 +104,8 @@ function reduceStartLoop(state, _ref2) {
|
|
|
102
104
|
subPage: undefined,
|
|
103
105
|
nbSubPages: undefined,
|
|
104
106
|
iteration: undefined,
|
|
105
|
-
nbIterations: undefined
|
|
107
|
+
nbIterations: undefined,
|
|
108
|
+
shallowIteration: undefined
|
|
106
109
|
});
|
|
107
110
|
|
|
108
111
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -130,7 +133,8 @@ function reduceStartLoop(state, _ref2) {
|
|
|
130
133
|
subPage: 0,
|
|
131
134
|
nbSubPages: subPages.length,
|
|
132
135
|
iteration: 0,
|
|
133
|
-
nbIterations: nbIterations
|
|
136
|
+
nbIterations: nbIterations,
|
|
137
|
+
shallowIteration: undefined
|
|
134
138
|
});
|
|
135
139
|
|
|
136
140
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -147,7 +151,6 @@ function reduceStartLoop(state, _ref2) {
|
|
|
147
151
|
|
|
148
152
|
function validateChange(state) {
|
|
149
153
|
if ((0, _commons.isOnEmptyPage)(state)) {
|
|
150
|
-
// Is it necessary to wrap by control reducer ?
|
|
151
154
|
return reduceGoNextPage(state);
|
|
152
155
|
}
|
|
153
156
|
|
|
@@ -182,15 +185,19 @@ function reduceGoNextPage(state) {
|
|
|
182
185
|
isLoop = _pages$next.isLoop,
|
|
183
186
|
iterations = _pages$next.iterations,
|
|
184
187
|
loopDependencies = _pages$next.loopDependencies;
|
|
188
|
+
var pageComponents = pages[page].components.map(function (_ref3) {
|
|
189
|
+
var componentType = _ref3.componentType;
|
|
190
|
+
return componentType;
|
|
191
|
+
});
|
|
185
192
|
|
|
186
|
-
if (isInLoop && !isLoop) {
|
|
187
|
-
//End of the loop, we reset bindings
|
|
193
|
+
if (isInLoop && !isLoop || pageComponents.includes('PairwiseLinks')) {
|
|
194
|
+
//End of the loop or PairwiseLinks, we reset bindings
|
|
188
195
|
resetLoopBindings(variables);
|
|
189
196
|
}
|
|
190
197
|
|
|
191
198
|
if (next === page) {
|
|
192
|
-
// TODO
|
|
193
|
-
|
|
199
|
+
// TODO: check why next === page, doesn't seems to be normal
|
|
200
|
+
return state;
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
if (isLoop) {
|
|
@@ -89,7 +89,8 @@ function goPreviousPage(state, _ref2) {
|
|
|
89
89
|
iteration: undefined,
|
|
90
90
|
nbIterations: undefined,
|
|
91
91
|
subPage: undefined,
|
|
92
|
-
nbSubPages: undefined
|
|
92
|
+
nbSubPages: undefined,
|
|
93
|
+
shallowIteration: undefined
|
|
93
94
|
});
|
|
94
95
|
|
|
95
96
|
var currentErrors = errors ? errors[(0, _commons2.getPageTag)(updatedPager)] : undefined;
|
|
@@ -52,7 +52,8 @@ function updateVariables(state, action) {
|
|
|
52
52
|
index = args.index,
|
|
53
53
|
length = args.length,
|
|
54
54
|
linksIterations = args.linksIterations,
|
|
55
|
-
paginatedLoop = args.paginatedLoop
|
|
55
|
+
paginatedLoop = args.paginatedLoop,
|
|
56
|
+
shallowIteration = args.shallowIteration;
|
|
56
57
|
var pager = state.pager,
|
|
57
58
|
variables = state.variables;
|
|
58
59
|
var nbIterations = pager.nbIterations,
|
|
@@ -95,6 +96,12 @@ function updateVariables(state, action) {
|
|
|
95
96
|
value: value
|
|
96
97
|
});
|
|
97
98
|
|
|
99
|
+
if (loop) return _objectSpread(_objectSpread({}, state), {}, {
|
|
100
|
+
variables: _variablesNext3,
|
|
101
|
+
pager: _objectSpread(_objectSpread({}, pager), {}, {
|
|
102
|
+
shallowIteration: shallowIteration
|
|
103
|
+
})
|
|
104
|
+
});
|
|
98
105
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
99
106
|
variables: _variablesNext3
|
|
100
107
|
});
|
|
@@ -16,21 +16,28 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
17
|
|
|
18
18
|
function validateComponents(state, components) {
|
|
19
|
-
var pager = state.pager;
|
|
20
|
-
|
|
19
|
+
var pager = state.pager;
|
|
21
20
|
return components.reduce(function (errors, component) {
|
|
22
|
-
var controls = component.controls
|
|
21
|
+
var controls = component.controls,
|
|
22
|
+
componentType = component.componentType,
|
|
23
|
+
id = component.id;
|
|
23
24
|
|
|
24
25
|
if (Array.isArray(controls)) {
|
|
25
26
|
var componentErrors = (0, _validationUtils.resolveComponentControls)(state, controls);
|
|
27
|
+
var shallowIteration = pager.shallowIteration;
|
|
28
|
+
var idC = shallowIteration !== undefined ? "".concat(id, "-").concat(shallowIteration) : id;
|
|
29
|
+
return _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, idC, componentErrors));
|
|
30
|
+
} //Thanks to init which split basic Loops, we only go into unPaginatedLoops
|
|
31
|
+
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
if (['Loop', 'RosterForLoop'].includes(componentType)) {
|
|
34
|
+
var _components = component.components;
|
|
35
|
+
var recurs = validateComponents(state, _components);
|
|
36
|
+
return _objectSpread(_objectSpread(_objectSpread({}, (state.errors || {})[(0, _commons.getPageTag)(pager)] || {}), errors), recurs);
|
|
30
37
|
} // If no error we remove the possible previous errors
|
|
31
38
|
|
|
32
39
|
|
|
33
|
-
return
|
|
40
|
+
return {};
|
|
34
41
|
}, {});
|
|
35
42
|
}
|
|
36
43
|
|
|
@@ -44,13 +51,16 @@ function createControlsReducer(reducer) {
|
|
|
44
51
|
currentErrors: undefined
|
|
45
52
|
});
|
|
46
53
|
var components = (0, _commons.getComponentsFromState)(updatedState);
|
|
54
|
+
var pager = updatedState.pager;
|
|
55
|
+
var _state$errors = state.errors,
|
|
56
|
+
errors = _state$errors === void 0 ? {} : _state$errors;
|
|
57
|
+
var pageTag = (0, _commons.getPageTag)(pager);
|
|
47
58
|
|
|
48
|
-
var
|
|
59
|
+
var e = _objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, pageTag, validateComponents(updatedState, components)));
|
|
49
60
|
|
|
50
|
-
var pager = updatedState.pager;
|
|
51
61
|
return _objectSpread(_objectSpread({}, updatedState), {}, {
|
|
52
|
-
errors:
|
|
53
|
-
currentErrors:
|
|
62
|
+
errors: e,
|
|
63
|
+
currentErrors: e[pageTag]
|
|
54
64
|
});
|
|
55
65
|
};
|
|
56
66
|
}
|
|
@@ -17,20 +17,32 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
18
|
|
|
19
19
|
function validateComponentsForModal(state, components) {
|
|
20
|
-
var pager = state.pager;
|
|
21
|
-
|
|
20
|
+
var pager = state.pager;
|
|
22
21
|
return components.reduce(function (errors, component) {
|
|
23
|
-
var controls = component.controls
|
|
22
|
+
var controls = component.controls,
|
|
23
|
+
componentType = component.componentType,
|
|
24
|
+
id = component.id;
|
|
24
25
|
|
|
25
26
|
if (Array.isArray(controls)) {
|
|
26
27
|
var componentErrors = (0, _validationUtils.resolveComponentControls)(state, controls);
|
|
27
28
|
|
|
28
29
|
if (componentErrors.length) {
|
|
29
|
-
|
|
30
|
+
var shallowIteration = pager.shallowIteration;
|
|
31
|
+
var idC = shallowIteration !== undefined ? "".concat(id, "-").concat(shallowIteration) : id;
|
|
32
|
+
return (0, _commons.getErrorsWithoutEmptyValue)(_objectSpread(_objectSpread({}, errors), {}, _defineProperty({}, idC, componentErrors)));
|
|
30
33
|
}
|
|
31
|
-
}
|
|
34
|
+
} //Thanks to init which split basic Loops, we only go into unPaginatedLoops
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if (['Loop', 'RosterForLoop'].includes(componentType)) {
|
|
38
|
+
// TODO handle the case where shallowInteration hasn't been initalized because not handleChange fired
|
|
39
|
+
var _components = component.components;
|
|
40
|
+
var recurs = validateComponentsForModal(state, _components);
|
|
41
|
+
return (0, _commons.getErrorsWithoutEmptyValue)(_objectSpread(_objectSpread(_objectSpread({}, (state.errors || {})[(0, _commons.getPageTag)(pager)] || {}), errors), recurs));
|
|
42
|
+
} // If no error we remove the possible previous errors
|
|
43
|
+
|
|
32
44
|
|
|
33
|
-
return
|
|
45
|
+
return {};
|
|
34
46
|
}, {});
|
|
35
47
|
}
|
|
36
48
|
|
|
@@ -59,7 +71,7 @@ function createModalControlsReducer(reducer) {
|
|
|
59
71
|
// Block the modal and stay in page so we add the error in the current page
|
|
60
72
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
61
73
|
modalErrors: undefined,
|
|
62
|
-
currentErrors: prec
|
|
74
|
+
currentErrors: prec
|
|
63
75
|
});
|
|
64
76
|
}
|
|
65
77
|
|
|
@@ -21,7 +21,8 @@ function resolveControl(state, control) {
|
|
|
21
21
|
var executeExpression = state.executeExpression,
|
|
22
22
|
_state$pager = state.pager,
|
|
23
23
|
pager = _state$pager === void 0 ? {} : _state$pager;
|
|
24
|
-
var iteration = pager.iteration
|
|
24
|
+
var iteration = pager.iteration,
|
|
25
|
+
shallowIteration = pager.shallowIteration;
|
|
25
26
|
var criticality = control.criticality,
|
|
26
27
|
errorMessage = control.errorMessage,
|
|
27
28
|
id = control.id,
|
|
@@ -32,14 +33,15 @@ function resolveControl(state, control) {
|
|
|
32
33
|
value = _control$control$valu === void 0 ? 'true' : _control$control$valu;
|
|
33
34
|
|
|
34
35
|
try {
|
|
36
|
+
var it = shallowIteration !== null && shallowIteration !== void 0 ? shallowIteration : iteration;
|
|
35
37
|
var result = executeExpression(value, {
|
|
36
|
-
iteration:
|
|
38
|
+
iteration: it
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
if (!result) {
|
|
40
42
|
var labelValue = errorMessage.value;
|
|
41
43
|
var label = executeExpression(labelValue, {
|
|
42
|
-
iteration:
|
|
44
|
+
iteration: it
|
|
43
45
|
});
|
|
44
46
|
return {
|
|
45
47
|
criticality: criticality,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-v2",
|
|
4
4
|
"workersVersion": "0.2.4-experimental",
|
|
5
5
|
"description": "Library of questionnaire components",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"library"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@inseefr/trevas": "^0.1.
|
|
51
|
+
"@inseefr/trevas": "^0.1.16",
|
|
52
52
|
"@inseefr/vtl-2.0-antlr-tools": "^0.1.0-bundle",
|
|
53
53
|
"antlr4": "4.8.0",
|
|
54
54
|
"classnames": "^2.3.1",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _icons = require("../../commons/icons");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
|
-
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); }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
function CheckboxOption(_ref) {
|
|
23
|
-
var disabled = _ref.disabled,
|
|
24
|
-
checked = _ref.checked,
|
|
25
|
-
id = _ref.id,
|
|
26
|
-
value = _ref.value,
|
|
27
|
-
onClick = _ref.onClick,
|
|
28
|
-
labelledBy = _ref.labelledBy;
|
|
29
|
-
var onClickOption = (0, _react.useCallback)(function () {
|
|
30
|
-
onClick(value);
|
|
31
|
-
}, [value, onClick]);
|
|
32
|
-
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
33
|
-
var key = e.key;
|
|
34
|
-
|
|
35
|
-
if (key === 'Space') {// TODO
|
|
36
|
-
}
|
|
37
|
-
}, []);
|
|
38
|
-
var Icon = checked ? _icons.CheckboxChecked : _icons.CheckboxUnchecked;
|
|
39
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
40
|
-
className: (0, _classnames["default"])('checkbox-modality', 'checkbox-modality-block', {
|
|
41
|
-
checked: checked,
|
|
42
|
-
disabled: disabled
|
|
43
|
-
})
|
|
44
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
45
|
-
id: id,
|
|
46
|
-
role: "checkbox",
|
|
47
|
-
className: "lunatic-input-checkbox",
|
|
48
|
-
"aria-checked": checked,
|
|
49
|
-
tabIndex: "0",
|
|
50
|
-
onClick: onClickOption,
|
|
51
|
-
onKeyDown: handleKeyDown,
|
|
52
|
-
"aria-labelledby": labelledBy
|
|
53
|
-
}, /*#__PURE__*/_react["default"].createElement(Icon, null)));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var _default = CheckboxOption;
|
|
57
|
-
exports["default"] = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.lunatic-checkbox-boolean{}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _pairwiseBlock["default"];
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _pairwiseBlock = _interopRequireDefault(require("./pairwise-block"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var PairwiseBlock = function PairwiseBlock() {
|
|
13
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, "TODO: PairwiseBlock");
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
var _default = PairwiseBlock;
|
|
17
|
-
exports["default"] = _default;
|
|
@@ -1,36 +0,0 @@
|
|
|
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 _block = _interopRequireDefault(require("./block"));
|
|
13
|
-
|
|
14
|
-
var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-types"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
|
-
var stories = {
|
|
19
|
-
title: 'Pairwise/Block',
|
|
20
|
-
component: _orchestrator["default"],
|
|
21
|
-
argTypes: _defaultArgTypes["default"]
|
|
22
|
-
};
|
|
23
|
-
var _default = stories;
|
|
24
|
-
exports["default"] = _default;
|
|
25
|
-
|
|
26
|
-
var Template = function Template(args) {
|
|
27
|
-
return /*#__PURE__*/_react["default"].createElement(_orchestrator["default"], args);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var Default = Template.bind({});
|
|
31
|
-
exports.Default = Default;
|
|
32
|
-
Default.args = {
|
|
33
|
-
id: 'block',
|
|
34
|
-
source: _block["default"],
|
|
35
|
-
pagination: true
|
|
36
|
-
};
|