@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.
@@ -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(_ref) {
23
- var components = _ref.components,
24
- autoFocusKey = _ref.autoFocusKey,
25
- componentProps = _ref.componentProps,
26
- _ref$wrapper = _ref.wrapper,
27
- wrapper = _ref$wrapper === void 0 ? function (_ref2) {
28
- var children = _ref2.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
- } : _ref$wrapper;
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)(WrapperComponent, {
39
- ref: WrapperComponent === _react.Fragment ? undefined : wrapperRef,
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: ["Le store ", storeName, " est en cours de chargement."]
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>;
@@ -275,6 +275,7 @@ type ComponentPropsByType = {
275
275
  page: string;
276
276
  goNextPage: () => void;
277
277
  goPreviousPage: () => void;
278
+ backPage?: string;
278
279
  };
279
280
  RemoteComponent: LunaticBaseProps<string | null> & {
280
281
  components: LunaticComponentDefinition[];
@@ -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 = 20;
126
+ _context.next = 26;
119
127
  break;
120
128
  }
121
- _context.next = 13;
129
+ _context.next = 19;
122
130
  return getReferentiel(name);
123
- case 13:
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 = 18;
135
+ _context.next = 24;
128
136
  return append(data);
129
- case 18:
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 20:
139
- _context.next = 27;
146
+ case 26:
147
+ _context.next = 33;
140
148
  break;
141
- case 22:
142
- _context.prev = 22;
143
- _context.t0 = _context["catch"](4);
144
- console.error(_context.t0);
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 27:
155
+ case 33:
148
156
  case "end":
149
157
  return _context.stop();
150
158
  }
151
- }, _callee, null, [[4, 22]]);
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.14",
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": "^6.0.0",
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",