@inseefr/lunatic 3.4.11-rc.0 → 3.5.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Loop/Loop.js +7 -27
- package/components/Loop/Loop.js.map +1 -1
- package/components/RosterForLoop/RosterForLoop.js +8 -37
- package/components/RosterForLoop/RosterForLoop.js.map +1 -1
- package/components/Sequence/Sequence.d.ts +1 -1
- package/components/Subsequence/Subsequence.d.ts +1 -1
- package/components/library.d.ts +2 -2
- package/esm/components/Loop/Loop.js +7 -27
- package/esm/components/Loop/Loop.js.map +1 -1
- package/esm/components/RosterForLoop/RosterForLoop.js +8 -34
- package/esm/components/RosterForLoop/RosterForLoop.js.map +1 -1
- package/esm/components/Sequence/Sequence.d.ts +1 -1
- package/esm/components/Subsequence/Subsequence.d.ts +1 -1
- package/esm/components/library.d.ts +2 -2
- package/esm/hooks/useArticulation.d.ts +58 -0
- package/esm/hooks/useArticulation.js +81 -0
- package/esm/hooks/useArticulation.js.map +1 -0
- package/esm/i18n/dictionary.d.ts +0 -8
- package/esm/i18n/dictionary.js +0 -5
- package/esm/i18n/dictionary.js.map +1 -1
- package/esm/i18n/index.d.ts +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/type.source.js +1 -0
- package/esm/type.source.js.map +1 -1
- package/esm/use-lunatic/commons/variables/behaviours/resizing-behaviour.js +7 -23
- package/esm/use-lunatic/commons/variables/behaviours/resizing-behaviour.js.map +1 -1
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.d.ts +1 -3
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.js +1 -1
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js +1 -66
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.d.ts +4 -4
- package/esm/use-lunatic/reducer/commons/index.d.ts +1 -0
- package/esm/use-lunatic/reducer/commons/index.js +1 -0
- package/esm/use-lunatic/reducer/commons/index.js.map +1 -1
- package/esm/use-lunatic/reducer/commons/resize-array-variable.d.ts +5 -0
- package/esm/use-lunatic/reducer/commons/resize-array-variable.js +21 -0
- package/esm/use-lunatic/reducer/commons/resize-array-variable.js.map +1 -0
- package/esm/use-lunatic/reducer/reducerInitializer.d.ts +2 -2
- package/esm/use-lunatic/reducer/reducerInitializer.js +31 -24
- package/esm/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/esm/use-lunatic/type.d.ts +0 -1
- package/esm/utils/array.d.ts +0 -4
- package/esm/utils/array.js +2 -15
- package/esm/utils/array.js.map +1 -1
- package/esm/utils/array.spec.js +1 -12
- package/esm/utils/array.spec.js.map +1 -1
- package/hooks/useArticulation.d.ts +58 -0
- package/hooks/useArticulation.js +81 -0
- package/hooks/useArticulation.js.map +1 -0
- package/i18n/dictionary.d.ts +0 -8
- package/i18n/dictionary.js +0 -5
- package/i18n/dictionary.js.map +1 -1
- package/i18n/index.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +20 -4
- package/src/components/Loop/Loop.tsx +12 -42
- package/src/components/RosterForLoop/RosterForLoop.tsx +2 -42
- package/src/components/RosterForLoop/__snapshots__/RosterForLoop.spec.tsx.snap +0 -18
- package/src/hooks/useArticulation.ts +124 -0
- package/src/i18n/dictionary.ts +0 -5
- package/src/index.ts +1 -0
- package/src/stories/behaviour/articulation/articulation.stories.tsx +105 -0
- package/src/stories/behaviour/articulation/roundabout.json +348 -0
- package/src/stories/behaviour/performance/performance.stories.jsx +1 -1
- package/src/stories/pairwise/data.json +1 -1
- package/src/stories/pairwise/source.json +1 -3
- package/src/stories/utils/{SchemaValidator.jsx → SchemaValidator.tsx} +1 -1
- package/src/stories/utils/{orchestrator.jsx → orchestrator.tsx} +13 -9
- package/src/stories/utils/{overview.jsx → overview.tsx} +2 -0
- package/src/type.source.ts +1 -0
- package/src/use-lunatic/__snapshots__/use-lunatic.test.ts.snap +323 -0
- package/src/use-lunatic/commons/variables/behaviours/resizing-behaviour.ts +10 -35
- package/src/use-lunatic/commons/variables/lunatic-variables-store.spec.ts +1 -68
- package/src/use-lunatic/commons/variables/lunatic-variables-store.ts +2 -4
- package/src/use-lunatic/reducer/commons/index.ts +1 -0
- package/src/use-lunatic/reducer/commons/resize-array-variable.ts +28 -0
- package/src/use-lunatic/reducer/reducerInitializer.tsx +40 -29
- package/src/use-lunatic/type.ts +0 -1
- package/src/utils/array.spec.ts +1 -18
- package/src/utils/array.ts +3 -21
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.js +1 -0
- package/type.source.js.map +1 -1
- package/use-lunatic/commons/variables/behaviours/resizing-behaviour.js +6 -22
- package/use-lunatic/commons/variables/behaviours/resizing-behaviour.js.map +1 -1
- package/use-lunatic/commons/variables/lunatic-variables-store.d.ts +1 -3
- package/use-lunatic/commons/variables/lunatic-variables-store.js +1 -1
- package/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
- package/use-lunatic/commons/variables/lunatic-variables-store.spec.js +1 -66
- package/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
- package/use-lunatic/props/getComponentTypeProps.d.ts +4 -4
- package/use-lunatic/reducer/commons/index.d.ts +1 -0
- package/use-lunatic/reducer/commons/index.js +6 -0
- package/use-lunatic/reducer/commons/index.js.map +1 -1
- package/use-lunatic/reducer/commons/resize-array-variable.d.ts +5 -0
- package/use-lunatic/reducer/commons/resize-array-variable.js +23 -0
- package/use-lunatic/reducer/commons/resize-array-variable.js.map +1 -0
- package/use-lunatic/reducer/reducerInitializer.d.ts +2 -2
- package/use-lunatic/reducer/reducerInitializer.js +31 -24
- package/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/use-lunatic/type.d.ts +0 -1
- package/utils/array.d.ts +0 -4
- package/utils/array.js +2 -16
- package/utils/array.js.map +1 -1
- package/utils/array.spec.js +0 -11
- package/utils/array.spec.js.map +1 -1
package/components/Loop/Loop.js
CHANGED
|
@@ -44,36 +44,16 @@ function Loop({ lines, iterations, value, handleChanges, getComponents, errors,
|
|
|
44
44
|
handleChanges(newResponses);
|
|
45
45
|
}
|
|
46
46
|
}, [nbRows, handleChanges, value]);
|
|
47
|
-
const removeRowWithIndex = (0, react_1.useCallback)((indexToRemove) => {
|
|
48
|
-
if (nbRows <= min) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Case 0: trying to delete
|
|
53
|
-
*/
|
|
54
|
-
if (indexToRemove >= nbRows || indexToRemove < 0) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const newResponses = Object.entries(value).map(([k, v]) => {
|
|
58
|
-
return {
|
|
59
|
-
name: k,
|
|
60
|
-
value: v?.filter((_, i) => i !== indexToRemove),
|
|
61
|
-
removedIndex: indexToRemove,
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
handleChanges(newResponses);
|
|
65
|
-
setNbRows((n) => n - 1);
|
|
66
|
-
}, [nbRows, min, value, handleChanges]);
|
|
67
47
|
if (nbRows <= 0) {
|
|
68
48
|
return null;
|
|
69
49
|
}
|
|
70
|
-
return ((0, jsx_runtime_1.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(exports.CustomLoop, { ...props, errors: (0, ComponentErrors_1.getComponentErrors)(errors, props.id), addRow: nbRows === max ? undefined : addRow, removeRow: nbRows === 1 ? undefined : removeRow, canControlRows: min !== max && Number.isFinite(max), children: (0, array_1.times)(nbRows, (n) => ((0, jsx_runtime_1.jsx)(LunaticComponents_1.LunaticComponents, { blocklist: constant_1.blockedInLoopComponents, components: getComponents(n), componentProps: (c) => ({
|
|
51
|
+
...props,
|
|
52
|
+
...c,
|
|
53
|
+
iteration: n,
|
|
54
|
+
id: `${c.id}-${n}`,
|
|
55
|
+
errors,
|
|
56
|
+
}) }, n))) }));
|
|
77
57
|
}
|
|
78
58
|
exports.CustomLoop = (0, slottableComponent_1.slottableComponent)('Loop', (props) => {
|
|
79
59
|
const { declarations, id, label, canControlRows, children, errors, addRow, removeRow, } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loop.js","sourceRoot":"","sources":["../../src/components/Loop/Loop.tsx"],"names":[],"mappings":";;;;;;AAmBA,
|
|
1
|
+
{"version":3,"file":"Loop.js","sourceRoot":"","sources":["../../src/components/Loop/Loop.tsx"],"names":[],"mappings":";;;;;;AAmBA,oBA8DC;;AAjFD,iCAAsE;AACtE,sDAA2B;AAC3B,6CAA0C;AAC1C,4DAAyD;AAEzD,yCAAqD;AACrD,yEAAsE;AACtE,iDAA8C;AAC9C,sEAAmE;AACnE,oDAAiD;AACjD,+EAGmD;AAGnD;;GAEG;AACH,SAAgB,IAAI,CAAC,EACpB,KAAK,EACL,UAAU,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,MAAM,EACN,GAAG,KAAK,EACuB;IAC/B,MAAM,GAAG,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5B,MAAM,GAAG,GAAG,KAAK,EAAE,GAAG,IAAI,QAAQ,CAAC;IACnC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC/B,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;YAClB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;IACF,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAClB,MAAM,S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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvB,GAAG,KAAK;gBACR,GAAG,CAAC;gBACJ,SAAS,EAAE,CAAC;gBACZ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;gBAClB,MAAM;aACN,CAAC,IARG,CAAC,CASL,CACF,CAAC,GACU,CACb,CAAC;AACH,CAAC;AAmBY,QAAA,UAAU,GAAG,IAAA,uCAAkB,EAAc,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;IAC3E,MAAM,EACL,YAAY,EACZ,EAAE,EACF,KAAK,EACL,cAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,GACT,GAAG,KAAK,CAAC;IAEV,OAAO,CACN,6DACC,uBAAC,aAAK,IAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,YACnC,KAAK,GACC,EACR,uBAAC,2BAAY,IACZ,IAAI,EAAC,qBAAqB,EAC1B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,GACL,EACD,QAAQ,EACT,uBAAC,iCAAe,IAAC,MAAM,EAAE,MAAM,GAAI,EAClC,cAAc,IAAI,CAClB,6DACC,uBAAC,eAAM,IAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,YACxC,cAAC,CAAC,kBAAkB,GACb,EACT,uBAAC,eAAM,IAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,SAAS,YAC9C,cAAC,CAAC,qBAAqB,GAChB,IACP,CACH,IACC,CACH,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.RosterForLoop = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const react_1 = require("react");
|
|
9
6
|
const Table_1 = require("../shared/Table");
|
|
10
7
|
const array_1 = require("../../utils/array");
|
|
11
|
-
const i18n_1 = __importDefault(require("../../i18n"));
|
|
12
8
|
const LunaticComponents_1 = require("../LunaticComponents");
|
|
13
9
|
const constant_1 = require("../Loop/constant");
|
|
14
10
|
const ComponentErrors_1 = require("../shared/ComponentErrors/ComponentErrors");
|
|
15
11
|
const Loop_1 = require("../Loop/Loop");
|
|
16
|
-
const Button_1 = require("../shared/Button/Button");
|
|
17
12
|
const DEFAULT_MIN_ROWS = 1;
|
|
18
13
|
const DEFAULT_MAX_ROWS = 12;
|
|
19
14
|
/**
|
|
@@ -34,7 +29,6 @@ const RosterForLoop = (props) => {
|
|
|
34
29
|
setNbRows(nbRows + 1);
|
|
35
30
|
}
|
|
36
31
|
}, [max, nbRows]);
|
|
37
|
-
const cantRemove = nbRows === min;
|
|
38
32
|
const removeRow = (0, react_1.useCallback)(() => {
|
|
39
33
|
if (nbRows <= min) {
|
|
40
34
|
return;
|
|
@@ -50,45 +44,22 @@ const RosterForLoop = (props) => {
|
|
|
50
44
|
});
|
|
51
45
|
handleChanges(newResponses);
|
|
52
46
|
}, [nbRows, min, valueMap, handleChanges]);
|
|
53
|
-
const removeRowWithIndex = (0, react_1.useCallback)((indexToRemove) => {
|
|
54
|
-
if (nbRows <= min) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Case 0: trying to delete
|
|
59
|
-
*/
|
|
60
|
-
if (indexToRemove >= nbRows || indexToRemove < 0) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const newResponses = Object.entries(valueMap).map(([k, v]) => {
|
|
64
|
-
return {
|
|
65
|
-
name: k,
|
|
66
|
-
value: v?.filter((_, i) => i !== indexToRemove),
|
|
67
|
-
removedIndex: indexToRemove,
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
handleChanges(newResponses);
|
|
71
|
-
setNbRows((n) => n - 1);
|
|
72
|
-
}, [nbRows, min, valueMap, handleChanges]);
|
|
73
47
|
if (nbRows === 0) {
|
|
74
48
|
return null;
|
|
75
49
|
}
|
|
76
50
|
let cols = 0;
|
|
77
|
-
|
|
78
|
-
? [...header, { label: i18n_1.default.ACTION_HEADER }]
|
|
79
|
-
: undefined;
|
|
80
|
-
return ((0, jsx_runtime_1.jsx)(Loop_1.CustomLoop, { ...props, errors: (0, ComponentErrors_1.getComponentErrors)(errors, props.id), addRow: nbRows === max ? undefined : addRow, removeRow: cantRemove ? undefined : removeRow, canControlRows: !!(min && max && min !== max), children: (0, jsx_runtime_1.jsxs)(Table_1.Table, { id: id, children: [headerWithActions && (0, jsx_runtime_1.jsx)(Table_1.TableHeader, { header: headerWithActions }), (0, jsx_runtime_1.jsx)(Table_1.Tbody, { children: (0, array_1.times)(nbRows, (n) => {
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(Loop_1.CustomLoop, { ...props, errors: (0, ComponentErrors_1.getComponentErrors)(errors, props.id), addRow: nbRows === max ? undefined : addRow, removeRow: nbRows === min ? undefined : removeRow, canControlRows: !!(min && max && min !== max), children: (0, jsx_runtime_1.jsxs)(Table_1.Table, { id: id, children: [header && (0, jsx_runtime_1.jsx)(Table_1.TableHeader, { header: header }), (0, jsx_runtime_1.jsx)(Table_1.Tbody, { children: (0, array_1.times)(nbRows, (n) => {
|
|
81
52
|
const components = getComponents(n);
|
|
82
53
|
const lineErrors = (0, ComponentErrors_1.getComponentErrors)(props.errors, `${id}-${n}`);
|
|
83
54
|
const hasLineErrors = !!lineErrors?.length;
|
|
84
55
|
cols = components.length;
|
|
85
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
56
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Table_1.Tr, { row: n, className: hasLineErrors ? 'lunatic-row-has-error' : undefined, children: (0, jsx_runtime_1.jsx)(LunaticComponents_1.LunaticComponents, { blocklist: constant_1.blockedInLoopComponents, components: components, memo: true, componentProps: (c) => ({
|
|
57
|
+
...otherProps,
|
|
58
|
+
...c,
|
|
59
|
+
id: `${c.id}-${n}`,
|
|
60
|
+
iteration: n,
|
|
61
|
+
errors,
|
|
62
|
+
}), wrapper: (props) => (0, jsx_runtime_1.jsx)(Table_1.Td, { ...props }) }) }, n), hasLineErrors && ((0, jsx_runtime_1.jsx)(Table_1.Tr, { className: "lunatic-errors", children: (0, jsx_runtime_1.jsx)(Table_1.Td, { colSpan: cols, children: (0, jsx_runtime_1.jsx)(ComponentErrors_1.ComponentErrors, { errors: lineErrors }) }) }))] }, n));
|
|
92
63
|
}) })] }) }));
|
|
93
64
|
};
|
|
94
65
|
exports.RosterForLoop = RosterForLoop;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RosterForLoop.js","sourceRoot":"","sources":["../../src/components/RosterForLoop/RosterForLoop.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RosterForLoop.js","sourceRoot":"","sources":["../../src/components/RosterForLoop/RosterForLoop.tsx"],"names":[],"mappings":";;;;AAAA,iCAAwD;AAExD,2CAAoE;AACpE,6CAA0C;AAC1C,4DAAyD;AACzD,+CAA2D;AAC3D,+EAGmD;AACnD,uCAA0C;AAE1C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;GAEG;AACI,MAAM,aAAa,GAAG,CAC5B,KAA6C,EAC5C,EAAE;IACH,MAAM,EACL,KAAK,EAAE,QAAQ,EACf,KAAK,EACL,MAAM,EACN,aAAa;IACb,6DAA6D;IAC7D,YAAY,EACZ,MAAM,EACN,UAAU,EACV,EAAE,EACF,aAAa;IACb,6DAA6D;IAC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EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;4CAClB,SAAS,EAAE,CAAC;4CACZ,MAAM;yCACN,CAAC,EACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAC,UAAE,OAAK,KAAK,GAAI,GACpC,IAjBG,CAAC,CAkBF,EACJ,aAAa,IAAI,CACjB,uBAAC,UAAE,IAAC,SAAS,EAAC,gBAAgB,YAE7B,uBAAC,UAAE,IAAC,OAAO,EAAE,IAAI,YAChB,uBAAC,iCAAe,IAAC,MAAM,EAAE,UAAU,GAAI,GACnC,GACD,CACL,KA7Ba,CAAC,CA8BL,CACX,CAAC;oBACH,CAAC,CAAC,GACK,IACD,GACI,CACb,CAAC;AACH,CAAC,CAAC;AAxGW,QAAA,aAAa,iBAwGxB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const Sequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "
|
|
1
|
+
export declare const Sequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id" | "style"> & import("../type").LunaticExtraProps & {
|
|
2
2
|
componentType?: "Sequence";
|
|
3
3
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const Subsequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "
|
|
1
|
+
export declare const Subsequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id"> & import("../type").LunaticExtraProps & {
|
|
2
2
|
componentType?: "Subsequence";
|
|
3
3
|
}>;
|
package/components/library.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ import { CheckboxOne } from './CheckboxOne/CheckboxOne';
|
|
|
16
16
|
import { Suggester } from './Suggester/Suggester';
|
|
17
17
|
import { Summary } from './Summary/Summary';
|
|
18
18
|
export declare const library: {
|
|
19
|
-
Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "
|
|
19
|
+
Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id" | "style"> & import("./type").LunaticExtraProps & {
|
|
20
20
|
componentType?: "Sequence";
|
|
21
21
|
}>;
|
|
22
|
-
Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "
|
|
22
|
+
Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id"> & import("./type").LunaticExtraProps & {
|
|
23
23
|
componentType?: "Subsequence";
|
|
24
24
|
}>;
|
|
25
25
|
RosterForLoop: (props: LunaticComponentProps<"RosterForLoop">) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -38,36 +38,16 @@ export function Loop({ lines, iterations, value, handleChanges, getComponents, e
|
|
|
38
38
|
handleChanges(newResponses);
|
|
39
39
|
}
|
|
40
40
|
}, [nbRows, handleChanges, value]);
|
|
41
|
-
const removeRowWithIndex = useCallback((indexToRemove) => {
|
|
42
|
-
if (nbRows <= min) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Case 0: trying to delete
|
|
47
|
-
*/
|
|
48
|
-
if (indexToRemove >= nbRows || indexToRemove < 0) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const newResponses = Object.entries(value).map(([k, v]) => {
|
|
52
|
-
return {
|
|
53
|
-
name: k,
|
|
54
|
-
value: v === null || v === void 0 ? void 0 : v.filter((_, i) => i !== indexToRemove),
|
|
55
|
-
removedIndex: indexToRemove,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
handleChanges(newResponses);
|
|
59
|
-
setNbRows((n) => n - 1);
|
|
60
|
-
}, [nbRows, min, value, handleChanges]);
|
|
61
41
|
if (nbRows <= 0) {
|
|
62
42
|
return null;
|
|
63
43
|
}
|
|
64
|
-
return (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
return (_jsx(CustomLoop, { ...props, errors: getComponentErrors(errors, props.id), addRow: nbRows === max ? undefined : addRow, removeRow: nbRows === 1 ? undefined : removeRow, canControlRows: min !== max && Number.isFinite(max), children: times(nbRows, (n) => (_jsx(LunaticComponents, { blocklist: blockedInLoopComponents, components: getComponents(n), componentProps: (c) => ({
|
|
45
|
+
...props,
|
|
46
|
+
...c,
|
|
47
|
+
iteration: n,
|
|
48
|
+
id: `${c.id}-${n}`,
|
|
49
|
+
errors,
|
|
50
|
+
}) }, n))) }));
|
|
71
51
|
}
|
|
72
52
|
export const CustomLoop = slottableComponent('Loop', (props) => {
|
|
73
53
|
const { declarations, id, label, canControlRows, children, errors, addRow, removeRow, } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loop.js","sourceRoot":"","sources":["../../../src/components/Loop/Loop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0B,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,CAAC,MAAM,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EACN,eAAe,EACf,kBAAkB,GAClB,MAAM,2CAA2C,CAAC;AAGnD;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,EACpB,KAAK,EACL,UAAU,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,MAAM,EACN,GAAG,KAAK,EACuB;;IAC/B,MAAM,GAAG,GAAG,MAAA,KAAK,aAAL,KA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AAC,EAC5B,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvB,GAAG,KAAK;gBACR,GAAG,CAAC;gBACJ,SAAS,EAAE,CAAC;gBACZ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;gBAClB,MAAM;aACN,CAAC,IARG,CAAC,CASL,CACF,CAAC,GACU,CACb,CAAC;AACH,CAAC;AAmBD,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAc,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;IAC3E,MAAM,EACL,YAAY,EACZ,EAAE,EACF,KAAK,EACL,cAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,GACT,GAAG,KAAK,CAAC;IAEV,OAAO,CACN,8BACC,KAAC,KAAK,IAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,YACnC,KAAK,GACC,EACR,KAAC,YAAY,IACZ,IAAI,EAAC,qBAAqB,EAC1B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,GACL,EACD,QAAQ,EACT,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,GAAI,EAClC,cAAc,IAAI,CAClB,8BACC,KAAC,MAAM,IAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,YACxC,CAAC,CAAC,kBAAkB,GACb,EACT,KAAC,MAAM,IAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,SAAS,YAC9C,CAAC,CAAC,qBAAqB,GAChB,IACP,CACH,IACC,CACH,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -2,12 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Fragment, useCallback, useState } from 'react';
|
|
3
3
|
import { Table, Tbody, Td, Tr, TableHeader } from '../shared/Table';
|
|
4
4
|
import { times } from '../../utils/array';
|
|
5
|
-
import D from '../../i18n';
|
|
6
5
|
import { LunaticComponents } from '../LunaticComponents';
|
|
7
6
|
import { blockedInLoopComponents } from '../Loop/constant';
|
|
8
7
|
import { ComponentErrors, getComponentErrors, } from '../shared/ComponentErrors/ComponentErrors';
|
|
9
8
|
import { CustomLoop } from '../Loop/Loop';
|
|
10
|
-
import { Button } from '../shared/Button/Button';
|
|
11
9
|
const DEFAULT_MIN_ROWS = 1;
|
|
12
10
|
const DEFAULT_MAX_ROWS = 12;
|
|
13
11
|
/**
|
|
@@ -29,7 +27,6 @@ export const RosterForLoop = (props) => {
|
|
|
29
27
|
setNbRows(nbRows + 1);
|
|
30
28
|
}
|
|
31
29
|
}, [max, nbRows]);
|
|
32
|
-
const cantRemove = nbRows === min;
|
|
33
30
|
const removeRow = useCallback(() => {
|
|
34
31
|
if (nbRows <= min) {
|
|
35
32
|
return;
|
|
@@ -45,45 +42,22 @@ export const RosterForLoop = (props) => {
|
|
|
45
42
|
});
|
|
46
43
|
handleChanges(newResponses);
|
|
47
44
|
}, [nbRows, min, valueMap, handleChanges]);
|
|
48
|
-
const removeRowWithIndex = useCallback((indexToRemove) => {
|
|
49
|
-
if (nbRows <= min) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Case 0: trying to delete
|
|
54
|
-
*/
|
|
55
|
-
if (indexToRemove >= nbRows || indexToRemove < 0) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const newResponses = Object.entries(valueMap).map(([k, v]) => {
|
|
59
|
-
return {
|
|
60
|
-
name: k,
|
|
61
|
-
value: v === null || v === void 0 ? void 0 : v.filter((_, i) => i !== indexToRemove),
|
|
62
|
-
removedIndex: indexToRemove,
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
handleChanges(newResponses);
|
|
66
|
-
setNbRows((n) => n - 1);
|
|
67
|
-
}, [nbRows, min, valueMap, handleChanges]);
|
|
68
45
|
if (nbRows === 0) {
|
|
69
46
|
return null;
|
|
70
47
|
}
|
|
71
48
|
let cols = 0;
|
|
72
|
-
|
|
73
|
-
? [...header, { label: D.ACTION_HEADER }]
|
|
74
|
-
: undefined;
|
|
75
|
-
return (_jsx(CustomLoop, { ...props, errors: getComponentErrors(errors, props.id), addRow: nbRows === max ? undefined : addRow, removeRow: cantRemove ? undefined : removeRow, canControlRows: !!(min && max && min !== max), children: _jsxs(Table, { id: id, children: [headerWithActions && _jsx(TableHeader, { header: headerWithActions }), _jsx(Tbody, { children: times(nbRows, (n) => {
|
|
49
|
+
return (_jsx(CustomLoop, { ...props, errors: getComponentErrors(errors, props.id), addRow: nbRows === max ? undefined : addRow, removeRow: nbRows === min ? undefined : removeRow, canControlRows: !!(min && max && min !== max), children: _jsxs(Table, { id: id, children: [header && _jsx(TableHeader, { header: header }), _jsx(Tbody, { children: times(nbRows, (n) => {
|
|
76
50
|
const components = getComponents(n);
|
|
77
51
|
const lineErrors = getComponentErrors(props.errors, `${id}-${n}`);
|
|
78
52
|
const hasLineErrors = !!(lineErrors === null || lineErrors === void 0 ? void 0 : lineErrors.length);
|
|
79
53
|
cols = components.length;
|
|
80
|
-
return (_jsxs(Fragment, { children: [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
54
|
+
return (_jsxs(Fragment, { children: [_jsx(Tr, { row: n, className: hasLineErrors ? 'lunatic-row-has-error' : undefined, children: _jsx(LunaticComponents, { blocklist: blockedInLoopComponents, components: components, memo: true, componentProps: (c) => ({
|
|
55
|
+
...otherProps,
|
|
56
|
+
...c,
|
|
57
|
+
id: `${c.id}-${n}`,
|
|
58
|
+
iteration: n,
|
|
59
|
+
errors,
|
|
60
|
+
}), wrapper: (props) => _jsx(Td, { ...props }) }) }, n), hasLineErrors && (_jsx(Tr, { className: "lunatic-errors", children: _jsx(Td, { colSpan: cols, children: _jsx(ComponentErrors, { errors: lineErrors }) }) }))] }, n));
|
|
87
61
|
}) })] }) }));
|
|
88
62
|
};
|
|
89
63
|
//# sourceMappingURL=RosterForLoop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RosterForLoop.js","sourceRoot":"","sources":["../../../src/components/RosterForLoop/RosterForLoop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"RosterForLoop.js","sourceRoot":"","sources":["../../../src/components/RosterForLoop/RosterForLoop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACN,eAAe,EACf,kBAAkB,GAClB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,KAA6C,EAC5C,EAAE;;IACH,MAAM,EACL,KAAK,EAAE,QAAQ,EACf,KAAK,EACL,MAAM,EACN,aAAa;IACb,6DAA6D;IAC7D,YAAY,EACZ,MAAM,EACN,UAAU,EACV,EAAE,EACF,a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ACJ,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;4CACvB,GAAG,UAAU;4CACb,GAAG,CAAC;4CACJ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;4CAClB,SAAS,EAAE,CAAC;4CACZ,MAAM;yCACN,CAAC,EACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,EAAE,OAAK,KAAK,GAAI,GACpC,IAjBG,CAAC,CAkBF,EACJ,aAAa,IAAI,CACjB,KAAC,EAAE,IAAC,SAAS,EAAC,gBAAgB,YAE7B,KAAC,EAAE,IAAC,OAAO,EAAE,IAAI,YAChB,KAAC,eAAe,IAAC,MAAM,EAAE,UAAU,GAAI,GACnC,GACD,CACL,KA7Ba,CAAC,CA8BL,CACX,CAAC;oBACH,CAAC,CAAC,GACK,IACD,GACI,CACb,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const Sequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "
|
|
1
|
+
export declare const Sequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id" | "style"> & import("../type").LunaticExtraProps & {
|
|
2
2
|
componentType?: "Sequence";
|
|
3
3
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const Subsequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "
|
|
1
|
+
export declare const Subsequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id"> & import("../type").LunaticExtraProps & {
|
|
2
2
|
componentType?: "Subsequence";
|
|
3
3
|
}>;
|
|
@@ -16,10 +16,10 @@ import { CheckboxOne } from './CheckboxOne/CheckboxOne';
|
|
|
16
16
|
import { Suggester } from './Suggester/Suggester';
|
|
17
17
|
import { Summary } from './Summary/Summary';
|
|
18
18
|
export declare const library: {
|
|
19
|
-
Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "
|
|
19
|
+
Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id" | "style"> & import("./type").LunaticExtraProps & {
|
|
20
20
|
componentType?: "Sequence";
|
|
21
21
|
}>;
|
|
22
|
-
Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "
|
|
22
|
+
Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "label" | "description" | "declarations" | "id"> & import("./type").LunaticExtraProps & {
|
|
23
23
|
componentType?: "Subsequence";
|
|
24
24
|
}>;
|
|
25
25
|
RosterForLoop: (props: LunaticComponentProps<"RosterForLoop">) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { LunaticSource } from '../type.source';
|
|
2
|
+
import type { LunaticData } from '../use-lunatic/type';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
type ArticulationItem = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
type Articulation = {
|
|
9
|
+
source: string;
|
|
10
|
+
items: ArticulationItem[];
|
|
11
|
+
};
|
|
12
|
+
type Item = {
|
|
13
|
+
cells: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: ReactNode;
|
|
16
|
+
page?: string;
|
|
17
|
+
}[];
|
|
18
|
+
progress: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hook to get articulation state
|
|
22
|
+
*
|
|
23
|
+
* ## Why this hook
|
|
24
|
+
*
|
|
25
|
+
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
26
|
+
* provided to Lunatic.
|
|
27
|
+
*
|
|
28
|
+
* For instance
|
|
29
|
+
*
|
|
30
|
+
* ```
|
|
31
|
+
* "articulation": {
|
|
32
|
+
* "source": "roundabout",
|
|
33
|
+
* "items": [
|
|
34
|
+
* {
|
|
35
|
+
* "label": "Prénom",
|
|
36
|
+
* "value": "PRENOMS"
|
|
37
|
+
* },
|
|
38
|
+
* {
|
|
39
|
+
* "label": "Sexe",
|
|
40
|
+
* "value": "if SEXE = \"H\" then \"Homme\" else \"Femme\""
|
|
41
|
+
* },
|
|
42
|
+
* {
|
|
43
|
+
* "label": "Age",
|
|
44
|
+
* "value": "cast(AGE, string) || \" ans\""
|
|
45
|
+
* }
|
|
46
|
+
* ]
|
|
47
|
+
* },
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* - source is the ID of the roundabout component
|
|
51
|
+
* - items define the field to extract from the roundabout data
|
|
52
|
+
*/
|
|
53
|
+
export declare function useArticulation(source: LunaticSource & {
|
|
54
|
+
articulation: Articulation;
|
|
55
|
+
}, data: LunaticData): {
|
|
56
|
+
items: Item[];
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { reducerInitializer } from '../use-lunatic/reducer/reducerInitializer';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { times } from '../utils/array';
|
|
4
|
+
import { forceInt } from '../utils/number';
|
|
5
|
+
/**
|
|
6
|
+
* Hook to get articulation state
|
|
7
|
+
*
|
|
8
|
+
* ## Why this hook
|
|
9
|
+
*
|
|
10
|
+
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
11
|
+
* provided to Lunatic.
|
|
12
|
+
*
|
|
13
|
+
* For instance
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
16
|
+
* "articulation": {
|
|
17
|
+
* "source": "roundabout",
|
|
18
|
+
* "items": [
|
|
19
|
+
* {
|
|
20
|
+
* "label": "Prénom",
|
|
21
|
+
* "value": "PRENOMS"
|
|
22
|
+
* },
|
|
23
|
+
* {
|
|
24
|
+
* "label": "Sexe",
|
|
25
|
+
* "value": "if SEXE = \"H\" then \"Homme\" else \"Femme\""
|
|
26
|
+
* },
|
|
27
|
+
* {
|
|
28
|
+
* "label": "Age",
|
|
29
|
+
* "value": "cast(AGE, string) || \" ans\""
|
|
30
|
+
* }
|
|
31
|
+
* ]
|
|
32
|
+
* },
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* - source is the ID of the roundabout component
|
|
36
|
+
* - items define the field to extract from the roundabout data
|
|
37
|
+
*/
|
|
38
|
+
export function useArticulation(source, data) {
|
|
39
|
+
const roundabout = useMemo(() => findComponentById(source.components, source.articulation.source), [source]);
|
|
40
|
+
const { variables } = useMemo(() => reducerInitializer({ source, data }), [source, data]);
|
|
41
|
+
const iterations = useMemo(() => { var _a; return forceInt(variables.run((_a = roundabout === null || roundabout === void 0 ? void 0 : roundabout.iterations.value) !== null && _a !== void 0 ? _a : '0')); },
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
[source, data]);
|
|
44
|
+
const rows = useMemo(() => {
|
|
45
|
+
return times(iterations, (k) => source.articulation.items.map((item) => ({
|
|
46
|
+
label: item.label,
|
|
47
|
+
value: variables.run(item.value, { iteration: [k] }),
|
|
48
|
+
})));
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
+
}, [source, data, iterations, roundabout === null || roundabout === void 0 ? void 0 : roundabout.progressVariable]);
|
|
51
|
+
if (!roundabout) {
|
|
52
|
+
return {
|
|
53
|
+
items: [],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
items: rows.map((row, k) => {
|
|
58
|
+
var _a;
|
|
59
|
+
return ({
|
|
60
|
+
cells: row,
|
|
61
|
+
progress: forceInt((_a = variables.get(roundabout.progressVariable, [k])) !== null && _a !== void 0 ? _a : -1),
|
|
62
|
+
page: roundabout.page ? `${roundabout.page}.1#${k + 1}` : '1',
|
|
63
|
+
});
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function findComponentById(components, id) {
|
|
68
|
+
for (const c of components) {
|
|
69
|
+
if ('id' in c && c.id === id && c.componentType === 'Roundabout') {
|
|
70
|
+
return c;
|
|
71
|
+
}
|
|
72
|
+
if ('components' in c) {
|
|
73
|
+
const child = findComponentById(c.components, id);
|
|
74
|
+
if (child) {
|
|
75
|
+
return child;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=useArticulation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useArticulation.js","sourceRoot":"","sources":["../../src/hooks/useArticulation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAkB,OAAO,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAqB3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,eAAe,CAC9B,MAAsD,EACtD,IAAiB;IAEjB,MAAM,UAAU,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EACtE,CAAC,MAAM,CAAC,CACR,CAAC;IACF,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAC1C,CAAC,MAAM,EAAE,IAAI,CAAC,CACd,CAAC;IAEF,MAAM,UAAU,GAAG,OAAO,CACzB,GAAG,EAAE,WAAC,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,CAAC,KAAK,mCAAI,GAAG,CAAC,CAAC,CAAA,EAAA;IAClE,uDAAuD;IACvD,CAAC,MAAM,EAAE,IAAI,CAAC,CACd,CAAC;IA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CAAC,CAAC,aAAa,KAAK,YAAY,EAAE,CAAC;YAClE,OAAO,CAAC,CAAC;QACV,CAAC;QACD,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAClD,IAAI,KAAK,EAAE,CAAC;gBACX,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
package/esm/i18n/dictionary.d.ts
CHANGED
|
@@ -7,14 +7,6 @@ declare const dictionary: {
|
|
|
7
7
|
readonly fr: "Supprimer une ligne";
|
|
8
8
|
readonly en: "Remove row";
|
|
9
9
|
};
|
|
10
|
-
readonly DEFAULT_BUTTON_REMOVE_THAT_ROW: {
|
|
11
|
-
readonly fr: "Supprimer cette ligne";
|
|
12
|
-
readonly en: "Remove that row";
|
|
13
|
-
};
|
|
14
|
-
readonly ACTION_HEADER: {
|
|
15
|
-
readonly fr: "Action";
|
|
16
|
-
readonly en: "Action";
|
|
17
|
-
};
|
|
18
10
|
readonly MODAL_IGNORE: {
|
|
19
11
|
readonly fr: "Poursuivre";
|
|
20
12
|
readonly en: "Ignore";
|
package/esm/i18n/dictionary.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
const dictionary = {
|
|
2
2
|
DEFAULT_BUTTON_ADD: { fr: 'Ajouter une ligne', en: 'Add row' },
|
|
3
3
|
DEFAULT_BUTTON_REMOVE: { fr: 'Supprimer une ligne', en: 'Remove row' },
|
|
4
|
-
DEFAULT_BUTTON_REMOVE_THAT_ROW: {
|
|
5
|
-
fr: 'Supprimer cette ligne',
|
|
6
|
-
en: 'Remove that row',
|
|
7
|
-
},
|
|
8
|
-
ACTION_HEADER: { fr: 'Action', en: 'Action' },
|
|
9
4
|
MODAL_IGNORE: { fr: 'Poursuivre', en: 'Ignore' },
|
|
10
5
|
MODAL_CORRECT: { fr: 'Corriger ma réponse', en: 'Correct' },
|
|
11
6
|
DK: { fr: 'Ne sais pas', en: "Don't know" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../src/i18n/dictionary.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG;IAClB,kBAAkB,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,SAAS,EAAE;IAC9D,qBAAqB,EAAE,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,YAAY,EAAE;IACtE,
|
|
1
|
+
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../src/i18n/dictionary.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG;IAClB,kBAAkB,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,SAAS,EAAE;IAC9D,qBAAqB,EAAE,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,YAAY,EAAE;IACtE,YAAY,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE;IAChD,aAAa,EAAE,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,SAAS,EAAE;IAC3D,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,YAAY,EAAE;IAC3C,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE;IAClC,WAAW,EAAE,EAAE,EAAE,EAAE,2BAA2B,EAAE,EAAE,EAAE,iBAAiB,EAAE;IACvE,iBAAiB,EAAE;QAClB,EAAE,EAAE,8BAA8B;QAClC,EAAE,EAAE,iBAAiB;KACrB;IACD,mBAAmB,EAAE;QACpB,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,YAAY;KAChB;IACD,eAAe,EAAE;QAChB,EAAE,EAAE,uCAAuC;QAC3C,EAAE,EAAE,6CAA6C;KACjD;IACD,mBAAmB,EAAE;QACpB,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,QAAQ;KACZ;CACQ,CAAC;AAEX,eAAe,UAAU,CAAC"}
|
package/esm/i18n/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export declare const inputNumberPropsI18N: {
|
|
|
3
3
|
thousandSeparator: string;
|
|
4
4
|
decimalSeparator: string;
|
|
5
5
|
};
|
|
6
|
-
declare const _default: Record<"DK" | "RF" | "DEFAULT_BUTTON_ADD" | "DEFAULT_BUTTON_REMOVE" | "
|
|
6
|
+
declare const _default: Record<"DK" | "RF" | "DEFAULT_BUTTON_ADD" | "DEFAULT_BUTTON_REMOVE" | "MODAL_IGNORE" | "MODAL_CORRECT" | "PLACEHOLDER" | "SUGGESTER_LOADING" | "SUGGESTER_NO_RESULT" | "SUGGESTER_ERROR" | "SUGGESTER_ARBITRARY", string>;
|
|
7
7
|
export default _default;
|
package/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { useArticulation } from './hooks/useArticulation';
|
|
10
11
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, LunaticOptions, LunaticChangesHandler, } from './use-lunatic/type';
|
|
11
12
|
export type { LunaticComponentProps, LunaticExtraProps, } from './components/type';
|
|
12
13
|
export type { LunaticSlotComponents } from './components/shared/HOC/slottableComponent';
|
package/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { useArticulation } from './hooks/useArticulation';
|
|
10
11
|
// Export errors (useful for typeof)
|
|
11
12
|
export { VTLMissingDependencies, VTLExpressionError, VTLMissingDependency, VTLInterpretationError, } from './use-lunatic/commons/variables/errors';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAyB1D,oCAAoC;AACpC,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,wCAAwC,CAAC"}
|
package/esm/type.source.js
CHANGED
package/esm/type.source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.source.js","sourceRoot":"","sources":["../src/type.source.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
1
|
+
{"version":3,"file":"type.source.js","sourceRoot":"","sources":["../src/type.source.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;GAIG"}
|