@inseefr/lunatic 0.3.1-experimental → 0.3.2-experimental

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.
Files changed (51) hide show
  1. package/lib/index.js +192 -189
  2. package/lib/index.js.map +1 -1
  3. package/package.json +2 -2
  4. package/src/components/component-wrapper/controls/validators/datepicker.js +25 -14
  5. package/src/components/component-wrapper/missing/component.js +37 -17
  6. package/src/components/datepicker/component.js +8 -12
  7. package/src/components/declarations/wrappers/input-declarations-wrapper.js +3 -2
  8. package/src/components/loop-constructor/block/index.js +1 -1
  9. package/src/components/loop-constructor/index.js +1 -1
  10. package/src/components/loop-constructor/roster/index.js +1 -1
  11. package/src/components/loop-constructor/wrapper/body-component.js +3 -0
  12. package/src/components/loop-constructor/wrapper/build-components.js +33 -33
  13. package/src/components/loop-constructor/wrapper/index.js +1 -1
  14. package/src/components/suggester/components/panel/option-container.js +1 -1
  15. package/src/components/suggester/suggester-wrapper.js +3 -3
  16. package/src/components/table/table.js +3 -1
  17. package/src/stories/loop-constructor/README.md +27 -27
  18. package/src/stories/loop-constructor/data-input-forced.json +64 -64
  19. package/src/stories/loop-constructor/data-input.json +100 -100
  20. package/src/stories/loop-constructor/data-loop-forced.json +66 -66
  21. package/src/stories/loop-constructor/data-loop-static-forced.json +66 -66
  22. package/src/stories/loop-constructor/data-loop-static.json +81 -81
  23. package/src/stories/loop-constructor/data-loop.json +81 -81
  24. package/src/stories/loop-constructor/data-roster-forced.json +68 -68
  25. package/src/stories/loop-constructor/data-roster.json +83 -83
  26. package/src/stories/loop-constructor/loop-constructor.stories.js +180 -180
  27. package/src/stories/questionnaire/arithmetic-management.json +47 -0
  28. package/src/stories/questionnaire/logement-queen.json +23390 -22706
  29. package/src/stories/questionnaire/questionnaire.stories.js +14 -14
  30. package/src/stories/suggester/data.json +4 -1
  31. package/src/stories/suggester/suggester-workers.stories.js +4 -1
  32. package/src/stories/utils/orchestrator-split.js +117 -0
  33. package/src/tests/utils/to-expose/handler/results/res-input-edited.json +1 -1
  34. package/src/tests/utils/to-expose/state/state.spec.js +59 -59
  35. package/src/utils/lib/index.js +1 -0
  36. package/src/utils/lib/pagination/navigation/shared.js +5 -5
  37. package/src/utils/lib/splitting.js +110 -0
  38. package/src/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +4 -2
  39. package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.js → filter-accents.js} +2 -2
  40. package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.spec.js → filter-accents.spec.js} +1 -1
  41. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +27 -1
  42. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +10 -0
  43. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +12 -0
  44. package/src/utils/suggester-workers/commons-tokenizer/index.js +1 -1
  45. package/src/utils/to-expose/handler.js +47 -28
  46. package/src/utils/to-expose/hooks/filter-components.js +106 -106
  47. package/src/utils/to-expose/hooks/index.js +2 -1
  48. package/src/utils/to-expose/hooks/lunatic-split.js +407 -0
  49. package/src/utils/to-expose/hooks/lunatic.js +16 -2
  50. package/src/utils/to-expose/index.js +11 -11
  51. package/src/utils/to-expose/state.js +23 -15
