@inseefr/lunatic 2.6.2 → 2.6.3
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/README.md +49 -3
- package/lib/components/checkbox/checkbox-boolean/html/checkbox-boolean.js +3 -3
- package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +7 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group-content.js +0 -2
- package/lib/components/checkbox/checkbox-group/html/checkbox-group-content.js +4 -2
- package/lib/components/checkbox/checkbox-group/html/checkbox-group.js +3 -3
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +2 -1
- package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +2 -1
- package/lib/components/checkbox/commons/checkbox-option.js +3 -1
- package/lib/components/commons/components/combo-box/combo-box-container.js +1 -2
- package/lib/components/commons/components/combo-box/combo-box.js +2 -2
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.js +3 -1
- package/lib/components/commons/components/combo-box/selection/input.js +3 -1
- package/lib/components/commons/components/combo-box/selection/selection.js +3 -1
- package/lib/components/commons/components/errors/errors.js +12 -10
- package/lib/components/commons/components/errors/errors.spec.js +6 -6
- package/lib/components/component-set/html/__snapshots__/component-set.spec.tsx.snap +2 -0
- package/lib/components/component-set/html/component-set.js +2 -2
- package/lib/components/datepicker/html/__snapshots__/datepicker.spec.tsx.snap +2 -0
- package/lib/components/datepicker/html/datepicker-input.js +4 -2
- package/lib/components/datepicker/html/datepicker.js +3 -3
- package/lib/components/datepicker/lunatic-datepicker.js +2 -1
- package/lib/components/dropdown/lunatic-dropdown.js +2 -1
- package/lib/components/input/html/__snapshots__/input.spec.tsx.snap +2 -0
- package/lib/components/input/html/input.js +3 -3
- package/lib/components/input/lunatic-input.js +2 -1
- package/lib/components/input-number/html/__snapshots__/input-number.spec.tsx.snap +2 -2
- package/lib/components/input-number/html/input-number-thousand.js +4 -17
- package/lib/components/input-number/html/input-number.js +3 -5
- package/lib/components/input-number/lunatic-input-number.js +2 -3
- package/lib/components/lunatic-components.js +2 -11
- package/lib/components/radio/html/radio-group-content.js +4 -2
- package/lib/components/radio/html/radio-group.js +3 -3
- package/lib/components/radio/html/radio-option.js +3 -1
- package/lib/components/radio/lunatic-radio-group.js +2 -1
- package/lib/components/suggester/find-best-label/find-best-label.js +6 -6
- package/lib/components/suggester/idb-suggester/idb-suggester.js +4 -3
- package/lib/components/suggester/lunatic-suggester.js +7 -4
- package/lib/components/suggester/searching/create-searching.js +20 -39
- package/lib/components/switch/html/switch.js +2 -2
- package/lib/components/switch/lunatic-switch.js +2 -1
- package/lib/components/table/lunatic-table.js +2 -2
- package/lib/components/textarea/html/__snapshots__/textarea.spec.tsx.snap +2 -0
- package/lib/components/textarea/html/textarea.js +6 -4
- package/lib/components/textarea/lunatic-textarea.js +6 -3
- package/lib/hooks/use-auto-focus.js +26 -0
- package/lib/src/components/checkbox/checkbox-boolean/html/checkbox-boolean.d.ts +1 -1
- package/lib/src/components/checkbox/checkbox-group/html/checkbox-group-content.d.ts +2 -1
- package/lib/src/components/checkbox/checkbox-group/html/checkbox-group.d.ts +1 -1
- package/lib/src/components/checkbox/commons/checkbox-option.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/combo-box-container.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +4 -6
- package/lib/src/components/commons/components/combo-box/selection/LabelOrInput.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/selection/input.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/selection/selection.d.ts +2 -1
- package/lib/src/components/commons/components/errors/errors.d.ts +6 -3
- package/lib/src/components/datepicker/html/datepicker-input.d.ts +2 -1
- package/lib/src/components/datepicker/html/datepicker.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +1 -1
- package/lib/src/components/dropdown/html/dropdown.d.ts +3 -1
- package/lib/src/components/input/html/input.d.ts +2 -2
- package/lib/src/components/input-number/html/input-number-thousand.d.ts +2 -2
- package/lib/src/components/input-number/html/input-number.d.ts +2 -3
- package/lib/src/components/radio/html/radio-group-content.d.ts +2 -1
- package/lib/src/components/radio/html/radio-group.d.ts +1 -1
- package/lib/src/components/radio/html/radio-option.d.ts +1 -0
- package/lib/src/components/suggester/find-best-label/find-best-label.d.ts +1 -1
- package/lib/src/components/suggester/html/suggester.d.ts +1 -1
- package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +5 -2
- package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
- package/lib/src/components/suggester/searching/create-searching.d.ts +1 -1
- package/lib/src/components/switch/html/switch.d.ts +1 -1
- package/lib/src/components/textarea/html/textarea.d.ts +3 -2
- package/lib/src/components/type.d.ts +4 -3
- package/lib/src/hooks/use-auto-focus.d.ts +6 -0
- package/lib/src/use-lunatic/actions.d.ts +3 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +418 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +20 -0
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -0
- package/lib/src/use-lunatic/type.d.ts +2 -1
- package/lib/src/use-lunatic/use-lunatic.d.ts +8 -5
- package/lib/src/use-lunatic/use-suggesters.d.ts +2 -1
- package/lib/src/utils/suggester-workers/append-to-index/create-append-task.d.ts +1 -1
- package/lib/src/utils/suggester-workers/worker-path.d.ts +6 -0
- package/lib/stories/behaviour/cleaning/source.json +151 -0
- package/lib/stories/behaviour/cleaning/test.stories.js +84 -0
- package/lib/stories/{questionnaires-test → behaviour}/controls/controls.stories.js +5 -5
- package/lib/stories/{questionnaires-test → behaviour/others}/test.stories.js +7 -7
- package/lib/stories/{paste-questionnaire → behaviour/paste}/test.stories.js +3 -3
- package/lib/stories/{resizing-questionnaire → behaviour/resizing}/test.stories.js +3 -3
- package/lib/use-lunatic/commons/fill-components/fill-component-required.js +23 -0
- package/lib/use-lunatic/commons/fill-components/fill-components.js +2 -1
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +2 -0
- package/lib/use-lunatic/initial-state.js +2 -1
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +7 -1
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +12 -3
- package/lib/use-lunatic/reducer/reduce-on-init.js +4 -2
- package/lib/use-lunatic/use-lunatic.js +19 -8
- package/lib/use-lunatic/use-lunatic.test.js +34 -2
- package/lib/use-lunatic/use-suggesters.js +4 -3
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +4 -3
- package/lib/utils/suggester-workers/worker-path.js +29 -0
- package/package.json +15 -10
- package/scripts/build/add-workers-to-public.js +44 -0
- package/scripts/build/workers-paths.js +44 -0
- package/workers-release/lunatic-append-worker-0.3.0-experimental.js +2 -0
- package/workers-release/lunatic-append-worker-0.3.0-experimental.js.LICENSE.txt +34 -0
- package/workers-release/lunatic-label-worker-0.3.0-experimental.js +2 -0
- package/workers-release/lunatic-label-worker-0.3.0-experimental.js.LICENSE.txt +13 -0
- package/workers-release/lunatic-searching-worker-0.3.0-experimental.js +2 -0
- package/workers-release/lunatic-searching-worker-0.3.0-experimental.js.LICENSE.txt +34 -0
- package/lib/src/utils/store-tools/worker-path.d.ts +0 -1
- package/lib/utils/store-tools/worker-path.js +0 -13
- package/lib/utils/suggester-workers/create-worker.js +0 -55
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_Controles_BouclesLiees2_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_Controles_BouclesLiees_PasPageFin.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/boucles-n.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/controls-externes.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour}/controls/controls-externes.stories.js +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_DeclarationsSimples.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_MinMaxSum_Boucles.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_QuestSimple_Boucles.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/V2_TCMRallyeGames.json +0 -0
- /package/lib/stories/{questionnaires-test → behaviour/others}/test-dylan.json +0 -0
- /package/lib/stories/{paste-questionnaire → behaviour/paste}/source.json +0 -0
- /package/lib/stories/{resizing-questionnaire → behaviour/resizing}/source.json +0 -0
|
@@ -3,6 +3,7 @@ type useSuggestersType = {
|
|
|
3
3
|
auto: boolean;
|
|
4
4
|
getReferentiel?: (name: string) => Promise<Array<unknown>>;
|
|
5
5
|
suggesters?: Array<SuggesterType>;
|
|
6
|
+
workersBasePath?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare enum SuggesterStatus {
|
|
8
9
|
unused = 0,
|
|
@@ -12,7 +13,7 @@ export declare enum SuggesterStatus {
|
|
|
12
13
|
unknown = 4,
|
|
13
14
|
error = 5
|
|
14
15
|
}
|
|
15
|
-
export declare function useSuggesters({ auto, getReferentiel, suggesters, }: useSuggestersType): (name: string) => {
|
|
16
|
+
export declare function useSuggesters({ auto, getReferentiel, suggesters, workersBasePath, }: useSuggestersType): (name: string) => {
|
|
16
17
|
status: SuggesterStatus;
|
|
17
18
|
timestamp: number;
|
|
18
19
|
};
|
|
@@ -3,5 +3,5 @@ declare function consoleLogging(...args: Array<any>): void;
|
|
|
3
3
|
/**
|
|
4
4
|
* Only with Worker
|
|
5
5
|
*/
|
|
6
|
-
export declare function createAppendTask<T>(info: SuggesterType, version: number, log?: typeof consoleLogging): [(args: Array<any>) => Promise<boolean>, () => void];
|
|
6
|
+
export declare function createAppendTask<T>(info: SuggesterType, version: number, log?: typeof consoleLogging, workersBasePath?: string): [(args: Array<any>) => Promise<boolean>, () => void];
|
|
7
7
|
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cleaning": {
|
|
3
|
+
"ORIGIN": {
|
|
4
|
+
"CITY": "ORIGIN = \"FR\""
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
"variables": [
|
|
8
|
+
{
|
|
9
|
+
"variableType": "COLLECTED",
|
|
10
|
+
"values": {
|
|
11
|
+
"COLLECTED": null,
|
|
12
|
+
"EDITED": null,
|
|
13
|
+
"INPUTED": null,
|
|
14
|
+
"FORCED": null,
|
|
15
|
+
"PREVIOUS": null
|
|
16
|
+
},
|
|
17
|
+
"name": "ORIGIN"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"variableType": "COLLECTED",
|
|
21
|
+
"values": {
|
|
22
|
+
"COLLECTED": null,
|
|
23
|
+
"EDITED": null,
|
|
24
|
+
"INPUTED": null,
|
|
25
|
+
"FORCED": null,
|
|
26
|
+
"PREVIOUS": null
|
|
27
|
+
},
|
|
28
|
+
"name": "CITY"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"components": [
|
|
32
|
+
{
|
|
33
|
+
"componentType": "Sequence",
|
|
34
|
+
"hierarchy": {
|
|
35
|
+
"sequence": {
|
|
36
|
+
"id": "ksyjs7vy",
|
|
37
|
+
"page": "1",
|
|
38
|
+
"label": {
|
|
39
|
+
"type": "VTL|MD",
|
|
40
|
+
"value": "\"I - \" || \"S0\""
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"conditionFilter": {
|
|
45
|
+
"type": "VTL",
|
|
46
|
+
"value": "true"
|
|
47
|
+
},
|
|
48
|
+
"id": "ksyjs7vy",
|
|
49
|
+
"page": "1",
|
|
50
|
+
"label": {
|
|
51
|
+
"type": "VTL|MD",
|
|
52
|
+
"value": "\"I - \" || \"Test du cleaning\""
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"componentType": "Radio",
|
|
57
|
+
"id": "radio",
|
|
58
|
+
"controls": [],
|
|
59
|
+
"hierarchy": {
|
|
60
|
+
"sequence": {
|
|
61
|
+
"id": "ksyjs7vy",
|
|
62
|
+
"page": "1",
|
|
63
|
+
"label": {
|
|
64
|
+
"type": "VTL|MD",
|
|
65
|
+
"value": "\"I - \" || \"S0\""
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"options": [
|
|
70
|
+
{
|
|
71
|
+
"value": "US",
|
|
72
|
+
"label": {
|
|
73
|
+
"value": "\"Etats unis\"",
|
|
74
|
+
"type": "VTL|MD"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"value": "FR",
|
|
79
|
+
"label": {
|
|
80
|
+
"value": "\"France\"",
|
|
81
|
+
"type": "VTL|MD"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"conditionFilter": {
|
|
86
|
+
"type": "VTL",
|
|
87
|
+
"value": "true"
|
|
88
|
+
},
|
|
89
|
+
"label": {
|
|
90
|
+
"type": "VTL|MD",
|
|
91
|
+
"value": "\"➡ 1. \" || \"Origine\""
|
|
92
|
+
},
|
|
93
|
+
"mandatory": false,
|
|
94
|
+
"bindingDependencies": ["ORIGIN"],
|
|
95
|
+
"response": {
|
|
96
|
+
"name": "ORIGIN"
|
|
97
|
+
},
|
|
98
|
+
"page": "2"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"componentType": "Input",
|
|
102
|
+
"id": "input",
|
|
103
|
+
"controls": [],
|
|
104
|
+
"hierarchy": {
|
|
105
|
+
"sequence": {
|
|
106
|
+
"id": "ksyjs7vy",
|
|
107
|
+
"page": "1",
|
|
108
|
+
"label": {
|
|
109
|
+
"type": "VTL|MD",
|
|
110
|
+
"value": "\"I - \" || \"S0\""
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"conditionFilter": {
|
|
115
|
+
"type": "VTL",
|
|
116
|
+
"value": "ORIGIN = \"FR\""
|
|
117
|
+
},
|
|
118
|
+
"label": {
|
|
119
|
+
"type": "VTL|MD",
|
|
120
|
+
"value": "\"➡ 2. \" || \"Ville de france\""
|
|
121
|
+
},
|
|
122
|
+
"mandatory": false,
|
|
123
|
+
"bindingDependencies": ["CITY"],
|
|
124
|
+
"response": {
|
|
125
|
+
"name": "CITY"
|
|
126
|
+
},
|
|
127
|
+
"page": "3"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"componentType": "Sequence",
|
|
131
|
+
"conditionFilter": {
|
|
132
|
+
"type": "VTL",
|
|
133
|
+
"value": "true"
|
|
134
|
+
},
|
|
135
|
+
"id": "ksyjs7vy",
|
|
136
|
+
"page": "4",
|
|
137
|
+
"label": {
|
|
138
|
+
"type": "VTL|MD",
|
|
139
|
+
"value": "\"END\""
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"pagination": "question",
|
|
144
|
+
"lunaticModelVersion": "2.3.2-rc4",
|
|
145
|
+
"modele": "TESTSURSUM",
|
|
146
|
+
"enoCoreVersion": "2.4.1-pairwise",
|
|
147
|
+
"generatingDate": "14-04-2023 09:00:09",
|
|
148
|
+
"missing": false,
|
|
149
|
+
"id": "lb3ei722",
|
|
150
|
+
"maxPage": "4"
|
|
151
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _orchestrator = _interopRequireDefault(require("../../utils/orchestrator"));
|
|
9
|
+
var _source = _interopRequireDefault(require("./source.json"));
|
|
10
|
+
var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-types"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
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); }
|
|
19
|
+
var stories = {
|
|
20
|
+
title: 'Behaviour/Cleaning',
|
|
21
|
+
component: _orchestrator["default"],
|
|
22
|
+
argTypes: _objectSpread(_objectSpread({}, _defaultArgTypes["default"]), {}, {
|
|
23
|
+
missing: {
|
|
24
|
+
table: {
|
|
25
|
+
disable: false
|
|
26
|
+
},
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
defaultValue: true
|
|
29
|
+
},
|
|
30
|
+
activeGoNextForMissing: {
|
|
31
|
+
table: {
|
|
32
|
+
disable: false
|
|
33
|
+
},
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
defaultValue: true
|
|
36
|
+
},
|
|
37
|
+
management: {
|
|
38
|
+
table: {
|
|
39
|
+
disable: false
|
|
40
|
+
},
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
defaultValue: false
|
|
43
|
+
},
|
|
44
|
+
activeControls: {
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
defaultValue: true
|
|
47
|
+
},
|
|
48
|
+
source: {
|
|
49
|
+
table: {
|
|
50
|
+
disable: false
|
|
51
|
+
},
|
|
52
|
+
control: {
|
|
53
|
+
type: 'object'
|
|
54
|
+
},
|
|
55
|
+
defaultValue: _source["default"]
|
|
56
|
+
},
|
|
57
|
+
data: {
|
|
58
|
+
table: {
|
|
59
|
+
disable: false
|
|
60
|
+
},
|
|
61
|
+
control: {
|
|
62
|
+
type: 'object'
|
|
63
|
+
},
|
|
64
|
+
defaultValue: {
|
|
65
|
+
COLLECTED: {
|
|
66
|
+
READY: {
|
|
67
|
+
COLLECTED: true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
var _default = stories;
|
|
75
|
+
exports["default"] = _default;
|
|
76
|
+
var Template = function Template(args) {
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_orchestrator["default"], _objectSpread({}, args));
|
|
78
|
+
};
|
|
79
|
+
var Default = Template.bind({});
|
|
80
|
+
exports.Default = Default;
|
|
81
|
+
Default.args = {
|
|
82
|
+
id: 'resizing-default',
|
|
83
|
+
pagination: true
|
|
84
|
+
};
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = exports.SimpleNum = exports.Simple = exports.LinkedLoop2 = exports.LinkedLoop = exports.BoucleN = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _orchestrator = _interopRequireDefault(require("../../utils/orchestrator"));
|
|
9
|
-
var _V2_ControlesNonNum_horsBoucle_PasPageFin = _interopRequireDefault(require("./V2_ControlesNonNum_horsBoucle_PasPageFin"));
|
|
10
|
-
var _V2_ControlesNum_horsBoucle_PasPageFin = _interopRequireDefault(require("./V2_ControlesNum_horsBoucle_PasPageFin"));
|
|
11
|
-
var _V2_Controles_BouclesLiees_PasPageFin = _interopRequireDefault(require("./V2_Controles_BouclesLiees_PasPageFin"));
|
|
12
|
-
var _V2_Controles_BouclesLiees2_PasPageFin = _interopRequireDefault(require("./V2_Controles_BouclesLiees2_PasPageFin"));
|
|
9
|
+
var _V2_ControlesNonNum_horsBoucle_PasPageFin = _interopRequireDefault(require("./V2_ControlesNonNum_horsBoucle_PasPageFin.json"));
|
|
10
|
+
var _V2_ControlesNum_horsBoucle_PasPageFin = _interopRequireDefault(require("./V2_ControlesNum_horsBoucle_PasPageFin.json"));
|
|
11
|
+
var _V2_Controles_BouclesLiees_PasPageFin = _interopRequireDefault(require("./V2_Controles_BouclesLiees_PasPageFin.json"));
|
|
12
|
+
var _V2_Controles_BouclesLiees2_PasPageFin = _interopRequireDefault(require("./V2_Controles_BouclesLiees2_PasPageFin.json"));
|
|
13
13
|
var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-types"));
|
|
14
|
-
var _bouclesN = _interopRequireDefault(require("./boucles-n"));
|
|
14
|
+
var _bouclesN = _interopRequireDefault(require("./boucles-n.json"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
17
|
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); }
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.TestDylan = exports.SimpleLoops = exports.RallyeGames = exports.MinMaxLoops = exports.DeclarationsSimples = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _orchestrator = _interopRequireDefault(require("
|
|
9
|
-
var _testDylan = _interopRequireDefault(require("./test-dylan"));
|
|
10
|
-
var _V2_MinMaxSum_Boucles = _interopRequireDefault(require("./V2_MinMaxSum_Boucles"));
|
|
11
|
-
var _V2_QuestSimple_Boucles = _interopRequireDefault(require("./V2_QuestSimple_Boucles"));
|
|
12
|
-
var _V2_TCMRallyeGames = _interopRequireDefault(require("./V2_TCMRallyeGames"));
|
|
13
|
-
var _V2_DeclarationsSimples = _interopRequireDefault(require("./V2_DeclarationsSimples"));
|
|
14
|
-
var _defaultArgTypes = _interopRequireDefault(require("
|
|
8
|
+
var _orchestrator = _interopRequireDefault(require("../../utils/orchestrator"));
|
|
9
|
+
var _testDylan = _interopRequireDefault(require("./test-dylan.json"));
|
|
10
|
+
var _V2_MinMaxSum_Boucles = _interopRequireDefault(require("./V2_MinMaxSum_Boucles.json"));
|
|
11
|
+
var _V2_QuestSimple_Boucles = _interopRequireDefault(require("./V2_QuestSimple_Boucles.json"));
|
|
12
|
+
var _V2_TCMRallyeGames = _interopRequireDefault(require("./V2_TCMRallyeGames.json"));
|
|
13
|
+
var _V2_DeclarationsSimples = _interopRequireDefault(require("./V2_DeclarationsSimples.json"));
|
|
14
|
+
var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-types"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
17
|
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); }
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.Default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _orchestrator = _interopRequireDefault(require("
|
|
9
|
-
var _source = _interopRequireDefault(require("./source"));
|
|
10
|
-
var _defaultArgTypes = _interopRequireDefault(require("
|
|
8
|
+
var _orchestrator = _interopRequireDefault(require("../../utils/orchestrator"));
|
|
9
|
+
var _source = _interopRequireDefault(require("./source.json"));
|
|
10
|
+
var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-types"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
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); }
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.Default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _orchestrator = _interopRequireDefault(require("
|
|
9
|
-
var _source = _interopRequireDefault(require("./source"));
|
|
10
|
-
var _defaultArgTypes = _interopRequireDefault(require("
|
|
8
|
+
var _orchestrator = _interopRequireDefault(require("../../utils/orchestrator"));
|
|
9
|
+
var _source = _interopRequireDefault(require("./source.json"));
|
|
10
|
+
var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-types"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
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); }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fillComponentRequired = fillComponentRequired;
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
13
|
+
/**
|
|
14
|
+
* Add required attribute on component that are mandatory
|
|
15
|
+
*/
|
|
16
|
+
function fillComponentRequired(component) {
|
|
17
|
+
if (component.mandatory) {
|
|
18
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
19
|
+
required: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return component;
|
|
23
|
+
}
|
|
@@ -11,6 +11,7 @@ var _fillManagement = _interopRequireDefault(require("./fill-management"));
|
|
|
11
11
|
var _fillMissingResponse = _interopRequireDefault(require("./fill-missing-response"));
|
|
12
12
|
var _fillPagination = _interopRequireDefault(require("./fill-pagination"));
|
|
13
13
|
var _fillSpecificExpression = _interopRequireDefault(require("./fill-specific-expression"));
|
|
14
|
+
var _fillComponentRequired = require("./fill-component-required");
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
16
|
/**
|
|
16
17
|
* Compose multiple methods together to create a new method
|
|
@@ -35,7 +36,7 @@ function compose() {
|
|
|
35
36
|
*
|
|
36
37
|
* Force typing for this function since it's doo dynamic
|
|
37
38
|
*/
|
|
38
|
-
var fillComponent = compose(_fillFromState["default"], _fillComponentExpressions["default"], _fillPagination["default"], _fillComponentValue["default"], _fillMissingResponse["default"], _fillManagement["default"], _fillSpecificExpression["default"]);
|
|
39
|
+
var fillComponent = compose(_fillFromState["default"], _fillComponentExpressions["default"], _fillPagination["default"], _fillComponentValue["default"], _fillMissingResponse["default"], _fillComponentRequired.fillComponentRequired, _fillManagement["default"], _fillSpecificExpression["default"]);
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Fill components with values coming from the state, and interpret VTL expression
|
|
@@ -20,6 +20,7 @@ function fillFromState(component, state) {
|
|
|
20
20
|
goToPage = state.goToPage,
|
|
21
21
|
shortcut = state.shortcut,
|
|
22
22
|
getSuggesterStatus = state.getSuggesterStatus,
|
|
23
|
+
workersBasePath = state.workersBasePath,
|
|
23
24
|
goNextPage = state.goNextPage,
|
|
24
25
|
goPreviousPage = state.goPreviousPage;
|
|
25
26
|
return _objectSpread(_objectSpread({}, component), {}, {
|
|
@@ -29,6 +30,7 @@ function fillFromState(component, state) {
|
|
|
29
30
|
goToPage: goToPage,
|
|
30
31
|
shortcut: shortcut,
|
|
31
32
|
getSuggesterStatus: getSuggesterStatus,
|
|
33
|
+
workersBasePath: workersBasePath,
|
|
32
34
|
goNextPage: goNextPage,
|
|
33
35
|
goPreviousPage: goPreviousPage
|
|
34
36
|
});
|
|
@@ -25,10 +25,16 @@ function reduceCleaning(state, action) {
|
|
|
25
25
|
var response = action.payload.response;
|
|
26
26
|
var executeExpression = state.executeExpression,
|
|
27
27
|
cleaning = state.cleaning,
|
|
28
|
-
updateBindings = state.updateBindings,
|
|
29
28
|
variables = state.variables,
|
|
30
29
|
pager = state.pager;
|
|
31
30
|
var iteration = pager.iteration;
|
|
31
|
+
var updateBindings = function updateBindings(variableName, newValue) {
|
|
32
|
+
var _action$payload$args, _action$payload$args$;
|
|
33
|
+
state.updateBindings(variableName, newValue);
|
|
34
|
+
(_action$payload$args = action.payload.args) === null || _action$payload$args === void 0 || (_action$payload$args$ = _action$payload$args.onChange) === null || _action$payload$args$ === void 0 ? void 0 : _action$payload$args$.call(_action$payload$args, {
|
|
35
|
+
name: variableName
|
|
36
|
+
}, newValue, action.payload.args);
|
|
37
|
+
};
|
|
32
38
|
if (!response || !(response.name in cleaning)) {
|
|
33
39
|
return state;
|
|
34
40
|
}
|
|
@@ -75,10 +75,18 @@ function reduceResizingLinksVariables(_ref2) {
|
|
|
75
75
|
return {};
|
|
76
76
|
}
|
|
77
77
|
function reduceResizing(state, action) {
|
|
78
|
+
var _action$payload$args;
|
|
78
79
|
var name = action.payload.response.name;
|
|
80
|
+
var onChange = (_action$payload$args = action.payload.args) === null || _action$payload$args === void 0 ? void 0 : _action$payload$args.onChange;
|
|
79
81
|
var resizing = state.resizing,
|
|
80
|
-
variables = state.variables
|
|
81
|
-
|
|
82
|
+
variables = state.variables;
|
|
83
|
+
var updateBindings = function updateBindings(variableName, newValue) {
|
|
84
|
+
var _action$payload$args2, _action$payload$args3;
|
|
85
|
+
state.updateBindings(variableName, newValue);
|
|
86
|
+
(_action$payload$args2 = action.payload.args) === null || _action$payload$args2 === void 0 || (_action$payload$args3 = _action$payload$args2.onChange) === null || _action$payload$args3 === void 0 ? void 0 : _action$payload$args3.call(_action$payload$args2, {
|
|
87
|
+
name: variableName
|
|
88
|
+
}, newValue, action.payload.args);
|
|
89
|
+
};
|
|
82
90
|
if (name in resizing) {
|
|
83
91
|
var _resizing$name = resizing[name],
|
|
84
92
|
size = _resizing$name.size,
|
|
@@ -98,7 +106,8 @@ function reduceResizing(state, action) {
|
|
|
98
106
|
variableArray: variableArray,
|
|
99
107
|
variables: variables,
|
|
100
108
|
executeExpression: executeExpression,
|
|
101
|
-
updateBindings: updateBindings
|
|
109
|
+
updateBindings: updateBindings,
|
|
110
|
+
onChange: onChange
|
|
102
111
|
});
|
|
103
112
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
104
113
|
variables: _objectSpread(_objectSpread(_objectSpread({}, variables), newLinksVariables), newVariables)
|
|
@@ -181,7 +181,8 @@ function reduceOnInit(state, action) {
|
|
|
181
181
|
activeControls = payload.activeControls,
|
|
182
182
|
goToPage = payload.goToPage,
|
|
183
183
|
goNextPage = payload.goNextPage,
|
|
184
|
-
goPreviousPage = payload.goPreviousPage
|
|
184
|
+
goPreviousPage = payload.goPreviousPage,
|
|
185
|
+
workersBasePath = payload.workersBasePath;
|
|
185
186
|
if (source && data) {
|
|
186
187
|
var _initialPager$page;
|
|
187
188
|
var variables = createVariables(source, data); // map des variables
|
|
@@ -229,7 +230,8 @@ function reduceOnInit(state, action) {
|
|
|
229
230
|
goToPage: goToPage,
|
|
230
231
|
goNextPage: goNextPage,
|
|
231
232
|
goPreviousPage: goPreviousPage,
|
|
232
|
-
shortcut: shortcut
|
|
233
|
+
shortcut: shortcut,
|
|
234
|
+
workersBasePath: workersBasePath
|
|
233
235
|
}), initialPager);
|
|
234
236
|
}
|
|
235
237
|
return state;
|
|
@@ -10,17 +10,22 @@ var actions = _interopRequireWildcard(require("./actions"));
|
|
|
10
10
|
var _commons = require("./commons");
|
|
11
11
|
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
12
12
|
var _constants = require("../utils/constants");
|
|
13
|
-
var _getData = require("./commons/get-data");
|
|
14
|
-
var _initialState = _interopRequireDefault(require("./initial-state"));
|
|
15
|
-
var _lunaticContext = require("./lunatic-context");
|
|
16
13
|
var _compileControls = _interopRequireDefault(require("./commons/compile-controls"));
|
|
14
|
+
var _getData = require("./commons/get-data");
|
|
17
15
|
var _getOverview = require("./commons/getOverview");
|
|
18
16
|
var _useLoopVariables = require("./hooks/use-loop-variables");
|
|
17
|
+
var _initialState = _interopRequireDefault(require("./initial-state"));
|
|
18
|
+
var _lunaticContext = require("./lunatic-context");
|
|
19
19
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
20
20
|
var _useSuggesters = require("./use-suggesters");
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
22
22
|
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); }
|
|
23
23
|
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; }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
28
|
+
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); }
|
|
24
29
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
30
|
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."); }
|
|
26
31
|
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); }
|
|
@@ -76,7 +81,9 @@ function useLunatic(source) {
|
|
|
76
81
|
_ref$dontKnowButton = _ref.dontKnowButton,
|
|
77
82
|
dontKnowButton = _ref$dontKnowButton === void 0 ? DEFAULT_DONT_KNOW : _ref$dontKnowButton,
|
|
78
83
|
_ref$refusedButton = _ref.refusedButton,
|
|
79
|
-
refusedButton = _ref$refusedButton === void 0 ? DEFAULT_REFUSED : _ref$refusedButton
|
|
84
|
+
refusedButton = _ref$refusedButton === void 0 ? DEFAULT_REFUSED : _ref$refusedButton,
|
|
85
|
+
_ref$workersBasePath = _ref.workersBasePath,
|
|
86
|
+
workersBasePath = _ref$workersBasePath === void 0 ? undefined : _ref$workersBasePath;
|
|
80
87
|
var _useReducer = (0, _react.useReducer)(_reducer["default"], _initialState["default"]),
|
|
81
88
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
82
89
|
state = _useReducer2[0],
|
|
@@ -106,7 +113,8 @@ function useLunatic(source) {
|
|
|
106
113
|
var getSuggesterStatus = (0, _useSuggesters.useSuggesters)({
|
|
107
114
|
auto: autoSuggesterLoading,
|
|
108
115
|
getReferentiel: getReferentiel,
|
|
109
|
-
suggesters: suggesters
|
|
116
|
+
suggesters: suggesters,
|
|
117
|
+
workersBasePath: workersBasePath
|
|
110
118
|
});
|
|
111
119
|
var compileControls = (0, _react.useCallback)(function () {
|
|
112
120
|
return (0, _compileControls["default"])({
|
|
@@ -148,7 +156,9 @@ function useLunatic(source) {
|
|
|
148
156
|
var handleChange = (0, _react.useCallback)(function (response, value, args) {
|
|
149
157
|
dispatch(actions.handleChange(typeof response === 'string' ? {
|
|
150
158
|
name: response
|
|
151
|
-
} : response, value, args)
|
|
159
|
+
} : response, value, _objectSpread(_objectSpread({}, args), {}, {
|
|
160
|
+
onChange: onChange
|
|
161
|
+
})));
|
|
152
162
|
onChange(response, value, args);
|
|
153
163
|
}, [dispatch, onChange]);
|
|
154
164
|
var getData = function getData(withRefreshedCalculated) {
|
|
@@ -181,9 +191,10 @@ function useLunatic(source) {
|
|
|
181
191
|
goToPage: goToPage,
|
|
182
192
|
goNextPage: goNextPage,
|
|
183
193
|
goPreviousPage: goPreviousPage,
|
|
184
|
-
withOverview: withOverview
|
|
194
|
+
withOverview: withOverview,
|
|
195
|
+
workersBasePath: workersBasePath
|
|
185
196
|
}));
|
|
186
|
-
}, [source, data, initialPage, features, preferences, savingType, management, shortcut, handleChange, activeControls, withOverview, goToPage, goNextPage, goPreviousPage, lastReachedPage]);
|
|
197
|
+
}, [source, data, initialPage, features, preferences, savingType, management, shortcut, handleChange, activeControls, withOverview, goToPage, goNextPage, goPreviousPage, lastReachedPage, workersBasePath]);
|
|
187
198
|
(0, _react.useEffect)(function () {
|
|
188
199
|
dispatch(actions.updateState({
|
|
189
200
|
getSuggesterStatus: getSuggesterStatus
|
|
@@ -7,6 +7,7 @@ var _source = _interopRequireDefault(require("../stories/overview/source.json"))
|
|
|
7
7
|
var _source2 = _interopRequireDefault(require("../stories/questionnaires/logement/source.json"));
|
|
8
8
|
var _source3 = _interopRequireDefault(require("../stories/questionnaires/simpsons/source.json"));
|
|
9
9
|
var _source4 = _interopRequireDefault(require("../stories/component-set/source.json"));
|
|
10
|
+
var _source5 = _interopRequireDefault(require("../stories/behaviour/cleaning/source.json"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
12
|
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); }
|
|
12
13
|
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; }
|
|
@@ -168,12 +169,43 @@ var dataFromObject = function dataFromObject(o) {
|
|
|
168
169
|
});
|
|
169
170
|
});
|
|
170
171
|
});
|
|
172
|
+
(0, _vitest.describe)('cleaning', function () {
|
|
173
|
+
(0, _vitest.it)('should call handleChange on cleaned variable', function () {
|
|
174
|
+
var spy = _vitest.vi.fn();
|
|
175
|
+
var _renderHook10 = (0, _reactHooks.renderHook)(function () {
|
|
176
|
+
return (0, _useLunatic["default"])(_source5["default"], undefined, {
|
|
177
|
+
onChange: spy
|
|
178
|
+
});
|
|
179
|
+
}),
|
|
180
|
+
result = _renderHook10.result;
|
|
181
|
+
result.current.onChange({
|
|
182
|
+
name: 'ORIGIN'
|
|
183
|
+
}, 'FR');
|
|
184
|
+
(0, _vitest.expect)(spy).toHaveBeenCalledTimes(1);
|
|
185
|
+
(0, _vitest.expect)(spy.mock.calls[0][0]).toEqual({
|
|
186
|
+
name: 'ORIGIN'
|
|
187
|
+
});
|
|
188
|
+
(0, _vitest.expect)(spy.mock.calls[0][1]).toEqual('FR');
|
|
189
|
+
result.current.onChange({
|
|
190
|
+
name: 'ORIGIN'
|
|
191
|
+
}, 'US');
|
|
192
|
+
(0, _vitest.expect)(spy).toHaveBeenCalledTimes(3);
|
|
193
|
+
(0, _vitest.expect)(spy.mock.calls[1][0]).toEqual({
|
|
194
|
+
name: 'CITY'
|
|
195
|
+
});
|
|
196
|
+
(0, _vitest.expect)(spy.mock.calls[1][1]).toEqual(null);
|
|
197
|
+
(0, _vitest.expect)(spy.mock.calls[2][0]).toEqual({
|
|
198
|
+
name: 'ORIGIN'
|
|
199
|
+
});
|
|
200
|
+
(0, _vitest.expect)(spy.mock.calls[2][1]).toEqual('US');
|
|
201
|
+
});
|
|
202
|
+
});
|
|
171
203
|
(0, _vitest.describe)('getComponents()', function () {
|
|
172
204
|
(0, _vitest.describe)('componentSet', function () {
|
|
173
|
-
var
|
|
205
|
+
var _renderHook11 = (0, _reactHooks.renderHook)(function () {
|
|
174
206
|
return (0, _useLunatic["default"])(_source4["default"], undefined, {});
|
|
175
207
|
}),
|
|
176
|
-
result =
|
|
208
|
+
result = _renderHook11.result;
|
|
177
209
|
var getComponents = function getComponents() {
|
|
178
210
|
return result.current.getComponents();
|
|
179
211
|
};
|
|
@@ -45,7 +45,8 @@ function setStatus(status, name, state) {
|
|
|
45
45
|
function useSuggesters(_ref) {
|
|
46
46
|
var auto = _ref.auto,
|
|
47
47
|
getReferentiel = _ref.getReferentiel,
|
|
48
|
-
suggesters = _ref.suggesters
|
|
48
|
+
suggesters = _ref.suggesters,
|
|
49
|
+
workersBasePath = _ref.workersBasePath;
|
|
49
50
|
var status = (0, _react.useRef)();
|
|
50
51
|
var _useState = (0, _react.useState)(Date.now()),
|
|
51
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -118,7 +119,7 @@ function useSuggesters(_ref) {
|
|
|
118
119
|
return getReferentiel(name);
|
|
119
120
|
case 10:
|
|
120
121
|
data = _context.sent;
|
|
121
|
-
_createAppendTask = (0, _createAppendTask3.createAppendTask)(store, 1, nothing), _createAppendTask2 = _slicedToArray(_createAppendTask, 2), append = _createAppendTask2[0], abort = _createAppendTask2[1];
|
|
122
|
+
_createAppendTask = (0, _createAppendTask3.createAppendTask)(store, 1, nothing, workersBasePath), _createAppendTask2 = _slicedToArray(_createAppendTask, 2), append = _createAppendTask2[0], abort = _createAppendTask2[1];
|
|
122
123
|
aborts.push(abort);
|
|
123
124
|
_context.next = 15;
|
|
124
125
|
return append(data);
|
|
@@ -153,6 +154,6 @@ function useSuggesters(_ref) {
|
|
|
153
154
|
});
|
|
154
155
|
};
|
|
155
156
|
}
|
|
156
|
-
}, [suggesters, auto, getReferentiel, status]);
|
|
157
|
+
}, [suggesters, auto, getReferentiel, status, workersBasePath]);
|
|
157
158
|
return getSuggesterStatus;
|
|
158
159
|
}
|