@inseefr/lunatic 2.4.1 → 2.4.2
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/lunatic-component-with-label.js +5 -6
- package/lib/components/component-set/html/component-set-component-container.js +20 -0
- package/lib/components/component-set/html/component-set-components.js +59 -0
- package/lib/components/component-set/html/component-set.js +32 -0
- package/lib/components/component-set/html/legend/index.js +13 -0
- package/lib/components/component-set/html/legend/legend.js +31 -0
- package/lib/components/component-set/index.js +20 -0
- package/lib/components/component-set/lunatic-component-set.js +69 -0
- package/lib/components/components.js +9 -1
- package/lib/components/declarations/declarations.scss +8 -2
- package/lib/components/input/html/input.scss +1 -1
- package/lib/components/radio/html/radio-group-content.js +4 -2
- package/lib/components/radio/html/radio-group-content.spec.js +14 -0
- package/lib/components/radio/html/radio-group.js +8 -4
- package/lib/components/radio/html/radio-option.js +14 -10
- package/lib/components/radio/lunatic-radio-group.js +6 -3
- package/lib/components/radio/radio-group.js +5 -2
- package/lib/components/suggester/html/suggester.js +2 -1
- package/lib/i18n/dictionary.js +4 -0
- package/lib/src/i18n/dictionary.d.ts +4 -0
- package/lib/src/i18n/index.d.ts +1 -1
- package/lib/src/use-lunatic/commons/execute-expression/create-refresh-calculated.d.ts +2 -2
- package/lib/src/use-lunatic/commons/execute-expression/create-refresh-calculated.spec.d.ts +1 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +39 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +30 -0
- package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/resolve-component-controls/index.d.ts +1 -0
- package/lib/src/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.d.ts +10 -0
- package/lib/src/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.d.ts +3 -0
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +9 -0
- package/lib/src/use-lunatic/type-source.d.ts +14 -3
- package/lib/src/use-lunatic/use-lunatic.d.ts +1 -1
- package/lib/src/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.d.ts +2 -0
- package/lib/src/utils/suggester-workers/searching/compute-score.d.ts +3 -0
- package/lib/src/utils/suggester-workers/searching/meloto-order.d.ts +24 -0
- package/lib/stories/Introduction.stories.mdx +4 -4
- package/lib/stories/checkboxGroup/source.json +4 -5
- package/lib/stories/component-set/component-set.stories.js +56 -0
- package/lib/stories/component-set/data.json +18 -0
- package/lib/stories/component-set/data1.json +18 -0
- package/lib/stories/component-set/data2.json +18 -0
- package/lib/stories/component-set/source.json +99 -0
- package/lib/stories/component-set/source1.json +287 -0
- package/lib/stories/component-set/source2.json +413 -0
- package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +1 -2
- package/lib/stories/declaration/source.json +24 -0
- package/lib/stories/loop/paginated-loop.stories.js +34 -0
- package/lib/stories/loop/source-paginated.json +126 -0
- package/lib/stories/paste-questionnaire/test.stories.js +1 -1
- package/lib/stories/questionnaires-test/controls/controls-externes.json +75 -0
- package/lib/stories/questionnaires-test/controls/controls-externes.stories.js +62 -0
- package/lib/stories/questionnaires-test/controls/controls.stories.js +1 -1
- package/lib/stories/questionnaires-test/test.stories.js +1 -1
- package/lib/stories/questionnaires2023/bySequence/source.json +5054 -0
- package/lib/stories/questionnaires2023/bySequence/ticWeb.stories.js +64 -0
- package/lib/stories/questionnaires2023/famille/famille.stories.js +64 -0
- package/lib/stories/questionnaires2023/famille/source.json +50344 -0
- package/lib/stories/questionnaires2023/simpsons/simpsons.stories.js +64 -0
- package/lib/stories/questionnaires2023/simpsons/source.json +5176 -0
- package/lib/stories/questionnaires2023/ticTel/source.json +12888 -0
- package/lib/stories/questionnaires2023/ticTel/ticWeb.stories.js +64 -0
- package/lib/stories/questionnaires2023/ticWeb/source.json +11331 -0
- package/lib/stories/questionnaires2023/ticWeb/ticWeb.stories.js +64 -0
- package/lib/stories/resizing-questionnaire/source.json +789 -0
- package/lib/stories/resizing-questionnaire/test.stories.js +84 -0
- package/lib/stories/roundabout/source.json +16 -0
- package/lib/stories/suggester/SuggesterNotification.js +26 -0
- package/lib/stories/suggester/suggester-workers.stories.js +8 -5
- package/lib/stories/suggester/suggester.stories.js +1 -0
- package/lib/use-lunatic/actions.js +4 -4
- package/lib/use-lunatic/commons/calculated-variables.js +1 -1
- package/lib/use-lunatic/commons/compile-controls.js +4 -3
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.spec.js +155 -0
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +3 -2
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.spec.js +128 -0
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +4 -1
- package/lib/use-lunatic/reducer/reduce-on-init.js +1 -2
- package/lib/use-lunatic/reducer/resolve-component-controls/index.js +12 -0
- package/lib/use-lunatic/reducer/{validate-controls/validation-utils.js → resolve-component-controls/resolve-component-control.js} +10 -34
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.js +54 -0
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +44 -0
- package/lib/use-lunatic/replace-component-sequence.js +28 -0
- package/lib/use-lunatic/type-source.js +15 -9
- package/lib/use-lunatic/use-lunatic.js +1 -1
- package/lib/use-lunatic/use-suggesters.js +5 -5
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +4 -2
- package/lib/utils/suggester-workers/append-to-index/dist/create-append-task.js +4 -2
- package/lib/utils/suggester-workers/commons-tokenizer/get-stemmer.spec.js +11 -0
- package/lib/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.spec.js +10 -0
- package/lib/utils/suggester-workers/searching/compute-score.js +7 -12
- package/lib/utils/suggester-workers/searching/meloto-order.js +53 -0
- package/lib/utils/suggester-workers/searching/meloto-order.spec.js +67 -0
- package/lib/utils/suggester-workers/searching/searching.js +3 -3
- package/lib/utils/suggester-workers/searching/searching.worker.js +4 -2
- package/package.json +1 -1
- /package/lib/src/use-lunatic/reducer/{validate-controls/validation-utils.d.ts → resolve-component-controls/resolve-component-control.d.ts} +0 -0
|
@@ -21,12 +21,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
21
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
22
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
23
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*/
|
|
24
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
|
|
25
|
+
* This functions returns declartions with "after" position if exist, else return description
|
|
26
|
+
* @param {declarations, description}
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
30
29
|
function getDescription(_ref) {
|
|
31
30
|
var declarations = _ref.declarations,
|
|
32
31
|
description = _ref.description;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _commons = require("../../commons");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
function ComponentSetComponentContainer(props) {
|
|
12
|
+
var children = props.children,
|
|
13
|
+
className = props.className;
|
|
14
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
15
|
+
className: (0, _classnames["default"])('lunatic-component-set-component', className),
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
var _default = (0, _commons.createCustomizableLunaticField)(ComponentSetComponentContainer, 'ComponentSetComponentContainer');
|
|
20
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _commons = require("../../commons");
|
|
9
|
+
var _componentSetComponentContainer = _interopRequireDefault(require("./component-set-component-container"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function getComponentValue(component, value) {
|
|
13
|
+
var response = component.response;
|
|
14
|
+
if (response && response.name in value) {
|
|
15
|
+
var _value$response$name;
|
|
16
|
+
return (_value$response$name = value[response.name]) !== null && _value$response$name !== void 0 ? _value$response$name : '';
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
function ComponentSetComponents(_ref) {
|
|
21
|
+
var components = _ref.components,
|
|
22
|
+
value = _ref.value,
|
|
23
|
+
features = _ref.features,
|
|
24
|
+
missing = _ref.missing,
|
|
25
|
+
shortcut = _ref.shortcut,
|
|
26
|
+
management = _ref.management,
|
|
27
|
+
preferences = _ref.preferences,
|
|
28
|
+
executeExpression = _ref.executeExpression,
|
|
29
|
+
errors = _ref.errors,
|
|
30
|
+
classNames = _ref.classNames,
|
|
31
|
+
handleChange = _ref.handleChange;
|
|
32
|
+
if (!Array.isArray(components)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
36
|
+
children: components.map(function (component) {
|
|
37
|
+
var id = component.id;
|
|
38
|
+
var componentValue = getComponentValue(component, value);
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentSetComponentContainer["default"], {
|
|
40
|
+
className: classNames,
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.OrchestratedComponent, {
|
|
42
|
+
component: component,
|
|
43
|
+
features: features,
|
|
44
|
+
missing: missing,
|
|
45
|
+
shortcut: shortcut,
|
|
46
|
+
management: management,
|
|
47
|
+
value: componentValue,
|
|
48
|
+
id: id,
|
|
49
|
+
preferences: preferences,
|
|
50
|
+
executeExpression: executeExpression,
|
|
51
|
+
errors: errors,
|
|
52
|
+
handleChange: handleChange
|
|
53
|
+
})
|
|
54
|
+
}, id);
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
var _default = ComponentSetComponents;
|
|
59
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _commons = require("../../commons");
|
|
9
|
+
var _legend = _interopRequireDefault(require("./legend"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function ComponentSet(_ref) {
|
|
13
|
+
var id = _ref.id,
|
|
14
|
+
errors = _ref.errors,
|
|
15
|
+
description = _ref.description,
|
|
16
|
+
legendText = _ref.legendText,
|
|
17
|
+
children = _ref.children;
|
|
18
|
+
var labelId = "label-".concat(id);
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("fieldset", {
|
|
20
|
+
className: "lunatic-component-set",
|
|
21
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_legend["default"], {
|
|
22
|
+
id: labelId,
|
|
23
|
+
description: description,
|
|
24
|
+
children: legendText
|
|
25
|
+
}), children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.Errors, {
|
|
26
|
+
errors: errors,
|
|
27
|
+
activeId: id
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
var _default = (0, _commons.createCustomizableLunaticField)(ComponentSet, 'ComponentSet');
|
|
32
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 _legend["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _legend = _interopRequireDefault(require("./legend"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _description = _interopRequireDefault(require("../../../commons/components/description"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function Legend(_ref) {
|
|
13
|
+
var children = _ref.children,
|
|
14
|
+
id = _ref.id,
|
|
15
|
+
className = _ref.className,
|
|
16
|
+
description = _ref.description;
|
|
17
|
+
if (children) {
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
19
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("legend", {
|
|
20
|
+
id: id,
|
|
21
|
+
className: (0, _classnames["default"])('lunatic-legend', className),
|
|
22
|
+
children: children
|
|
23
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_description["default"], {
|
|
24
|
+
value: description
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
var _default = Legend;
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ComponentSetComponents", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _componentSetComponents.ComponentSetComponents;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _lunaticComponentSet["default"];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _lunaticComponentSet = _interopRequireDefault(require("./lunatic-component-set"));
|
|
19
|
+
var _componentSetComponents = require("./html/component-set-components");
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _lunaticComponentWithoutLabel = _interopRequireDefault(require("../commons/components/lunatic-component-without-label"));
|
|
9
|
+
var _componentSet = _interopRequireDefault(require("./html/component-set"));
|
|
10
|
+
var _componentSetComponents = _interopRequireDefault(require("./html/component-set-components"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
function LunaticComponentSet(props) {
|
|
14
|
+
var declarations = props.declarations,
|
|
15
|
+
label = props.label,
|
|
16
|
+
id = props.id,
|
|
17
|
+
components = props.components,
|
|
18
|
+
value = props.value,
|
|
19
|
+
executeExpression = props.executeExpression,
|
|
20
|
+
shortcut = props.shortcut,
|
|
21
|
+
management = props.management,
|
|
22
|
+
missing = props.missing,
|
|
23
|
+
features = props.features,
|
|
24
|
+
preferences = props.preferences,
|
|
25
|
+
errors = props.errors,
|
|
26
|
+
description = props.description,
|
|
27
|
+
handleChange = props.handleChange;
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponentWithoutLabel["default"], {
|
|
29
|
+
id: id,
|
|
30
|
+
preferences: preferences,
|
|
31
|
+
declarations: declarations,
|
|
32
|
+
value: value,
|
|
33
|
+
missing: missing,
|
|
34
|
+
management: management,
|
|
35
|
+
description: description,
|
|
36
|
+
components: components,
|
|
37
|
+
executeExpression: executeExpression,
|
|
38
|
+
shortcut: shortcut,
|
|
39
|
+
features: features,
|
|
40
|
+
handleChange: handleChange,
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentSet["default"], {
|
|
42
|
+
id: id,
|
|
43
|
+
legendText: label,
|
|
44
|
+
errors: errors,
|
|
45
|
+
components: components,
|
|
46
|
+
value: value,
|
|
47
|
+
features: features,
|
|
48
|
+
executeExpression: executeExpression,
|
|
49
|
+
preferences: preferences,
|
|
50
|
+
management: management,
|
|
51
|
+
missing: missing,
|
|
52
|
+
shortcut: shortcut,
|
|
53
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentSetComponents["default"], {
|
|
54
|
+
components: components,
|
|
55
|
+
features: features,
|
|
56
|
+
errors: errors,
|
|
57
|
+
value: value,
|
|
58
|
+
executeExpression: executeExpression,
|
|
59
|
+
preferences: preferences,
|
|
60
|
+
management: management,
|
|
61
|
+
missing: missing,
|
|
62
|
+
shortcut: shortcut,
|
|
63
|
+
handleChange: handleChange
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
var _default = LunaticComponentSet;
|
|
69
|
+
exports["default"] = _default;
|
|
@@ -22,7 +22,8 @@ var _exportNames = {
|
|
|
22
22
|
Switch: true,
|
|
23
23
|
Textarea: true,
|
|
24
24
|
SuggesterLoaderWidget: true,
|
|
25
|
-
Roundabout: true
|
|
25
|
+
Roundabout: true,
|
|
26
|
+
ComponentSet: true
|
|
26
27
|
};
|
|
27
28
|
Object.defineProperty(exports, "Button", {
|
|
28
29
|
enumerable: true,
|
|
@@ -30,6 +31,12 @@ Object.defineProperty(exports, "Button", {
|
|
|
30
31
|
return _button["default"];
|
|
31
32
|
}
|
|
32
33
|
});
|
|
34
|
+
Object.defineProperty(exports, "ComponentSet", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function get() {
|
|
37
|
+
return _componentSet["default"];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
33
40
|
Object.defineProperty(exports, "Datepicker", {
|
|
34
41
|
enumerable: true,
|
|
35
42
|
get: function get() {
|
|
@@ -168,4 +175,5 @@ var _switch = _interopRequireDefault(require("./switch"));
|
|
|
168
175
|
var _textarea = _interopRequireDefault(require("./textarea"));
|
|
169
176
|
var _suggesterLoaderWidget = _interopRequireDefault(require("./suggester-loader-widget"));
|
|
170
177
|
var _roundabout = _interopRequireDefault(require("./roundabout"));
|
|
178
|
+
var _componentSet = _interopRequireDefault(require("./component-set"));
|
|
171
179
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -20,10 +20,16 @@
|
|
|
20
20
|
color: green;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.
|
|
23
|
+
.CODECARD {
|
|
24
24
|
font-style: bold;
|
|
25
25
|
font-size: 80%;
|
|
26
|
-
color:
|
|
26
|
+
color: grey;
|
|
27
|
+
border: solid 1px grey;
|
|
28
|
+
width: fit-content;
|
|
29
|
+
padding: 1em;
|
|
30
|
+
&:before {
|
|
31
|
+
content: "→ "
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
.declaration-message_filter {
|
|
@@ -17,7 +17,8 @@ function RadioGroupContent(_ref) {
|
|
|
17
17
|
onClick = _ref.onClick,
|
|
18
18
|
_ref$checkboxStyle = _ref.checkboxStyle,
|
|
19
19
|
checkboxStyle = _ref$checkboxStyle === void 0 ? false : _ref$checkboxStyle,
|
|
20
|
-
shortcut = _ref.shortcut
|
|
20
|
+
shortcut = _ref.shortcut,
|
|
21
|
+
disabled = _ref.disabled;
|
|
21
22
|
var onKeyDown = (0, _commons.useOptionsKeydown)(options, onClick);
|
|
22
23
|
var maxIndex = options.length;
|
|
23
24
|
return options.map(function (option, index) {
|
|
@@ -37,7 +38,8 @@ function RadioGroupContent(_ref) {
|
|
|
37
38
|
label: label,
|
|
38
39
|
description: description,
|
|
39
40
|
codeModality: shortcut && codeModality,
|
|
40
|
-
shortcut: shortcut
|
|
41
|
+
shortcut: shortcut,
|
|
42
|
+
disabled: disabled
|
|
41
43
|
}, radioId);
|
|
42
44
|
});
|
|
43
45
|
}
|
|
@@ -83,4 +83,18 @@ var options = [{
|
|
|
83
83
|
});
|
|
84
84
|
(0, _vitest.expect)(option1.parentNode).toHaveAttribute('aria-checked', 'true');
|
|
85
85
|
});
|
|
86
|
+
(0, _vitest.it)('Click not working when disabled', function () {
|
|
87
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_radioGroupContent["default"], {
|
|
88
|
+
options: options,
|
|
89
|
+
value: "option1",
|
|
90
|
+
disabled: true
|
|
91
|
+
})),
|
|
92
|
+
getByText = _render6.getByText;
|
|
93
|
+
var option1 = getByText('Option 1');
|
|
94
|
+
(0, _vitest.expect)(option1.parentNode).toHaveAttribute('tabIndex', '0');
|
|
95
|
+
_react2.fireEvent.keyDown(option1, {
|
|
96
|
+
key: '1'
|
|
97
|
+
});
|
|
98
|
+
(0, _vitest.expect)(option1.parentNode).toHaveAttribute('aria-checked', 'true');
|
|
99
|
+
});
|
|
86
100
|
});
|
|
@@ -22,7 +22,8 @@ function RadioGroup(_ref) {
|
|
|
22
22
|
checkboxStyle = _ref$checkboxStyle === void 0 ? false : _ref$checkboxStyle,
|
|
23
23
|
errors = _ref.errors,
|
|
24
24
|
className = _ref.className,
|
|
25
|
-
shortcut = _ref.shortcut
|
|
25
|
+
shortcut = _ref.shortcut,
|
|
26
|
+
disabled = _ref.disabled;
|
|
26
27
|
var onKeyDown = (0, _commons.useOptionsKeydown)(options, onSelect);
|
|
27
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_commons.Fieldset, {
|
|
28
29
|
className: className,
|
|
@@ -36,7 +37,8 @@ function RadioGroup(_ref) {
|
|
|
36
37
|
checkboxStyle: checkboxStyle,
|
|
37
38
|
label: label,
|
|
38
39
|
options: options,
|
|
39
|
-
shortcut: shortcut
|
|
40
|
+
shortcut: shortcut,
|
|
41
|
+
disabled: disabled
|
|
40
42
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.Errors, {
|
|
41
43
|
errors: errors,
|
|
42
44
|
activeId: id
|
|
@@ -55,13 +57,15 @@ RadioGroup.propTypes = {
|
|
|
55
57
|
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].bool, _propTypes["default"].array]),
|
|
56
58
|
className: _propTypes["default"].string,
|
|
57
59
|
errors: _propTypes["default"].object,
|
|
58
|
-
shortcut: _propTypes["default"].bool
|
|
60
|
+
shortcut: _propTypes["default"].bool,
|
|
61
|
+
disabled: _propTypes["default"].bool
|
|
59
62
|
};
|
|
60
63
|
RadioGroup.defaultProps = {
|
|
61
64
|
errors: undefined,
|
|
62
65
|
value: undefined,
|
|
63
66
|
label: undefined,
|
|
64
|
-
className: undefined
|
|
67
|
+
className: undefined,
|
|
68
|
+
disabled: false
|
|
65
69
|
};
|
|
66
70
|
var _default = (0, _commons.createCustomizableLunaticField)(RadioGroup, 'Radio');
|
|
67
71
|
exports["default"] = _default;
|
|
@@ -45,17 +45,21 @@ function RadioOption(_ref) {
|
|
|
45
45
|
var tabIndex = checked ? '0' : '-1';
|
|
46
46
|
var onClickOption = (0, _react.useCallback)(function () {
|
|
47
47
|
// on checkboxStyle, clicking on checked value unchecks it, so it acts as if empty answer was clicked
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (!disabled) {
|
|
49
|
+
checkboxStyle && checked ? onClick(null) : onClick(value);
|
|
50
|
+
}
|
|
51
|
+
}, [value, onClick, checked, checkboxStyle, disabled]);
|
|
50
52
|
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
if (!disabled) {
|
|
54
|
+
var key = e.key;
|
|
55
|
+
var current = spanEl.current;
|
|
56
|
+
onKeyDown({
|
|
57
|
+
key: key,
|
|
58
|
+
index: index
|
|
59
|
+
});
|
|
60
|
+
current.blur();
|
|
61
|
+
}
|
|
62
|
+
}, [onKeyDown, index, spanEl, disabled]);
|
|
59
63
|
(0, _react.useEffect)(function () {
|
|
60
64
|
var current = spanEl.current;
|
|
61
65
|
if (current && checked) {
|
|
@@ -27,7 +27,8 @@ function LunaticRadioGroup(props) {
|
|
|
27
27
|
missing = props.missing,
|
|
28
28
|
shortcut = props.shortcut,
|
|
29
29
|
management = props.management,
|
|
30
|
-
className = props.className
|
|
30
|
+
className = props.className,
|
|
31
|
+
disabled = props.disabled;
|
|
31
32
|
var onChange = (0, _useOnHandleChange["default"])({
|
|
32
33
|
handleChange: handleChange,
|
|
33
34
|
response: response,
|
|
@@ -53,12 +54,14 @@ function LunaticRadioGroup(props) {
|
|
|
53
54
|
errors: errors,
|
|
54
55
|
label: label,
|
|
55
56
|
className: className,
|
|
56
|
-
shortcut: shortcut
|
|
57
|
+
shortcut: shortcut,
|
|
58
|
+
disabled: disabled
|
|
57
59
|
})
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
LunaticRadioGroup.defaultProps = {
|
|
61
|
-
className: 'lunatic-radio-group'
|
|
63
|
+
className: 'lunatic-radio-group',
|
|
64
|
+
disabled: false
|
|
62
65
|
};
|
|
63
66
|
var _default = (0, _commons.createCustomizableLunaticField)(LunaticRadioGroup, 'LunaticRadioGroup');
|
|
64
67
|
exports["default"] = _default;
|
|
@@ -17,7 +17,9 @@ function Radio(_ref) {
|
|
|
17
17
|
onClick = _ref.onClick,
|
|
18
18
|
shortcut = _ref.shortcut,
|
|
19
19
|
_ref$checkboxStyle = _ref.checkboxStyle,
|
|
20
|
-
checkboxStyle = _ref$checkboxStyle === void 0 ? false : _ref$checkboxStyle
|
|
20
|
+
checkboxStyle = _ref$checkboxStyle === void 0 ? false : _ref$checkboxStyle,
|
|
21
|
+
_ref$disabled = _ref.disabled,
|
|
22
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
21
23
|
var onKeyDown = (0, _commons.useOptionsKeydown)(options, onClick);
|
|
22
24
|
var maxIndex = options.length;
|
|
23
25
|
return options.map(function (option, index) {
|
|
@@ -39,7 +41,8 @@ function Radio(_ref) {
|
|
|
39
41
|
checkboxStyle: checkboxStyle,
|
|
40
42
|
label: label,
|
|
41
43
|
shortcut: shortcut,
|
|
42
|
-
codeModality: codeModality
|
|
44
|
+
codeModality: codeModality,
|
|
45
|
+
disabled: disabled
|
|
43
46
|
})
|
|
44
47
|
}, radioId);
|
|
45
48
|
});
|
|
@@ -8,6 +8,7 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _commons = require("../../commons");
|
|
11
|
+
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
11
12
|
require("./default-style.scss");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -128,7 +129,7 @@ Suggester.propTypes = {
|
|
|
128
129
|
Suggester.defaultProps = {
|
|
129
130
|
className: 'lunatic-suggester-default-style',
|
|
130
131
|
labelledBy: undefined,
|
|
131
|
-
placeholder:
|
|
132
|
+
placeholder: _i18n["default"].PLACEHOLDER,
|
|
132
133
|
optionRenderer: _commons.DefaultOptionRenderer,
|
|
133
134
|
labelRenderer: _commons.DefaultLabelRenderer,
|
|
134
135
|
language: 'French',
|
package/lib/i18n/dictionary.js
CHANGED
|
@@ -23,6 +23,10 @@ declare const dictionary: {
|
|
|
23
23
|
readonly fr: "Refus";
|
|
24
24
|
readonly en: "Refused";
|
|
25
25
|
};
|
|
26
|
+
readonly PLACEHOLDER: {
|
|
27
|
+
readonly fr: "Commencez votre saisie...";
|
|
28
|
+
readonly en: "Start typing...";
|
|
29
|
+
};
|
|
26
30
|
};
|
|
27
31
|
export default dictionary;
|
|
28
32
|
export type Dictionary = typeof dictionary;
|
package/lib/src/i18n/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export declare const inputNumberPropsI18N: {
|
|
|
3
3
|
thousandSeparator: string;
|
|
4
4
|
decimalSeparator: string;
|
|
5
5
|
};
|
|
6
|
-
declare const _default: Record<"DK" | "RF" | "DEFAULT_BUTTON_ADD" | "DEFAULT_BUTTON_REMOVE" | "MODAL_IGNORE" | "MODAL_CORRECT", string>;
|
|
6
|
+
declare const _default: Record<"DK" | "RF" | "DEFAULT_BUTTON_ADD" | "DEFAULT_BUTTON_REMOVE" | "MODAL_IGNORE" | "MODAL_CORRECT" | "PLACEHOLDER", string>;
|
|
7
7
|
export default _default;
|
|
@@ -16,9 +16,9 @@ type Args = {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createRefreshCalculated({ variables, execute, bindings }: Args): readonly [(map: {
|
|
18
18
|
[variableName: string]: unknown;
|
|
19
|
-
}, { rootExpression, iteration, linksIterations, }
|
|
19
|
+
}, { rootExpression, iteration, linksIterations, }?: {
|
|
20
20
|
rootExpression?: string | undefined;
|
|
21
21
|
iteration?: number | undefined;
|
|
22
22
|
linksIterations?: number[] | undefined;
|
|
23
|
-
}) =>
|
|
23
|
+
}) => Record<string, unknown>, (name: string, variable: LunaticVariable) => void];
|
|
24
24
|
export default createRefreshCalculated;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,5 +5,5 @@ export type DeepTranslateExpression<T> = T extends LunaticExpression ? ReactNode
|
|
|
5
5
|
} ? {
|
|
6
6
|
[key in keyof T]: DeepTranslateExpression<T[key]>;
|
|
7
7
|
} : T;
|
|
8
|
-
declare function fillComponentExpressions(component: LunaticComponentDefinition, state: Pick<LunaticState, 'pager' | 'executeExpression'>): LunaticComponentDefinition<"CheckboxGroup" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "Roundabout">;
|
|
8
|
+
declare function fillComponentExpressions(component: LunaticComponentDefinition, state: Pick<LunaticState, 'pager' | 'executeExpression'>): LunaticComponentDefinition<"CheckboxGroup" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "Input" | "InputNumber" | "Datepicker" | "CheckboxOne" | "CheckboxBoolean" | "Radio" | "Dropdown" | "Textarea" | "FilterDescription" | "PairwiseLinks" | "ComponentSet" | "Roundabout">;
|
|
9
9
|
export default fillComponentExpressions;
|
|
@@ -695,5 +695,44 @@ declare function fillFromState(component: LunaticComponentDefinition, state: Lun
|
|
|
695
695
|
page: string;
|
|
696
696
|
componentType: "Input" | "CheckboxOne" | "Textarea";
|
|
697
697
|
errors?: Record<string, import("../../type").LunaticError[]> | undefined;
|
|
698
|
+
} | {
|
|
699
|
+
handleChange: (response: {
|
|
700
|
+
name: string;
|
|
701
|
+
}, value: unknown, args: Record<string, unknown>) => void;
|
|
702
|
+
executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
|
|
703
|
+
iteration?: number | undefined;
|
|
704
|
+
linksIterations?: number[] | undefined;
|
|
705
|
+
logging?: import("../execute-expression/create-execute-expression").ExpressionLogger | undefined;
|
|
706
|
+
bindingDependencies?: string[] | undefined;
|
|
707
|
+
} | undefined) => T;
|
|
708
|
+
preferences: ["COLLECTED"];
|
|
709
|
+
goToPage: (page: {
|
|
710
|
+
page: string;
|
|
711
|
+
iteration?: number | undefined;
|
|
712
|
+
nbIterations?: number | undefined;
|
|
713
|
+
subPage?: number | undefined;
|
|
714
|
+
roundabout?: {
|
|
715
|
+
page: string;
|
|
716
|
+
} | undefined;
|
|
717
|
+
}) => void;
|
|
718
|
+
shortcut: boolean | undefined;
|
|
719
|
+
getSuggesterStatus: (name: string) => {
|
|
720
|
+
status: import("../../use-suggesters").SuggesterStatus;
|
|
721
|
+
timestamp: number;
|
|
722
|
+
};
|
|
723
|
+
label: import("../../type-source").LabelType;
|
|
724
|
+
declarations: import("../../type-source").DeclarationType[];
|
|
725
|
+
conditionFilter: import("../../type-source").ConditionFilterType;
|
|
726
|
+
controls?: import("../../type-source").ControlType[] | undefined;
|
|
727
|
+
id: string;
|
|
728
|
+
storeName: string;
|
|
729
|
+
bindingDependencies: string[];
|
|
730
|
+
hierarchy: import("../../type-source").Hierarchy;
|
|
731
|
+
missingResponse: import("../../type-source").ResponseType;
|
|
732
|
+
mandatory?: boolean | undefined;
|
|
733
|
+
page: string;
|
|
734
|
+
componentType: "ComponentSet";
|
|
735
|
+
components: import("../../type-source").ComponentType[];
|
|
736
|
+
errors?: Record<string, import("../../type").LunaticError[]> | undefined;
|
|
698
737
|
};
|
|
699
738
|
export default fillFromState;
|
|
@@ -534,6 +534,36 @@ declare function fillSpecificExpressions(component: DeepTranslateExpression<Luna
|
|
|
534
534
|
errors?: {
|
|
535
535
|
[x: string]: import("../../type").LunaticError[];
|
|
536
536
|
} | undefined;
|
|
537
|
+
} | {
|
|
538
|
+
label: import("react").ReactNode;
|
|
539
|
+
declarations: import("../../type-source").DeclarationType[];
|
|
540
|
+
conditionFilter: import("react").ReactNode;
|
|
541
|
+
controls?: import("../../type-source").ControlType[] | undefined;
|
|
542
|
+
id: string;
|
|
543
|
+
storeName: string;
|
|
544
|
+
bindingDependencies: string[];
|
|
545
|
+
hierarchy: {
|
|
546
|
+
sequence: {
|
|
547
|
+
label: import("react").ReactNode;
|
|
548
|
+
id: string;
|
|
549
|
+
page: string;
|
|
550
|
+
};
|
|
551
|
+
subSequence?: {
|
|
552
|
+
label: import("react").ReactNode;
|
|
553
|
+
id: string;
|
|
554
|
+
page: string;
|
|
555
|
+
} | undefined;
|
|
556
|
+
};
|
|
557
|
+
missingResponse: {
|
|
558
|
+
name: string;
|
|
559
|
+
};
|
|
560
|
+
mandatory?: boolean | undefined;
|
|
561
|
+
page: string;
|
|
562
|
+
componentType: "ComponentSet";
|
|
563
|
+
components: import("../../type-source").ComponentType[];
|
|
564
|
+
errors?: {
|
|
565
|
+
[x: string]: import("../../type").LunaticError[];
|
|
566
|
+
} | undefined;
|
|
537
567
|
} | {
|
|
538
568
|
expressions: {};
|
|
539
569
|
label: import("react").ReactNode;
|