@inseefr/lunatic 2.4.5-beta → 2.4.5-mvp-eap
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/combo-box/combo-box-content.js +2 -5
- package/lib/components/commons/components/combo-box/combo-box.js +16 -16
- package/lib/components/commons/components/combo-box/panel/panel.js +2 -4
- package/lib/components/commons/components/combo-box/state-management/reduce-on-init.js +4 -1
- package/lib/components/commons/components/orchestrated-component.js +2 -0
- package/lib/components/commons/create-row-orchestrator.js +2 -2
- package/lib/components/dropdown/lunatic-dropdown.js +1 -0
- package/lib/components/input-number/html/input-number.js +2 -1
- package/lib/components/input-number/html/input-number.scss +1 -1
- package/lib/components/input-number/lunatic-input-number.js +2 -0
- package/lib/components/loop/loop.js +6 -4
- package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +1 -0
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +45 -33
- package/lib/components/loop/roster-for-loop/roster-table.js +22 -18
- package/lib/components/loop/roster-for-loop/roster.scss +30 -37
- package/lib/components/loop/roster-for-loop/row.js +84 -31
- package/lib/components/pairwise-links/pairwise-links.js +2 -4
- package/lib/components/pairwise-links/row.js +1 -0
- package/lib/components/suggester/html/suggester.js +31 -12
- package/lib/components/suggester/idb-suggester/idb-suggester.js +10 -7
- package/lib/components/suggester/lunatic-suggester.js +31 -4
- package/lib/hooks/use-did-change.js +19 -0
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +4 -4
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/panel/panel.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/state-management/actions.d.ts +4 -4
- package/lib/src/components/commons/components/orchestrated-component.d.ts +3 -3
- package/lib/src/components/commons/create-row-orchestrator.d.ts +4 -3
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown.d.ts +2 -1
- package/lib/src/components/input-number/html/input-number.d.ts +1 -0
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +11 -3
- package/lib/src/components/loop/block-for-loop/block-for-loop.d.ts +5 -1
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +11 -3
- package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +8 -4
- package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +3 -3
- package/lib/src/components/loop/roster-for-loop/row.d.ts +3 -2
- package/lib/src/components/suggester/html/suggester.d.ts +6 -4
- package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +4 -3
- package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
- package/lib/src/components/type.d.ts +25 -5
- package/lib/src/hooks/use-did-change.d.ts +4 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +61 -16
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +36 -0
- package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/reduce-update-state.d.ts +106 -1
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +1 -1
- package/lib/src/use-lunatic/type-source.d.ts +11 -1
- package/lib/src/use-lunatic/type.d.ts +1 -1
- package/lib/stories/input-number/input-number.stories.js +8 -1
- package/lib/stories/input-number/source-dynamic.json +41 -0
- package/lib/stories/loop/block-for-loop.stories.js +1 -8
- package/lib/stories/loop/roster-for-loop.stories.js +8 -1
- package/lib/stories/loop/source-with-header.json +15 -3
- package/lib/stories/questionnaires/EAP/data-eap.json +46 -0
- package/lib/stories/questionnaires/EAP/eap.stories.js +71 -0
- package/lib/stories/questionnaires/EAP/source-eap.json +433 -0
- package/lib/stories/suggester/multipleResponses.json +100 -0
- package/lib/stories/suggester/suggester-workers.stories.js +1 -1
- package/lib/stories/suggester/suggester.stories.js +18 -6
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +1 -1
- package/lib/use-lunatic/commons/get-component-value/get-component-value.js +8 -0
- package/lib/use-lunatic/initial-state.js +1 -0
- package/lib/use-lunatic/reducer/reducer.js +1 -0
- package/package.json +1 -1
- package/lib/components/loop/roster-for-loop/body.js +0 -52
- package/lib/components/loop/roster-for-loop/header.js +0 -34
- package/lib/src/components/loop/roster-for-loop/body.d.ts +0 -12
- package/lib/src/components/loop/roster-for-loop/header.d.ts +0 -9
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = void 0;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
9
8
|
var _htmlTable = require("../../commons/components/html-table");
|
|
10
9
|
var _commons = require("../../commons");
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
11
|
var emptyValue = {};
|
|
15
12
|
function Row(_ref) {
|
|
16
13
|
var id = _ref.id,
|
|
@@ -25,6 +22,7 @@ function Row(_ref) {
|
|
|
25
22
|
management = _ref.management,
|
|
26
23
|
preferences = _ref.preferences,
|
|
27
24
|
executeExpression = _ref.executeExpression,
|
|
25
|
+
getSuggesterStatus = _ref.getSuggesterStatus,
|
|
28
26
|
errors = _ref.errors;
|
|
29
27
|
var handleChangeRow = (0, _react.useCallback)(function (response, value) {
|
|
30
28
|
handleChange(response, value, {
|
|
@@ -36,48 +34,103 @@ function Row(_ref) {
|
|
|
36
34
|
id: id
|
|
37
35
|
});
|
|
38
36
|
}
|
|
37
|
+
// @ts-ignore
|
|
39
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Tr, {
|
|
40
39
|
id: id,
|
|
41
40
|
row: rowIndex,
|
|
42
41
|
children: components.map(function (component) {
|
|
43
|
-
if (!('response' in component)) {
|
|
42
|
+
if (!('response' in component || 'responses' in component)) {
|
|
44
43
|
return null;
|
|
45
44
|
}
|
|
46
|
-
var
|
|
47
|
-
id = component.id;
|
|
45
|
+
var id = component.id;
|
|
48
46
|
var idComponent = "".concat(id, "-").concat(rowIndex);
|
|
49
|
-
var value = undefined;
|
|
50
47
|
var key = "".concat(id, "-").concat(rowIndex);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
var value;
|
|
49
|
+
/* FixMe type any */
|
|
50
|
+
if ('responses' in component) {
|
|
51
|
+
value = {};
|
|
52
|
+
var responses = component.responses;
|
|
53
|
+
responses === null || responses === void 0 ? void 0 : responses.forEach(function (res) {
|
|
54
|
+
var _res$response = res === null || res === void 0 ? void 0 : res.response,
|
|
55
|
+
name = _res$response.name;
|
|
56
|
+
if (name in valueMap) {
|
|
57
|
+
var v = valueMap[name];
|
|
58
|
+
if (Array.isArray(v)) {
|
|
59
|
+
value[name] = v[rowIndex] || '';
|
|
60
|
+
} else {
|
|
61
|
+
value[name] = '';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if ('response' in component) {
|
|
67
|
+
var _response = component.response;
|
|
68
|
+
if (_response) {
|
|
69
|
+
var name = _response.name;
|
|
70
|
+
if (name in valueMap) {
|
|
71
|
+
var v = valueMap[name];
|
|
72
|
+
if (Array.isArray(v)) {
|
|
73
|
+
value = v[rowIndex] || '';
|
|
74
|
+
} else {
|
|
75
|
+
value = '';
|
|
76
|
+
}
|
|
59
77
|
}
|
|
60
78
|
}
|
|
61
79
|
}
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RowCell, {
|
|
63
81
|
id: idComponent,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
errors: errors
|
|
77
|
-
})
|
|
82
|
+
component: component,
|
|
83
|
+
handleChange: handleChangeRow,
|
|
84
|
+
features: features,
|
|
85
|
+
missing: missing,
|
|
86
|
+
shortcut: shortcut,
|
|
87
|
+
management: management,
|
|
88
|
+
value: value,
|
|
89
|
+
preferences: preferences,
|
|
90
|
+
rowIndex: rowIndex,
|
|
91
|
+
executeExpression: executeExpression,
|
|
92
|
+
getSuggesterStatus: getSuggesterStatus,
|
|
93
|
+
errors: errors
|
|
78
94
|
}, key);
|
|
79
95
|
})
|
|
80
96
|
});
|
|
81
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Memoïzed version of a cell (for optimisation)
|
|
101
|
+
*/
|
|
102
|
+
var RowCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
103
|
+
var id = _ref2.id,
|
|
104
|
+
component = _ref2.component,
|
|
105
|
+
handleChange = _ref2.handleChange,
|
|
106
|
+
features = _ref2.features,
|
|
107
|
+
missing = _ref2.missing,
|
|
108
|
+
shortcut = _ref2.shortcut,
|
|
109
|
+
management = _ref2.management,
|
|
110
|
+
value = _ref2.value,
|
|
111
|
+
preferences = _ref2.preferences,
|
|
112
|
+
rowIndex = _ref2.rowIndex,
|
|
113
|
+
getSuggesterStatus = _ref2.getSuggesterStatus,
|
|
114
|
+
executeExpression = _ref2.executeExpression,
|
|
115
|
+
errors = _ref2.errors;
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_htmlTable.Td, {
|
|
117
|
+
id: id,
|
|
118
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.OrchestratedComponent, {
|
|
119
|
+
component: component,
|
|
120
|
+
handleChange: handleChange,
|
|
121
|
+
features: features,
|
|
122
|
+
missing: missing,
|
|
123
|
+
shortcut: shortcut,
|
|
124
|
+
management: management,
|
|
125
|
+
value: value,
|
|
126
|
+
id: id,
|
|
127
|
+
preferences: preferences,
|
|
128
|
+
iteration: rowIndex,
|
|
129
|
+
executeExpression: executeExpression,
|
|
130
|
+
getSuggesterStatus: getSuggesterStatus,
|
|
131
|
+
errors: errors
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
});
|
|
82
135
|
var _default = Row;
|
|
83
136
|
exports["default"] = _default;
|
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _orchestrator = _interopRequireDefault(require("./orchestrator"));
|
|
9
|
-
var _declarations = require("../declarations");
|
|
10
7
|
var _nothingToDisplay = _interopRequireDefault(require("../commons/components/nothing-to-display"));
|
|
8
|
+
var _declarations = require("../declarations");
|
|
9
|
+
var _orchestrator = _interopRequireDefault(require("./orchestrator"));
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
12
|
var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
@@ -26,7 +25,6 @@ var PairwiseLinks = function PairwiseLinks(_ref) {
|
|
|
26
25
|
id = _ref.id,
|
|
27
26
|
symLinks = _ref.symLinks;
|
|
28
27
|
var nbRows = xAxisIterations * yAxisIterations;
|
|
29
|
-
console.log('lunatic', 'pairwise', value);
|
|
30
28
|
if (nbRows <= 1) {
|
|
31
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_nothingToDisplay["default"], {});
|
|
32
30
|
}
|
|
@@ -49,6 +49,7 @@ function Row(_ref) {
|
|
|
49
49
|
var idComponent = "".concat(component.id, "-").concat(x + 1, "-").concat(y + 1, " ");
|
|
50
50
|
var value = undefined;
|
|
51
51
|
if ('response' in component) {
|
|
52
|
+
// @ts-ignore
|
|
52
53
|
var name = component.response.name;
|
|
53
54
|
var valueArray = valueMap[name];
|
|
54
55
|
if (Array.isArray(valueArray) && Array.isArray(valueArray[x])) {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = void 0;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
9
|
+
var _function = require("../../../utils/function");
|
|
9
10
|
var _commons = require("../../commons");
|
|
10
11
|
require("./default-style.scss");
|
|
11
|
-
var _function = require("../../../utils/function");
|
|
12
|
-
var _i18n = _interopRequireDefault(require("../../../i18n"));
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
function
|
|
16
|
-
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; }
|
|
14
|
+
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); }
|
|
17
15
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
18
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
19
17
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -36,6 +34,8 @@ function Suggester(_ref) {
|
|
|
36
34
|
optionRenderer = _ref$optionRenderer === void 0 ? _commons.DefaultOptionRenderer : _ref$optionRenderer,
|
|
37
35
|
value = _ref.value,
|
|
38
36
|
disabled = _ref.disabled,
|
|
37
|
+
response = _ref.response,
|
|
38
|
+
responses = _ref.responses,
|
|
39
39
|
id = _ref.id,
|
|
40
40
|
searching = _ref.searching,
|
|
41
41
|
label = _ref.label,
|
|
@@ -49,9 +49,11 @@ function Suggester(_ref) {
|
|
|
49
49
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
50
50
|
options = _useState4[0],
|
|
51
51
|
setOptions = _useState4[1];
|
|
52
|
-
var handleSelect = (0, _react.useCallback)(function (
|
|
53
|
-
onSelect(
|
|
52
|
+
var handleSelect = (0, _react.useCallback)(function (option) {
|
|
53
|
+
onSelect(option ? option : null);
|
|
54
54
|
}, [onSelect]);
|
|
55
|
+
|
|
56
|
+
/* UserInput */
|
|
55
57
|
var handleChange = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
56
58
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
|
|
57
59
|
var _yield$searching, results;
|
|
@@ -85,7 +87,7 @@ function Suggester(_ref) {
|
|
|
85
87
|
return _ref2.apply(this, arguments);
|
|
86
88
|
};
|
|
87
89
|
}(), [searching, onSelect]);
|
|
88
|
-
var defaultSearch = getSearch(search, value);
|
|
90
|
+
var defaultSearch = getSearch(responses, search, value);
|
|
89
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.ComboBox, {
|
|
90
92
|
id: id,
|
|
91
93
|
className: className,
|
|
@@ -104,11 +106,28 @@ function Suggester(_ref) {
|
|
|
104
106
|
errors: errors
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
|
-
function
|
|
108
|
-
if (
|
|
109
|
-
|
|
109
|
+
function getDisplayValue(responses, value) {
|
|
110
|
+
if (responses) {
|
|
111
|
+
var responseId = responses.find(function (r) {
|
|
112
|
+
return r.id === 'id';
|
|
113
|
+
}).response.name;
|
|
114
|
+
var responseLabel = responses.find(function (r) {
|
|
115
|
+
return r.id === 'label';
|
|
116
|
+
}).response.name;
|
|
117
|
+
return value[responseId] && value[responseId].length > 0 ? "".concat(value[responseId], " - ").concat(value[responseLabel]) : '';
|
|
110
118
|
}
|
|
111
119
|
return '';
|
|
112
120
|
}
|
|
121
|
+
function getSearch(responses, search, value) {
|
|
122
|
+
if (responses && _typeof(value) === 'object') {
|
|
123
|
+
var displayValue = getDisplayValue(responses, value);
|
|
124
|
+
return displayValue;
|
|
125
|
+
} else {
|
|
126
|
+
if (typeof value === 'string' && !search.length && value) {
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
return '';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
113
132
|
var _default = (0, _commons.createCustomizableLunaticField)(Suggester, 'Suggester');
|
|
114
133
|
exports["default"] = _default;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.IDBSuggester = IDBSuggester;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
9
8
|
var _suggester = _interopRequireDefault(require("../html/suggester"));
|
|
10
9
|
var _searching = _interopRequireDefault(require("../searching"));
|
|
11
10
|
var _checkStore = _interopRequireDefault(require("./check-store"));
|
|
12
11
|
var _suggesterStatus = require("./suggester-status");
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
17
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
15
|
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."); }
|
|
19
16
|
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); }
|
|
@@ -34,7 +31,9 @@ function IDBSuggester(_ref) {
|
|
|
34
31
|
label = _ref.label,
|
|
35
32
|
description = _ref.description,
|
|
36
33
|
getSuggesterStatus = _ref.getSuggesterStatus,
|
|
37
|
-
errors = _ref.errors
|
|
34
|
+
errors = _ref.errors,
|
|
35
|
+
responses = _ref.responses,
|
|
36
|
+
response = _ref.response;
|
|
38
37
|
var _useState = (0, _react.useState)(undefined),
|
|
39
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
39
|
store = _useState2[0],
|
|
@@ -58,14 +57,18 @@ function IDBSuggester(_ref) {
|
|
|
58
57
|
id: id,
|
|
59
58
|
className: className,
|
|
60
59
|
optionRenderer: optionRenderer,
|
|
61
|
-
labelRenderer: labelRenderer
|
|
60
|
+
labelRenderer: labelRenderer
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
,
|
|
62
63
|
onSelect: onSelect,
|
|
63
64
|
searching: searching,
|
|
64
65
|
disabled: disabled,
|
|
65
66
|
value: value,
|
|
66
67
|
label: label,
|
|
67
68
|
description: description,
|
|
68
|
-
errors: errors
|
|
69
|
+
errors: errors,
|
|
70
|
+
responses: responses,
|
|
71
|
+
response: response
|
|
69
72
|
})
|
|
70
73
|
})
|
|
71
74
|
});
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _commons = require("../commons");
|
|
8
9
|
var _lunaticComponentWithoutLabel = _interopRequireDefault(require("../commons/components/lunatic-component-without-label"));
|
|
9
|
-
var
|
|
10
|
+
var _idbSuggester = require("./idb-suggester");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
13
|
function LunaticSuggester(_ref) {
|
|
@@ -28,12 +29,34 @@ function LunaticSuggester(_ref) {
|
|
|
28
29
|
missingResponse = _ref.missingResponse,
|
|
29
30
|
management = _ref.management,
|
|
30
31
|
response = _ref.response,
|
|
32
|
+
responses = _ref.responses,
|
|
31
33
|
getSuggesterStatus = _ref.getSuggesterStatus;
|
|
32
|
-
|
|
34
|
+
// ToDo :
|
|
35
|
+
/**
|
|
36
|
+
* response -> responses
|
|
37
|
+
* onChange(id) -> onChange({ code: '', label: '', info: '' }) -> onSelect in subComponent
|
|
38
|
+
* useOnHandleChange -> update to handleChange on 3 response REPONSENAME (historical value i.e the code), REPONSENAME_LABEL, REPONSENAME_INFO
|
|
39
|
+
*/
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
var onChangeSimple = (0, _commons.useOnHandleChange)({
|
|
33
42
|
handleChange: handleChange,
|
|
34
43
|
response: response,
|
|
35
44
|
value: value
|
|
36
45
|
});
|
|
46
|
+
var onChange = (0, _react.useCallback)(function (option) {
|
|
47
|
+
if (responses) {
|
|
48
|
+
responses.forEach(function (r) {
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
if (value[r.id] != option[r.id]) {
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
handleChange(r.response, option[r.id]);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
onChangeSimple(option === null || option === void 0 ? void 0 : option.id);
|
|
58
|
+
}
|
|
59
|
+
}, [handleChange, onChangeSimple, responses, value]);
|
|
37
60
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponentWithoutLabel["default"], {
|
|
38
61
|
id: id,
|
|
39
62
|
preferences: preferences,
|
|
@@ -48,8 +71,12 @@ function LunaticSuggester(_ref) {
|
|
|
48
71
|
storeName: storeName,
|
|
49
72
|
optionRenderer: optionRenderer,
|
|
50
73
|
labelRenderer: labelRenderer,
|
|
51
|
-
idbVersion: idbVersion
|
|
74
|
+
idbVersion: idbVersion
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
,
|
|
52
77
|
onSelect: onChange,
|
|
78
|
+
responses: responses,
|
|
79
|
+
response: response,
|
|
53
80
|
disabled: disabled,
|
|
54
81
|
id: id,
|
|
55
82
|
value: value,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDidChange = useDidChange;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Hook for debug purpose that log the data that changed between 2 renders
|
|
10
|
+
*/
|
|
11
|
+
function useDidChange(obj, suffix) {
|
|
12
|
+
var ref = (0, _react.useRef)(obj);
|
|
13
|
+
for (var key in obj) {
|
|
14
|
+
if (obj[key] !== ref.current[key]) {
|
|
15
|
+
console.log("\"".concat(key, "\" has changed ").concat(suffix !== null && suffix !== void 0 ? suffix : ''), obj[key]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
ref.current = obj;
|
|
19
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { LunaticBaseProps } from '../../../type';
|
|
2
3
|
import './combo-box.scss';
|
|
3
4
|
import { ComboBoxOption } from './combo-box.type';
|
|
4
|
-
import { SelectionProps } from './selection/selection';
|
|
5
5
|
import { PanelProps } from './panel/panel';
|
|
6
|
-
import {
|
|
6
|
+
import { SelectionProps } from './selection/selection';
|
|
7
7
|
type Props = SelectionProps & PanelProps & {
|
|
8
8
|
className?: string;
|
|
9
9
|
classStyle?: string;
|
|
10
10
|
value: string | null;
|
|
11
11
|
messageError?: string;
|
|
12
|
-
getOptionValue?: (o: ComboBoxOption) => string;
|
|
12
|
+
getOptionValue?: (o: ComboBoxOption) => string | undefined;
|
|
13
13
|
label?: ReactNode;
|
|
14
14
|
description?: ReactNode;
|
|
15
15
|
errors?: LunaticBaseProps['errors'];
|
|
16
16
|
onChange?: (s: string | null) => void;
|
|
17
|
-
onSelect: (s:
|
|
17
|
+
onSelect: (s: ComboBoxOption | null | string) => void;
|
|
18
18
|
options: ComboBoxOption[];
|
|
19
19
|
};
|
|
20
20
|
declare const _default: import("react").ComponentType<Props>;
|
|
@@ -15,13 +15,13 @@ export declare const Default: Story<{
|
|
|
15
15
|
classStyle?: string | undefined;
|
|
16
16
|
value: string | null;
|
|
17
17
|
messageError?: string | undefined;
|
|
18
|
-
getOptionValue?: ((o: ComboBoxOption) => string) | undefined;
|
|
18
|
+
getOptionValue?: ((o: ComboBoxOption) => string | undefined) | undefined;
|
|
19
19
|
label?: import("react").ReactNode;
|
|
20
20
|
description?: import("react").ReactNode;
|
|
21
21
|
errors?: {
|
|
22
22
|
[id: string]: import("../../../..").LunaticError[];
|
|
23
23
|
} | undefined;
|
|
24
24
|
onChange?: ((s: string | null) => void) | undefined;
|
|
25
|
-
onSelect: (s: string | null) => void;
|
|
25
|
+
onSelect: (s: string | ComboBoxOption | null) => void;
|
|
26
26
|
options: ComboBoxOption[];
|
|
27
27
|
}>;
|
|
@@ -12,6 +12,6 @@ export type PanelProps = {
|
|
|
12
12
|
expanded?: boolean;
|
|
13
13
|
id?: string;
|
|
14
14
|
search?: string;
|
|
15
|
-
onSelect: (value: string) => void;
|
|
15
|
+
onSelect: (value: string | ComboBoxOption | null) => void;
|
|
16
16
|
};
|
|
17
17
|
export declare function Panel({ optionRenderer: OptionRender, options, focused, selectedIndex, expanded, id, search, onSelect, }: PanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -40,8 +40,8 @@ export declare const onInit: ({ ...payload }: ComboAction<ComboActionKind.ON_INI
|
|
|
40
40
|
readonly type: ComboActionKind.ON_INIT;
|
|
41
41
|
readonly payload: {
|
|
42
42
|
readonly options: ComboBoxOption[];
|
|
43
|
-
readonly value: string | null;
|
|
44
|
-
readonly getOptionValue: (o: ComboBoxOption) => string;
|
|
43
|
+
readonly value: string | ComboBoxOption | null;
|
|
44
|
+
readonly getOptionValue: (o: ComboBoxOption) => string | undefined;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
export type ComboAction<T extends ComboActionKind = ComboActionKind> = ({
|
|
@@ -70,8 +70,8 @@ export type ComboAction<T extends ComboActionKind = ComboActionKind> = ({
|
|
|
70
70
|
type: ComboActionKind.ON_INIT;
|
|
71
71
|
payload: {
|
|
72
72
|
options: ComboBoxOption[];
|
|
73
|
-
value: string | null;
|
|
74
|
-
getOptionValue: (o: ComboBoxOption) => string;
|
|
73
|
+
value: string | ComboBoxOption | null;
|
|
74
|
+
getOptionValue: (o: ComboBoxOption) => string | undefined;
|
|
75
75
|
};
|
|
76
76
|
}) & {
|
|
77
77
|
type: T;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LunaticBaseProps } from '../../type';
|
|
2
1
|
import { LunaticComponentDefinition } from '../../../use-lunatic/type';
|
|
2
|
+
import { LunaticBaseProps } from '../../type';
|
|
3
3
|
type Props = {
|
|
4
4
|
linksIterations?: [number, number];
|
|
5
5
|
component: LunaticComponentDefinition;
|
|
6
6
|
features?: string[];
|
|
7
|
-
} & Pick<LunaticBaseProps, 'id' | 'iteration' | 'executeExpression' | 'handleChange' | 'missing' | 'shortcut' | 'management' | 'preferences' | 'value' | 'errors'>;
|
|
8
|
-
declare function OrchestratedComponent({ id, component, handleChange, features, missing, shortcut, management, preferences, value, iteration, linksIterations, executeExpression, errors, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
} & Pick<LunaticBaseProps, 'id' | 'iteration' | 'executeExpression' | 'handleChange' | 'missing' | 'shortcut' | 'management' | 'getSuggesterStatus' | 'preferences' | 'value' | 'errors'>;
|
|
8
|
+
declare function OrchestratedComponent({ id, component, handleChange, features, missing, shortcut, management, preferences, value, iteration, linksIterations, executeExpression, getSuggesterStatus, errors, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
export default OrchestratedComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import { LunaticComponentProps } from '../type';
|
|
3
2
|
import { LunaticComponentDefinition, LunaticState } from '../../use-lunatic/type';
|
|
3
|
+
import { LunaticComponentProps } from '../type';
|
|
4
4
|
type OriginalProps = {
|
|
5
5
|
key: number;
|
|
6
6
|
rowIndex: number;
|
|
@@ -13,6 +13,7 @@ type OriginalProps = {
|
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
}) => void;
|
|
15
15
|
executeExpression: LunaticState['executeExpression'];
|
|
16
|
+
getSuggesterStatus?: LunaticState['getSuggesterStatus'];
|
|
16
17
|
iteration?: number;
|
|
17
18
|
linksIterations?: [number, number];
|
|
18
19
|
features?: string[];
|
|
@@ -26,6 +27,6 @@ type OrchestratedProps = {
|
|
|
26
27
|
index: number;
|
|
27
28
|
[key: string]: unknown;
|
|
28
29
|
}) => void;
|
|
29
|
-
} & Pick<OriginalProps, 'id' | 'components' | 'valueMap' | 'features' | 'missing' | 'shortcut' | 'preferences' | 'executeExpression' | 'iteration' | 'errors'>;
|
|
30
|
-
declare function createRowOrchestrator(Row: FunctionComponent<OriginalProps>): ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, iteration, xAxisIterations, errors, }: OrchestratedProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
30
|
+
} & Pick<OriginalProps, 'id' | 'components' | 'valueMap' | 'features' | 'missing' | 'shortcut' | 'preferences' | 'executeExpression' | 'iteration' | 'errors' | 'getSuggesterStatus'>;
|
|
31
|
+
declare function createRowOrchestrator(Row: FunctionComponent<OriginalProps>): ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, getSuggesterStatus, iteration, xAxisIterations, errors, }: OrchestratedProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
31
32
|
export default createRowOrchestrator;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './dropdown.scss';
|
|
3
3
|
import { LunaticComponentProps } from '../../type';
|
|
4
|
+
import { ComboBoxOption } from '../../commons/components/combo-box/combo-box.type';
|
|
4
5
|
export type DropdownProps = {
|
|
5
|
-
onSelect: (
|
|
6
|
+
onSelect: (value: string | ComboBoxOption | null) => void;
|
|
6
7
|
className?: string;
|
|
7
8
|
} & Pick<LunaticComponentProps<'Dropdown'>, 'id' | 'disabled' | 'options' | 'writable' | 'value' | 'description' | 'label' | 'errors'>;
|
|
8
9
|
declare const _default: React.ComponentType<DropdownProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, iteration, xAxisIterations, errors, }: {
|
|
2
|
+
declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, getSuggesterStatus, iteration, xAxisIterations, errors, }: {
|
|
3
3
|
nbRows: number;
|
|
4
4
|
xAxisIterations?: number | undefined;
|
|
5
5
|
handleChange: (response: {
|
|
@@ -25,6 +25,10 @@ declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, han
|
|
|
25
25
|
logging?: import("../../../use-lunatic/commons/execute-expression/create-execute-expression").ExpressionLogger | undefined;
|
|
26
26
|
bindingDependencies?: string[] | undefined;
|
|
27
27
|
} | undefined) => T;
|
|
28
|
+
getSuggesterStatus?: ((name: string | undefined) => {
|
|
29
|
+
status: import("../../../use-lunatic/use-suggesters").SuggesterStatus;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
}) | undefined;
|
|
28
32
|
iteration?: number | undefined;
|
|
29
33
|
linksIterations?: [number, number] | undefined;
|
|
30
34
|
features?: string[] | undefined;
|
|
@@ -41,10 +45,14 @@ declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, han
|
|
|
41
45
|
logging?: import("../../../use-lunatic/commons/execute-expression/create-execute-expression").ExpressionLogger | undefined;
|
|
42
46
|
bindingDependencies?: string[] | undefined;
|
|
43
47
|
} | undefined) => T;
|
|
48
|
+
getSuggesterStatus: (name: string) => {
|
|
49
|
+
status: import("../../../use-lunatic/use-suggesters").SuggesterStatus;
|
|
50
|
+
timestamp: number;
|
|
51
|
+
};
|
|
44
52
|
value: Record<string, unknown[]>;
|
|
45
|
-
|
|
53
|
+
header?: {
|
|
46
54
|
label: import("react").ReactNode;
|
|
47
55
|
}[] | undefined;
|
|
48
56
|
paginatedLoop?: boolean | undefined;
|
|
49
|
-
}, "id" | "preferences" | "missing" | "errors" | "shortcut">, "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "missing" | "errors" | "shortcut" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
57
|
+
}, "id" | "preferences" | "missing" | "errors" | "shortcut">, "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "missing" | "errors" | "shortcut" | "getSuggesterStatus" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
50
58
|
export default BlockForLoopOrchestrator;
|
|
@@ -12,8 +12,12 @@ declare const _default: React.ComponentType<import("../../type").LunaticBaseProp
|
|
|
12
12
|
logging?: import("../../../use-lunatic/commons/execute-expression/create-execute-expression").ExpressionLogger | undefined;
|
|
13
13
|
bindingDependencies?: string[] | undefined;
|
|
14
14
|
} | undefined) => T;
|
|
15
|
+
getSuggesterStatus: (name: string) => {
|
|
16
|
+
status: import("../../../use-lunatic/use-suggesters").SuggesterStatus;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
};
|
|
15
19
|
value: Record<string, unknown[]>;
|
|
16
|
-
|
|
20
|
+
header?: {
|
|
17
21
|
label: React.ReactNode;
|
|
18
22
|
}[] | undefined;
|
|
19
23
|
paginatedLoop?: boolean | undefined;
|