@inseefr/lunatic 2.6.14 → 2.6.15
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/lunatic-components.js +24 -11
- package/lib/components/modal/lunatic-modal.js +4 -2
- package/lib/components/suggester/idb-suggester/check-store.js +1 -1
- package/lib/src/components/modal/html/modal.d.ts +1 -1
- package/lib/src/components/type.d.ts +1 -0
- package/lib/use-lunatic/use-suggesters.js +21 -13
- package/package.json +2 -2
|
@@ -16,27 +16,40 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
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; }
|
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
var LunaticComponentsConatainer = /*#__PURE__*/(0, _react.forwardRef)(function Container(_ref, ref) {
|
|
20
|
+
var children = _ref.children,
|
|
21
|
+
autoFocusKey = _ref.autoFocusKey;
|
|
22
|
+
if (autoFocusKey) {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
24
|
+
ref: ref,
|
|
25
|
+
children: children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
29
|
+
children: children
|
|
30
|
+
});
|
|
31
|
+
});
|
|
19
32
|
/**
|
|
20
33
|
* Entry point for orchestrators, this component display the list of fields
|
|
21
34
|
*/
|
|
22
|
-
function LunaticComponents(
|
|
23
|
-
var components =
|
|
24
|
-
autoFocusKey =
|
|
25
|
-
componentProps =
|
|
26
|
-
|
|
27
|
-
wrapper =
|
|
28
|
-
var children =
|
|
35
|
+
function LunaticComponents(_ref2) {
|
|
36
|
+
var components = _ref2.components,
|
|
37
|
+
autoFocusKey = _ref2.autoFocusKey,
|
|
38
|
+
componentProps = _ref2.componentProps,
|
|
39
|
+
_ref2$wrapper = _ref2.wrapper,
|
|
40
|
+
wrapper = _ref2$wrapper === void 0 ? function (_ref3) {
|
|
41
|
+
var children = _ref3.children;
|
|
29
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
30
43
|
className: "lunatic lunatic-component",
|
|
31
44
|
children: children
|
|
32
45
|
});
|
|
33
|
-
} :
|
|
46
|
+
} : _ref2$wrapper;
|
|
34
47
|
var wrapperRef = (0, _react.useRef)(null);
|
|
35
48
|
var hasComponents = components.length > 0;
|
|
36
|
-
var WrapperComponent = autoFocusKey ? 'div' : _react.Fragment;
|
|
37
49
|
(0, _useAutoFocus.useAutoFocus)(wrapperRef, hasComponents ? autoFocusKey : undefined);
|
|
38
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
39
|
-
ref:
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LunaticComponentsConatainer, {
|
|
51
|
+
ref: wrapperRef,
|
|
52
|
+
autoFocusKey: autoFocusKey,
|
|
40
53
|
children: components.map(function (component, k) {
|
|
41
54
|
var props = _objectSpread(_objectSpread({}, component), componentProps === null || componentProps === void 0 ? void 0 : componentProps(component));
|
|
42
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
@@ -16,7 +16,8 @@ function LunaticModal(props) {
|
|
|
16
16
|
label = props.label,
|
|
17
17
|
description = props.description,
|
|
18
18
|
goNextPage = props.goNextPage,
|
|
19
|
-
goPreviousPage = props.goPreviousPage
|
|
19
|
+
goPreviousPage = props.goPreviousPage,
|
|
20
|
+
backPage = props.backPage;
|
|
20
21
|
var dialogRef = (0, _react.useRef)(null);
|
|
21
22
|
(0, _react.useEffect)(function () {
|
|
22
23
|
var _dialogRef$current;
|
|
@@ -54,7 +55,8 @@ function LunaticModal(props) {
|
|
|
54
55
|
onClick: handleDialogClick,
|
|
55
56
|
id: id,
|
|
56
57
|
label: label,
|
|
57
|
-
description: description
|
|
58
|
+
description: description,
|
|
59
|
+
backPage: backPage
|
|
58
60
|
})
|
|
59
61
|
});
|
|
60
62
|
}
|
|
@@ -91,7 +91,7 @@ function CheckStore(_ref) {
|
|
|
91
91
|
if (ready === 0) {
|
|
92
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
93
93
|
className: "lunatic-suggester-in-progress",
|
|
94
|
-
children: ["
|
|
94
|
+
children: ["La liste ", storeName, " est en cours de chargement."]
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
if (ready === 200) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MouseEventHandler, ReactEventHandler, RefObject } from 'react';
|
|
2
2
|
import type { LunaticComponentProps } from '../../type';
|
|
3
3
|
import './modal.scss';
|
|
4
|
-
type Props = Pick<LunaticComponentProps<'ConfirmationModal'>, 'id' | 'label' | 'description'> & {
|
|
4
|
+
type Props = Pick<LunaticComponentProps<'ConfirmationModal'>, 'id' | 'label' | 'description' | 'backPage'> & {
|
|
5
5
|
onClose: ReactEventHandler<HTMLDialogElement>;
|
|
6
6
|
onCancel: ReactEventHandler<HTMLDialogElement>;
|
|
7
7
|
onClick: MouseEventHandler<HTMLDialogElement>;
|
|
@@ -114,19 +114,27 @@ function useSuggesters(_ref) {
|
|
|
114
114
|
setTimestamp(Date.now());
|
|
115
115
|
}
|
|
116
116
|
case 10:
|
|
117
|
+
_context.next = 15;
|
|
118
|
+
break;
|
|
119
|
+
case 12:
|
|
120
|
+
_context.prev = 12;
|
|
121
|
+
_context.t0 = _context["catch"](4);
|
|
122
|
+
console.warn("Error during suggester's cleaning ".concat(name), _context.t0);
|
|
123
|
+
case 15:
|
|
124
|
+
_context.prev = 15;
|
|
117
125
|
if (!(current[name] === SuggesterStatus.pending)) {
|
|
118
|
-
_context.next =
|
|
126
|
+
_context.next = 26;
|
|
119
127
|
break;
|
|
120
128
|
}
|
|
121
|
-
_context.next =
|
|
129
|
+
_context.next = 19;
|
|
122
130
|
return getReferentiel(name);
|
|
123
|
-
case
|
|
131
|
+
case 19:
|
|
124
132
|
data = _context.sent;
|
|
125
133
|
_createAppendTask = (0, _createAppendTask3.createAppendTask)(store, 1, nothing, workersBasePath), _createAppendTask2 = _slicedToArray(_createAppendTask, 2), append = _createAppendTask2[0], abort = _createAppendTask2[1];
|
|
126
134
|
aborts.current.push(abort);
|
|
127
|
-
_context.next =
|
|
135
|
+
_context.next = 24;
|
|
128
136
|
return append(data);
|
|
129
|
-
case
|
|
137
|
+
case 24:
|
|
130
138
|
result = _context.sent;
|
|
131
139
|
if (result) {
|
|
132
140
|
setStatus(status, name, SuggesterStatus.success);
|
|
@@ -135,20 +143,20 @@ function useSuggesters(_ref) {
|
|
|
135
143
|
setStatus(status, name, SuggesterStatus.error);
|
|
136
144
|
setTimestamp(Date.now());
|
|
137
145
|
}
|
|
138
|
-
case
|
|
139
|
-
_context.next =
|
|
146
|
+
case 26:
|
|
147
|
+
_context.next = 33;
|
|
140
148
|
break;
|
|
141
|
-
case
|
|
142
|
-
_context.prev =
|
|
143
|
-
_context.
|
|
144
|
-
console.error(_context.
|
|
149
|
+
case 28:
|
|
150
|
+
_context.prev = 28;
|
|
151
|
+
_context.t1 = _context["catch"](15);
|
|
152
|
+
console.error("Error during suggester's loading ".concat(name), _context.t1);
|
|
145
153
|
setStatus(status, name, SuggesterStatus.error);
|
|
146
154
|
setTimestamp(Date.now());
|
|
147
|
-
case
|
|
155
|
+
case 33:
|
|
148
156
|
case "end":
|
|
149
157
|
return _context.stop();
|
|
150
158
|
}
|
|
151
|
-
}, _callee, null, [[4,
|
|
159
|
+
}, _callee, null, [[4, 12], [15, 28]]);
|
|
152
160
|
}));
|
|
153
161
|
return function (_x) {
|
|
154
162
|
return _ref3.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.15",
|
|
4
4
|
"workersVersion": "0.3.0-experimental",
|
|
5
5
|
"description": "Library of questionnaire components",
|
|
6
6
|
"repository": {
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"damerau-levenshtein": "^1.0.7",
|
|
134
134
|
"eslint": "7.30.0",
|
|
135
135
|
"eslint-config-prettier": "^9.0.0",
|
|
136
|
-
"eslint-config-react-app": "^
|
|
136
|
+
"eslint-config-react-app": "^7.0.0",
|
|
137
137
|
"eslint-plugin-flowtype": "^8.0.0",
|
|
138
138
|
"eslint-plugin-import": "^2.19.1",
|
|
139
139
|
"eslint-plugin-jsx-a11y": "^6.1.1",
|