@inseefr/lunatic 2.4.9 → 2.5.0-beta
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/orchestrated-component.js +10 -30
- package/lib/components/commons/create-row-orchestrator.js +7 -2
- package/lib/components/component-set/html/component-set-components.js +16 -25
- package/lib/components/component-set/lunatic-component-set.js +23 -37
- package/lib/components/index.js +14 -0
- package/lib/components/loop/block-for-loop/block-for-loop.js +4 -2
- package/lib/components/loop/block-for-loop/row.js +4 -2
- package/lib/components/loop/loop.js +6 -3
- package/lib/components/loop/roster-for-loop/body.js +4 -2
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +2 -0
- package/lib/components/loop/roster-for-loop/roster-table.js +4 -2
- package/lib/components/loop/roster-for-loop/row.js +3 -1
- package/lib/components/question-explication/html/question-explication.js +53 -0
- package/lib/components/question-explication/html/question-explication.scss +35 -0
- package/lib/components/question-explication/index.js +13 -0
- package/lib/components/question-explication/lunatic-question-explication.js +32 -0
- package/lib/components/question-explication/question-explication.spec.js +49 -0
- package/lib/components/roundabout/lunatic-roundabout.js +2 -4
- package/lib/components/subsequence/subsequence.js +0 -2
- package/lib/components/subsequence/subsequence.spec.js +2 -2
- package/lib/components/summary/html/summary-container.js +14 -0
- package/lib/components/summary/html/summary-responses.js +53 -0
- package/lib/components/summary/html/summary-title.js +20 -0
- package/lib/components/summary/index.js +12 -0
- package/lib/components/summary/lunatic-summary.js +99 -0
- package/lib/src/components/commons/components/orchestrated-component.d.ts +4 -5
- package/lib/src/components/commons/create-row-orchestrator.d.ts +3 -2
- package/lib/src/components/component-set/html/component-set-components.d.ts +2 -2
- package/lib/src/components/component-set/lunatic-component-set.d.ts +2 -1
- package/lib/src/components/index.d.ts +2 -0
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +3 -2
- package/lib/src/components/loop/block-for-loop/row.d.ts +2 -1
- package/lib/src/components/loop/roster-for-loop/body.d.ts +2 -2
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +3 -2
- package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +2 -2
- package/lib/src/components/loop/roster-for-loop/row.d.ts +2 -1
- package/lib/src/components/question-explication/html/question-explication.d.ts +7 -0
- package/lib/src/components/question-explication/index.d.ts +1 -0
- package/lib/src/components/question-explication/lunatic-question-explication.d.ts +3 -0
- package/lib/src/components/question-explication/question-explication.spec.d.ts +1 -0
- package/lib/src/components/subsequence/subsequence.d.ts +2 -2
- package/lib/src/components/summary/html/summary-container.d.ts +2 -0
- package/lib/src/components/summary/html/summary-responses.d.ts +12 -0
- package/lib/src/components/summary/html/summary-title.d.ts +5 -0
- package/lib/src/components/summary/index.d.ts +1 -0
- package/lib/src/components/summary/lunatic-summary.d.ts +7 -0
- package/lib/src/components/type.d.ts +18 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/use-lunatic/actions.d.ts +6 -169
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +137 -112
- package/lib/src/use-lunatic/commons/fill-components/fill-missing-response.d.ts +2 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +115 -94
- package/lib/src/use-lunatic/commons/page-navigation.d.ts +7 -0
- package/lib/src/use-lunatic/commons/page-navigation.spec.d.ts +1 -0
- package/lib/src/use-lunatic/commons/page.d.ts +11 -0
- package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/commons/auto-explore-loop.d.ts +5 -0
- package/lib/src/use-lunatic/reducer/commons/index.d.ts +0 -1
- 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 -7
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -3
- package/lib/src/use-lunatic/type-source.d.ts +27 -13
- package/lib/src/use-lunatic/type.d.ts +4 -12
- package/lib/src/use-lunatic/use-lunatic.d.ts +474 -10
- package/lib/src/utils/store-tools/worker-path.d.ts +1 -0
- package/lib/stories/component-set/component-set.stories.js +2 -1
- package/lib/stories/loop/block-for-loop.stories.js +8 -1
- package/lib/stories/loop/roster-for-loop.stories.js +8 -1
- package/lib/{use-lunatic/reducer/reduce-roundabout.js → stories/question-explication/question-explication.stories.js} +21 -17
- package/lib/stories/question-explication/source.json +17 -0
- package/lib/stories/roundabout/roundabout.stories.js +2 -1
- package/lib/stories/suggester/source-component-set.json +67 -0
- package/lib/stories/suggester/suggester.stories.js +9 -1
- package/lib/stories/summary/data.json +32 -0
- package/lib/stories/summary/source.json +353 -0
- package/lib/stories/summary/summary.stories.js +37 -0
- package/lib/stories/utils/orchestrator.js +5 -3
- package/lib/use-lunatic/commons/check-pager.js +1 -2
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +14 -12
- package/lib/use-lunatic/commons/page-navigation.js +109 -0
- package/lib/use-lunatic/commons/page-navigation.spec.js +129 -0
- package/lib/use-lunatic/commons/page.js +44 -0
- package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +39 -0
- package/lib/use-lunatic/reducer/commons/index.js +0 -8
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +25 -159
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +21 -127
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +53 -55
- package/lib/use-lunatic/reducer/reduce-on-init.js +5 -8
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.js +1 -1
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +1 -1
- package/lib/use-lunatic/type-source.js +0 -2
- package/lib/use-lunatic/use-lunatic.js +17 -3
- package/lib/utils/store-tools/auto-load.js +2 -2
- package/lib/utils/store-tools/worker-path.js +13 -0
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -2
- package/package.json +3 -3
- package/lib/components/button/__snapshots__/lunatic-button.spec.jsx.snap +0 -80
- package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.jsx.snap +0 -81
- package/lib/src/use-lunatic/reducer/commons/is-empty-on-empty-page.d.ts +0 -3
- package/lib/src/use-lunatic/reducer/reduce-roundabout.d.ts +0 -2
- package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +0 -32
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _lunaticQuestionExplication = _interopRequireDefault(require("./lunatic-question-explication"));
|
|
5
|
+
var _vitest = require("vitest");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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); } }
|
|
11
|
+
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); }); }; }
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
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); }
|
|
17
|
+
(0, _vitest.describe)('QuestionExplication', function () {
|
|
18
|
+
var mockProps = {
|
|
19
|
+
id: 'test-accordion',
|
|
20
|
+
label: 'Test Accordion Label',
|
|
21
|
+
content: 'Test Accordion Content'
|
|
22
|
+
};
|
|
23
|
+
(0, _vitest.it)('render accordion and check that label is on DOM and content node is hidden', function () {
|
|
24
|
+
var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticQuestionExplication["default"], _objectSpread({}, mockProps))),
|
|
25
|
+
getByText = _render.getByText,
|
|
26
|
+
container = _render.container;
|
|
27
|
+
var accordionLabel = getByText(mockProps.label);
|
|
28
|
+
(0, _vitest.expect)(accordionLabel).toBeInTheDocument();
|
|
29
|
+
(0, _vitest.expect)(container.getElementsByClassName('accordion-content').length).toBe(0);
|
|
30
|
+
});
|
|
31
|
+
(0, _vitest.it)('expands content on label click', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
32
|
+
var _render2, getByText, container, accordionLabel;
|
|
33
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
_render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticQuestionExplication["default"], _objectSpread({}, mockProps))), getByText = _render2.getByText, container = _render2.container;
|
|
37
|
+
accordionLabel = getByText(mockProps.label);
|
|
38
|
+
_react.fireEvent.click(accordionLabel);
|
|
39
|
+
_context.next = 5;
|
|
40
|
+
return (0, _react.waitFor)(function () {
|
|
41
|
+
return (0, _vitest.expect)(container.getElementsByClassName('accordion-content').length).toBe(1);
|
|
42
|
+
});
|
|
43
|
+
case 5:
|
|
44
|
+
case "end":
|
|
45
|
+
return _context.stop();
|
|
46
|
+
}
|
|
47
|
+
}, _callee);
|
|
48
|
+
})));
|
|
49
|
+
});
|
|
@@ -25,11 +25,9 @@ function LunaticRoundabout(_ref) {
|
|
|
25
25
|
var goToIteration = (0, _react.useCallback)(function (iteration) {
|
|
26
26
|
goToPage({
|
|
27
27
|
page: page,
|
|
28
|
+
subPage: 0,
|
|
28
29
|
iteration: iteration,
|
|
29
|
-
nbIterations: iterations
|
|
30
|
-
roundabout: {
|
|
31
|
-
page: page
|
|
32
|
-
}
|
|
30
|
+
nbIterations: iterations
|
|
33
31
|
});
|
|
34
32
|
}, [goToPage, page, iterations]);
|
|
35
33
|
if (iterations === 1) {
|
|
@@ -4,11 +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
7
|
var _declarations = require("../declarations");
|
|
9
8
|
var _commons = require("../commons");
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
10
|
function Subsequence(_ref) {
|
|
13
11
|
var id = _ref.id,
|
|
14
12
|
declarations = _ref.declarations,
|
|
@@ -37,7 +37,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
(0, _vitest.it)('renders the label and declarations in the correct order', function () {
|
|
40
|
-
var _subSequenceLabel$pre, _subSequenceLabel$nex, _subSequenceLabel$nex2
|
|
40
|
+
var _subSequenceLabel$pre, _subSequenceLabel$nex, _subSequenceLabel$nex2;
|
|
41
41
|
var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_subsequence["default"], _objectSpread({}, mockProps))),
|
|
42
42
|
getByText = _render.getByText,
|
|
43
43
|
queryByText = _render.queryByText;
|
|
@@ -56,7 +56,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
56
56
|
|
|
57
57
|
// Detachable declarations should appear after the label and after declarations after text
|
|
58
58
|
(0, _vitest.expect)(declaration3).toBeInTheDocument();
|
|
59
|
-
(0, _vitest.expect)((_subSequenceLabel$nex2 = subSequenceLabel.nextSibling) === null || _subSequenceLabel$nex2 === void 0
|
|
59
|
+
(0, _vitest.expect)((_subSequenceLabel$nex2 = subSequenceLabel.nextSibling) === null || _subSequenceLabel$nex2 === void 0 || (_subSequenceLabel$nex2 = _subSequenceLabel$nex2.nextSibling) === null || _subSequenceLabel$nex2 === void 0 ? void 0 : _subSequenceLabel$nex2.childNodes[0]).toBe(declaration3);
|
|
60
60
|
|
|
61
61
|
// Ensure no other declarations are rendered
|
|
62
62
|
(0, _vitest.expect)(queryByText('Declaration 4')).toBeNull();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SummaryContainer = SummaryContainer;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
function SummaryContainer(_ref) {
|
|
9
|
+
var children = _ref.children;
|
|
10
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
11
|
+
className: "lunatic-summary-container",
|
|
12
|
+
children: children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _commons = require("../../commons");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function ListResponses(_ref) {
|
|
10
|
+
var title = _ref.title,
|
|
11
|
+
children = _ref.children;
|
|
12
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
13
|
+
className: "lunatic-summary-responses-iteration",
|
|
14
|
+
children: [title, /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
15
|
+
children: children
|
|
16
|
+
})]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function Responses(_ref2) {
|
|
20
|
+
var values = _ref2.values;
|
|
21
|
+
if (!values) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
25
|
+
children: values.map(function (_ref3, index) {
|
|
26
|
+
var label = _ref3.label,
|
|
27
|
+
value = _ref3.value;
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
29
|
+
children: [label, " : ", value]
|
|
30
|
+
}, index);
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function SummaryResponses(_ref4) {
|
|
35
|
+
var sections = _ref4.sections;
|
|
36
|
+
var visibleSections = sections.filter(function (s) {
|
|
37
|
+
return s;
|
|
38
|
+
});
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
40
|
+
children: visibleSections.map(function (section, index) {
|
|
41
|
+
var title = section.title,
|
|
42
|
+
values = section.values;
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ListResponses, {
|
|
44
|
+
title: title,
|
|
45
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Responses, {
|
|
46
|
+
values: values
|
|
47
|
+
})
|
|
48
|
+
}, index);
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
var _default = (0, _commons.createCustomizableLunaticField)(SummaryResponses, 'SummaryResponses');
|
|
53
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _commons = require("../../commons");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function SummaryTitle(props) {
|
|
10
|
+
var label = props.label;
|
|
11
|
+
if (label) {
|
|
12
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
13
|
+
className: "lunatic-summary-label",
|
|
14
|
+
children: label
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
var _default = (0, _commons.createCustomizableLunaticField)(SummaryTitle, 'SummaryTitle');
|
|
20
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Summary", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _lunaticSummary.LunaticSummary;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _lunaticSummary = require("./lunatic-summary");
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LunaticSummary = LunaticSummary;
|
|
7
|
+
var _summaryTitle = _interopRequireDefault(require("./html/summary-title"));
|
|
8
|
+
var _summaryContainer = require("./html/summary-container");
|
|
9
|
+
var _summaryResponses = _interopRequireDefault(require("./html/summary-responses"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
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); }
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
+
function compileResponses(responses, executeExpression, iteration) {
|
|
19
|
+
if (!responses) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
var option = iteration || iteration === 0 ? iteration : undefined;
|
|
23
|
+
return responses.map(function (r) {
|
|
24
|
+
return {
|
|
25
|
+
label: executeExpression(r.label, {
|
|
26
|
+
iteration: option
|
|
27
|
+
}),
|
|
28
|
+
value: executeExpression(r.value, {
|
|
29
|
+
iteration: option
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function CompiledTitle(_ref) {
|
|
35
|
+
var executeExpression = _ref.executeExpression,
|
|
36
|
+
iteration = _ref.iteration,
|
|
37
|
+
title = _ref.title;
|
|
38
|
+
if (!title && iteration) {
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
40
|
+
children: "Valeur pour ".concat(iteration + 1)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (!title) {
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
45
|
+
children: "Valeurs renseign\xE9s :"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var hasIteration = iteration || iteration === 0;
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
50
|
+
children: executeExpression(title, hasIteration ? {
|
|
51
|
+
iteration: iteration
|
|
52
|
+
} : {})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function LunaticSummary(props) {
|
|
56
|
+
var executeExpression = props.executeExpression,
|
|
57
|
+
label = props.label,
|
|
58
|
+
sections = props.sections;
|
|
59
|
+
var compiledSections = sections.reduce(function (acc, section) {
|
|
60
|
+
var iterations = section.iterations,
|
|
61
|
+
title = section.title,
|
|
62
|
+
responses = section.responses;
|
|
63
|
+
if (iterations) {
|
|
64
|
+
var compiledIterations = executeExpression(iterations);
|
|
65
|
+
if (responses) {
|
|
66
|
+
var elements = Array(compiledIterations).fill(null).map(function (_, iteration) {
|
|
67
|
+
return {
|
|
68
|
+
values: compileResponses(responses, executeExpression, iteration),
|
|
69
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsx)(CompiledTitle, {
|
|
70
|
+
executeExpression: executeExpression,
|
|
71
|
+
iteration: iteration,
|
|
72
|
+
title: title
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
return [].concat(_toConsumableArray(acc), _toConsumableArray(elements));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (responses) {
|
|
80
|
+
var element = {
|
|
81
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsx)(CompiledTitle, {
|
|
82
|
+
executeExpression: executeExpression,
|
|
83
|
+
iteration: undefined,
|
|
84
|
+
title: title
|
|
85
|
+
}),
|
|
86
|
+
values: compileResponses(responses, executeExpression, undefined)
|
|
87
|
+
};
|
|
88
|
+
return [].concat(_toConsumableArray(acc), [element]);
|
|
89
|
+
}
|
|
90
|
+
return acc;
|
|
91
|
+
}, []);
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_summaryContainer.SummaryContainer, {
|
|
93
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_summaryTitle["default"], {
|
|
94
|
+
label: label
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_summaryResponses["default"], {
|
|
96
|
+
sections: compiledSections
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { LunaticBaseProps } from '../../type';
|
|
2
2
|
import { LunaticComponentDefinition } from '../../../use-lunatic/type';
|
|
3
|
-
type Props = {
|
|
4
|
-
linksIterations?: [number, number];
|
|
3
|
+
type Props<T extends Record<string, unknown>> = {
|
|
5
4
|
component: LunaticComponentDefinition;
|
|
6
|
-
|
|
7
|
-
} & Pick<LunaticBaseProps, '
|
|
8
|
-
declare function OrchestratedComponent
|
|
5
|
+
linksIterations?: number[];
|
|
6
|
+
} & Pick<LunaticBaseProps, 'iteration' | 'executeExpression'> & T;
|
|
7
|
+
declare function OrchestratedComponent<T extends Record<string, unknown>>({ component, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
9
8
|
export default OrchestratedComponent;
|
|
@@ -16,10 +16,11 @@ type OriginalProps = {
|
|
|
16
16
|
iteration?: number;
|
|
17
17
|
linksIterations?: [number, number];
|
|
18
18
|
features?: string[];
|
|
19
|
-
} & Pick<LunaticComponentProps<'Loop'>, 'errors' | 'preferences' | 'missing' | 'shortcut' | 'id'>;
|
|
19
|
+
} & Pick<LunaticComponentProps<'Loop'>, 'errors' | 'preferences' | 'missing' | 'shortcut' | 'id' | 'disabled'>;
|
|
20
20
|
type OrchestratedProps = {
|
|
21
21
|
nbRows: number;
|
|
22
22
|
xAxisIterations?: number;
|
|
23
|
+
disabled?: boolean;
|
|
23
24
|
handleChange: (response: {
|
|
24
25
|
name: string;
|
|
25
26
|
}, value: unknown, args: {
|
|
@@ -27,5 +28,5 @@ type OrchestratedProps = {
|
|
|
27
28
|
[key: string]: unknown;
|
|
28
29
|
}) => void;
|
|
29
30
|
} & 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;
|
|
31
|
+
declare function createRowOrchestrator(Row: FunctionComponent<OriginalProps>): ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, iteration, xAxisIterations, errors, disabled, }: OrchestratedProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
31
32
|
export default createRowOrchestrator;
|
|
@@ -2,6 +2,6 @@ import { LunaticComponentProps } from '../../type';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
className?: string;
|
|
4
4
|
componentClassName?: string;
|
|
5
|
-
} &
|
|
6
|
-
declare function ComponentSetComponents({ components,
|
|
5
|
+
} & Omit<LunaticComponentProps<'ComponentSet'>, 'id' | 'response'>;
|
|
6
|
+
declare function ComponentSetComponents({ components, componentClassName, className, value, ...props }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
7
|
export default ComponentSetComponents;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { LunaticComponentProps } from '../type';
|
|
2
|
-
declare function LunaticComponentSet(
|
|
2
|
+
declare function LunaticComponentSet({ id, label, declarations, description, response, // Do not propagate the response (it's undefined)
|
|
3
|
+
...props }: LunaticComponentProps<'ComponentSet'>): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export default LunaticComponentSet;
|
|
@@ -22,5 +22,7 @@ export { default as SuggesterLoaderWidget } from './suggester-loader-widget';
|
|
|
22
22
|
export { default as Roundabout } from './roundabout';
|
|
23
23
|
export { default as Table } from './table';
|
|
24
24
|
export { default as ComponentSet } from './component-set';
|
|
25
|
+
export { Summary } from './summary';
|
|
25
26
|
export { default as QuestionInformation } from './questions/question-information';
|
|
26
27
|
export { default as QuestionContext } from './questions/question-context';
|
|
28
|
+
export { default as QuestionExplication } from './question-explication';
|
|
@@ -1,7 +1,8 @@
|
|
|
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, iteration, xAxisIterations, errors, disabled, }: {
|
|
3
3
|
nbRows: number;
|
|
4
4
|
xAxisIterations?: number | undefined;
|
|
5
|
+
disabled?: boolean | undefined;
|
|
5
6
|
handleChange: (response: {
|
|
6
7
|
name: string;
|
|
7
8
|
}, value: unknown, args: {
|
|
@@ -46,5 +47,5 @@ declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, han
|
|
|
46
47
|
label: import("react").ReactNode;
|
|
47
48
|
}[] | undefined;
|
|
48
49
|
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;
|
|
50
|
+
}, "id" | "preferences" | "missing" | "errors" | "shortcut" | "disabled">, "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "missing" | "errors" | "shortcut" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
50
51
|
export default BlockForLoopOrchestrator;
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
valueMap?: Record<string, unknown>;
|
|
5
5
|
features?: string[];
|
|
6
6
|
rowIndex: number;
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
handleChange: (response: {
|
|
8
9
|
name: string;
|
|
9
10
|
}, value: unknown, args: {
|
|
@@ -18,5 +19,5 @@ type Props = {
|
|
|
18
19
|
preferences?: LunaticBaseProps['preferences'];
|
|
19
20
|
shortcut?: LunaticBaseProps['shortcut'];
|
|
20
21
|
};
|
|
21
|
-
declare function Row({ components, valueMap, handleChange, features, missing, shortcut, management, preferences, rowIndex, executeExpression, errors, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function Row({ components, valueMap, handleChange, features, missing, shortcut, management, preferences, rowIndex, executeExpression, errors, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export default Row;
|
|
@@ -7,6 +7,6 @@ type Props = {
|
|
|
7
7
|
index: number;
|
|
8
8
|
[k: string]: unknown;
|
|
9
9
|
}) => void;
|
|
10
|
-
} & Pick<LunaticComponentProps<'RosterForLoop'>, 'id' | 'components' | 'executeExpression' | 'headers' | 'value' | 'management' | 'missing' | 'shortcut' | 'errors'>;
|
|
11
|
-
declare function Body({ id, components, nbRows, executeExpression, handleChange, value: valueMap, missing, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
} & Pick<LunaticComponentProps<'RosterForLoop'>, 'id' | 'components' | 'executeExpression' | 'headers' | 'value' | 'management' | 'missing' | 'shortcut' | 'errors' | 'disabled'>;
|
|
11
|
+
declare function Body({ id, components, nbRows, executeExpression, handleChange, value: valueMap, missing, disabled, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
12
12
|
export default Body;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const RosterForLoopOrchestrator: ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, iteration, xAxisIterations, errors, }: {
|
|
2
|
+
declare const RosterForLoopOrchestrator: ({ id, components, nbRows, valueMap, handleChange, features, missing, shortcut, preferences, executeExpression, iteration, xAxisIterations, errors, disabled, }: {
|
|
3
3
|
nbRows: number;
|
|
4
4
|
xAxisIterations?: number | undefined;
|
|
5
|
+
disabled?: boolean | undefined;
|
|
5
6
|
handleChange: (response: {
|
|
6
7
|
name: string;
|
|
7
8
|
}, value: unknown, args: {
|
|
@@ -46,5 +47,5 @@ declare const RosterForLoopOrchestrator: ({ id, components, nbRows, valueMap, ha
|
|
|
46
47
|
label: import("react").ReactNode;
|
|
47
48
|
}[] | undefined;
|
|
48
49
|
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;
|
|
50
|
+
}, "id" | "preferences" | "missing" | "errors" | "shortcut" | "disabled">, "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "missing" | "errors" | "shortcut" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
50
51
|
export default RosterForLoopOrchestrator;
|
|
@@ -8,6 +8,6 @@ type Props = {
|
|
|
8
8
|
index: number;
|
|
9
9
|
[k: string]: unknown;
|
|
10
10
|
}) => void;
|
|
11
|
-
} & Pick<LunaticComponentProps<'RosterForLoop'>, 'id' | 'components' | 'executeExpression' | 'headers' | 'value' | 'management' | 'missing' | 'shortcut' | 'errors'>;
|
|
12
|
-
declare function RosterTable({ components, nbRows, executeExpression, id, headers, value: valueMap, shortcut, missing, management, handleChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
} & Pick<LunaticComponentProps<'RosterForLoop'>, 'id' | 'components' | 'executeExpression' | 'headers' | 'value' | 'management' | 'missing' | 'shortcut' | 'errors' | 'disabled'>;
|
|
12
|
+
declare function RosterTable({ components, nbRows, executeExpression, id, headers, value: valueMap, shortcut, missing, management, handleChange, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default RosterTable;
|
|
@@ -5,6 +5,7 @@ type Props = {
|
|
|
5
5
|
valueMap?: Record<string, unknown>;
|
|
6
6
|
features?: string[];
|
|
7
7
|
rowIndex: number;
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
handleChange: (response: {
|
|
9
10
|
name: string;
|
|
10
11
|
}, value: unknown, args: {
|
|
@@ -19,5 +20,5 @@ type Props = {
|
|
|
19
20
|
preferences?: LunaticBaseProps['preferences'];
|
|
20
21
|
shortcut?: LunaticBaseProps['shortcut'];
|
|
21
22
|
};
|
|
22
|
-
declare function Row({ id, components, valueMap, rowIndex, handleChange, features, missing, shortcut, management, preferences, executeExpression, errors, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function Row({ id, components, valueMap, rowIndex, handleChange, features, missing, shortcut, management, preferences, executeExpression, errors, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export default Row;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './question-explication.scss';
|
|
3
|
+
import { LunaticBaseProps } from '../../type';
|
|
4
|
+
declare const _default: import("react").ComponentType<Pick<LunaticBaseProps<string>, "label" | "id" | "description"> & {
|
|
5
|
+
bgColor?: string | undefined;
|
|
6
|
+
}>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-question-explication';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default:
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "id" | "declarations">>;
|
|
3
3
|
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type ResponsesValue = Array<{
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
value: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
declare const _default: import("react").ComponentType<{
|
|
7
|
+
sections: {
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
values?: ResponsesValue | undefined;
|
|
10
|
+
}[];
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LunaticSummary as Summary } from './lunatic-summary';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LunaticComponentProps } from '../type';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type SummaryResponsesEntry = {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function LunaticSummary(props: LunaticComponentProps<'Summary'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,10 @@ import { LunaticComponentDefinition, LunaticError, LunaticExpression, LunaticSta
|
|
|
2
2
|
import { CSSProperties, FunctionComponent, ReactNode } from 'react';
|
|
3
3
|
import { SuggesterStatus } from '../use-lunatic/use-suggesters';
|
|
4
4
|
import useLunatic from '../use-lunatic';
|
|
5
|
+
export type VtlExpression = {
|
|
6
|
+
value: string;
|
|
7
|
+
type: 'VTL' | 'VTL|MD';
|
|
8
|
+
};
|
|
5
9
|
export type LunaticBaseProps<ValueType = unknown> = {
|
|
6
10
|
id: string;
|
|
7
11
|
handleChange: (response: {
|
|
@@ -73,6 +77,7 @@ type ComponentPropsByType = {
|
|
|
73
77
|
ComponentSet: LunaticBaseProps<unknown> & {
|
|
74
78
|
components: LunaticComponentDefinition[];
|
|
75
79
|
value: Record<string, unknown>;
|
|
80
|
+
response: undefined;
|
|
76
81
|
};
|
|
77
82
|
RosterForLoop: LunaticBaseProps<unknown> & {
|
|
78
83
|
lines: {
|
|
@@ -208,6 +213,9 @@ type ComponentPropsByType = {
|
|
|
208
213
|
};
|
|
209
214
|
};
|
|
210
215
|
FilterDescription: Pick<LunaticBaseProps<string>, 'id' | 'label'>;
|
|
216
|
+
QuestionExplication: Pick<LunaticBaseProps<string>, 'id' | 'label' | 'description'> & {
|
|
217
|
+
bgColor?: string;
|
|
218
|
+
};
|
|
211
219
|
PairwiseLinks: Omit<LunaticBaseProps, 'value'> & {
|
|
212
220
|
components: LunaticComponentDefinition[];
|
|
213
221
|
features?: LunaticState['features'];
|
|
@@ -239,6 +247,16 @@ type ComponentPropsByType = {
|
|
|
239
247
|
name: string;
|
|
240
248
|
};
|
|
241
249
|
};
|
|
250
|
+
Summary: LunaticBaseProps<string | null> & {
|
|
251
|
+
sections: Array<{
|
|
252
|
+
responses?: Array<{
|
|
253
|
+
label: VtlExpression;
|
|
254
|
+
value: VtlExpression;
|
|
255
|
+
}>;
|
|
256
|
+
title?: VtlExpression;
|
|
257
|
+
iterations?: number;
|
|
258
|
+
}>;
|
|
259
|
+
};
|
|
242
260
|
};
|
|
243
261
|
export type LunaticComponentType = keyof ComponentPropsByType;
|
|
244
262
|
export type LunaticComponentProps<T extends LunaticComponentType = LunaticComponentType> = ComponentPropsByType[T];
|
package/lib/src/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export * from './components';
|
|
|
2
2
|
export { default as useLunatic } from './use-lunatic';
|
|
3
3
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, } from './use-lunatic/type';
|
|
4
4
|
export type { LunaticComponentProps } from './components/type';
|
|
5
|
+
export type { LunaticSource } from './use-lunatic/type-source';
|