@@ -1,180 +1,180 @@
1
- import React, { useState } from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withReadme } from 'storybook-readme';
4
- import Orchestrator from '../utils/orchestrator';
5
- import readme from './README.md';
6
- import { titleDecorator } from 'utils/lib';
7
- import dataRoster from './data-roster';
8
- import dataRosterForced from './data-roster-forced';
9
- import dataLoop from './data-loop';
10
- import dataLoopForced from './data-loop-forced';
11
- import dataLoopStatic from './data-loop-static';
12
- import dataLoopStaticForced from './data-loop-static-forced';
13
- import dataInput from './data-input';
14
- import dataInputForced from './data-input-forced';
15
- import { positioningOptions } from '../utils/options';
16
- import { select, boolean } from '@storybook/addon-knobs/react';
17
-
18
- const storiesRoster = storiesOf('LoopConstructor/RosterForLoop', module)
19
- .addDecorator(withReadme(readme))
20
- .addDecorator((Component) => {
21
- const WrappedComponent = titleDecorator(Component);
22
- return <WrappedComponent title="RosterForLoop" />;
23
- });
24
-
25
- storiesRoster.addWithJSX('Default', () => (
26
- <Orchestrator
27
- id="default"
28
- source={dataRoster}
29
- missing={boolean('Missing', false)}
30
- positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
31
- features={['VTL']}
32
- />
33
- ));
34
-
35
- storiesRoster.addWithJSX('External update', () => {
36
- const Fake = () => {
37
- const [up, setUp] = useState(false);
38
- return (
39
- <>
40
- <button
41
- type="button"
42
- onClick={() => {
43
- setUp(true);
44
- }}
45
- disabled={up}
46
- >
47
- Force external update
48
- </button>
49
-
50
- <Orchestrator
51
- id="default"
52
- source={up ? dataRosterForced : dataRoster}
53
- features={['VTL']}
54
- />
55
- </>
56
- );
57
- };
58
- return <Fake />;
59
- });
60
-
61
- const storiesBlock = storiesOf('LoopConstructor/Loop', module)
62
- .addDecorator(withReadme(readme))
63
- .addDecorator((Component) => {
64
- const WrappedComponent = titleDecorator(Component);
65
- return <WrappedComponent title="Loop" />;
66
- });
67
-
68
- storiesBlock.addWithJSX('Default', () => (
69
- <Orchestrator
70
- id="default"
71
- source={dataLoop}
72
- missing={boolean('Missing', false)}
73
- positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
74
- features={['VTL']}
75
- />
76
- ));
77
-
78
- storiesBlock.addWithJSX('Default - External update', () => {
79
- const Fake = () => {
80
- const [up, setUp] = useState(false);
81
- return (
82
- <>
83
- <button
84
- type="button"
85
- onClick={() => {
86
- setUp(true);
87
- }}
88
- disabled={up}
89
- >
90
- Force external update
91
- </button>
92
-
93
- <Orchestrator
94
- id="default"
95
- source={up ? dataLoopForced : dataLoop}
96
- features={['VTL']}
97
- />
98
- </>
99
- );
100
- };
101
- return <Fake />;
102
- });
103
-
104
- storiesBlock.addWithJSX('Static', () => (
105
- <Orchestrator
106
- id="static"
107
- source={dataLoopStatic}
108
- positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
109
- features={['VTL']}
110
- />
111
- ));
112
-
113
- storiesBlock.addWithJSX('Static - External update', () => {
114
- const Fake = () => {
115
- const [up, setUp] = useState(false);
116
- return (
117
- <>
118
- <button
119
- type="button"
120
- onClick={() => {
121
- setUp(true);
122
- }}
123
- disabled={up}
124
- >
125
- Force external update
126
- </button>
127
-
128
- <Orchestrator
129
- id="default"
130
- source={up ? dataLoopStaticForced : dataLoopStatic}
131
- features={['VTL']}
132
- />
133
- </>
134
- );
135
- };
136
- return <Fake />;
137
- });
138
-
139
- const storiesInput = storiesOf('LoopConstructor/Input', module)
140
- .addDecorator(withReadme(readme))
141
- .addDecorator((Component) => {
142
- const WrappedComponent = titleDecorator(Component);
143
- return <WrappedComponent title="Loop" />;
144
- });
145
-
146
- storiesInput.addWithJSX('Default', () => (
147
- <Orchestrator
148
- id="default"
149
- source={dataInput}
150
- missing={boolean('Missing', false)}
151
- positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
152
- features={['VTL']}
153
- />
154
- ));
155
-
156
- storiesInput.addWithJSX('External update', () => {
157
- const Fake = () => {
158
- const [up, setUp] = useState(false);
159
- return (
160
- <>
161
- <button
162
- type="button"
163
- onClick={() => {
164
- setUp(true);
165
- }}
166
- disabled={up}
167
- >
168
- Force external update
169
- </button>
170
-
171
- <Orchestrator
172
- id="default"
173
- source={up ? dataInputForced : dataInput}
174
- features={['VTL']}
175
- />
176
- </>
177
- );
178
- };
179
- return <Fake />;
180
- });
1
+ import React, { useState } from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { withReadme } from 'storybook-readme';
4
+ import Orchestrator from '../utils/orchestrator';
5
+ import readme from './README.md';
6
+ import { titleDecorator } from 'utils/lib';
7
+ import dataRoster from './data-roster';
8
+ import dataRosterForced from './data-roster-forced';
9
+ import dataLoop from './data-loop';
10
+ import dataLoopForced from './data-loop-forced';
11
+ import dataLoopStatic from './data-loop-static';
12
+ import dataLoopStaticForced from './data-loop-static-forced';
13
+ import dataInput from './data-input';
14
+ import dataInputForced from './data-input-forced';
15
+ import { positioningOptions } from '../utils/options';
16
+ import { select, boolean } from '@storybook/addon-knobs/react';
17
+
18
+ const storiesRoster = storiesOf('LoopConstructor/RosterForLoop', module)
19
+ .addDecorator(withReadme(readme))
20
+ .addDecorator((Component) => {
21
+ const WrappedComponent = titleDecorator(Component);
22
+ return <WrappedComponent title="RosterForLoop" />;
23
+ });
24
+
25
+ storiesRoster.addWithJSX('Default', () => (
26
+ <Orchestrator
27
+ id="default"
28
+ source={dataRoster}
29
+ missing={boolean('Missing', false)}
30
+ positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
31
+ features={['VTL']}
32
+ />
33
+ ));
34
+
35
+ storiesRoster.addWithJSX('External update', () => {
36
+ const Fake = () => {
37
+ const [up, setUp] = useState(false);
38
+ return (
39
+ <>
40
+ <button
41
+ type="button"
42
+ onClick={() => {
43
+ setUp(true);
44
+ }}
45
+ disabled={up}
46
+ >
47
+ Force external update
48
+ </button>
49
+
50
+ <Orchestrator
51
+ id="default"
52
+ source={up ? dataRosterForced : dataRoster}
53
+ features={['VTL']}
54
+ />
55
+ </>
56
+ );
57
+ };
58
+ return <Fake />;
59
+ });
60
+
61
+ const storiesBlock = storiesOf('LoopConstructor/Loop', module)
62
+ .addDecorator(withReadme(readme))
63
+ .addDecorator((Component) => {
64
+ const WrappedComponent = titleDecorator(Component);
65
+ return <WrappedComponent title="Loop" />;
66
+ });
67
+
68
+ storiesBlock.addWithJSX('Default', () => (
69
+ <Orchestrator
70
+ id="default"
71
+ source={dataLoop}
72
+ missing={boolean('Missing', false)}
73
+ positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
74
+ features={['VTL']}
75
+ />
76
+ ));
77
+
78
+ storiesBlock.addWithJSX('Default - External update', () => {
79
+ const Fake = () => {
80
+ const [up, setUp] = useState(false);
81
+ return (
82
+ <>
83
+ <button
84
+ type="button"
85
+ onClick={() => {
86
+ setUp(true);
87
+ }}
88
+ disabled={up}
89
+ >
90
+ Force external update
91
+ </button>
92
+
93
+ <Orchestrator
94
+ id="default"
95
+ source={up ? dataLoopForced : dataLoop}
96
+ features={['VTL']}
97
+ />
98
+ </>
99
+ );
100
+ };
101
+ return <Fake />;
102
+ });
103
+
104
+ storiesBlock.addWithJSX('Static', () => (
105
+ <Orchestrator
106
+ id="static"
107
+ source={dataLoopStatic}
108
+ positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
109
+ features={['VTL']}
110
+ />
111
+ ));
112
+
113
+ storiesBlock.addWithJSX('Static - External update', () => {
114
+ const Fake = () => {
115
+ const [up, setUp] = useState(false);
116
+ return (
117
+ <>
118
+ <button
119
+ type="button"
120
+ onClick={() => {
121
+ setUp(true);
122
+ }}
123
+ disabled={up}
124
+ >
125
+ Force external update
126
+ </button>
127
+
128
+ <Orchestrator
129
+ id="default"
130
+ source={up ? dataLoopStaticForced : dataLoopStatic}
131
+ features={['VTL']}
132
+ />
133
+ </>
134
+ );
135
+ };
136
+ return <Fake />;
137
+ });
138
+
139
+ const storiesInput = storiesOf('LoopConstructor/Input', module)
140
+ .addDecorator(withReadme(readme))
141
+ .addDecorator((Component) => {
142
+ const WrappedComponent = titleDecorator(Component);
143
+ return <WrappedComponent title="Loop" />;
144
+ });
145
+
146
+ storiesInput.addWithJSX('Default', () => (
147
+ <Orchestrator
148
+ id="default"
149
+ source={dataInput}
150
+ missing={boolean('Missing', false)}
151
+ positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
152
+ features={['VTL']}
153
+ />
154
+ ));
155
+
156
+ storiesInput.addWithJSX('External update', () => {
157
+ const Fake = () => {
158
+ const [up, setUp] = useState(false);
159
+ return (
160
+ <>
161
+ <button
162
+ type="button"
163
+ onClick={() => {
164
+ setUp(true);
165
+ }}
166
+ disabled={up}
167
+ >
168
+ Force external update
169
+ </button>
170
+
171
+ <Orchestrator
172
+ id="default"
173
+ source={up ? dataInputForced : dataInput}
174
+ features={['VTL']}
175
+ />
176
+ </>
177
+ );
178
+ };
179
+ return <Fake />;
180
+ });
@@ -0,0 +1,47 @@
1
+ {
2
+ "components": [
3
+ {
4
+ "id": "A",
5
+ "componentType": "InputNumber",
6
+ "mandatory": false,
7
+ "min": 0,
8
+ "max": 120,
9
+ "decimals": 0,
10
+ "label": "\"How old are you?\"",
11
+ "conditionFilter": {
12
+ "value": "true"
13
+ },
14
+ "bindingDependencies": ["AGE"],
15
+ "response": { "name": "AGE" }
16
+ },
17
+ {
18
+ "id": "AA",
19
+ "componentType": "Subsequence",
20
+ "label": "\"Multiply age by 10: \" || AGE_10",
21
+ "conditionFilter": {
22
+ "value": "true"
23
+ },
24
+ "bindingDependencies": ["AGE_10"]
25
+ }
26
+ ],
27
+ "variables": [
28
+ {
29
+ "variableType": "COLLECTED",
30
+ "name": "AGE",
31
+ "componentRef": "A",
32
+ "values": {
33
+ "PREVIOUS": null,
34
+ "COLLECTED": "5",
35
+ "FORCED": null,
36
+ "EDITED": null,
37
+ "INPUTED": null
38
+ }
39
+ },
40
+ {
41
+ "variableType": "CALCULATED",
42
+ "name": "AGE_10",
43
+ "expression": "cast(cast(AGE, integer) * 10, string)",
44
+ "bindingDependencies": ["AGE"]
45
+ }
46
+ ]
47
+ }