@inseefr/lunatic 0.3.0-experimental → 0.3.4-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.
- package/lib/index.js +218 -260
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/component-wrapper/controls/validators/datepicker.js +25 -14
- package/src/components/component-wrapper/missing/component.js +37 -17
- package/src/components/datepicker/component.js +8 -12
- package/src/components/declarations/wrappers/input-declarations-wrapper.js +31 -9
- package/src/components/dropdown/commons/components/dropdown.js +21 -0
- package/src/components/dropdown/dropdown-edit/dropdown-edit.js +4 -1
- package/src/components/dropdown/dropdown-simple/dropdown.js +3 -1
- package/src/components/input/input-number.js +2 -1
- package/src/components/loop-constructor/block/index.js +1 -1
- package/src/components/loop-constructor/index.js +1 -1
- package/src/components/loop-constructor/roster/index.js +1 -1
- package/src/components/loop-constructor/wrapper/body-component.js +3 -0
- package/src/components/loop-constructor/wrapper/build-components.js +33 -33
- package/src/components/loop-constructor/wrapper/index.js +1 -1
- package/src/components/suggester/components/panel/option-container.js +1 -1
- package/src/components/suggester/components/suggester-content.js +42 -42
- package/src/components/suggester/components/suggester.js +43 -3
- package/src/components/suggester/idb-suggester.js +7 -1
- package/src/components/suggester/lunatic-suggester.js +1 -0
- package/src/components/suggester/suggester-wrapper.js +9 -3
- package/src/components/table/table.js +3 -1
- package/src/stories/loop-constructor/README.md +27 -27
- package/src/stories/loop-constructor/data-input-forced.json +64 -64
- package/src/stories/loop-constructor/data-input.json +100 -100
- package/src/stories/loop-constructor/data-loop-forced.json +66 -66
- package/src/stories/loop-constructor/data-loop-static-forced.json +66 -66
- package/src/stories/loop-constructor/data-loop-static.json +81 -81
- package/src/stories/loop-constructor/data-loop.json +81 -81
- package/src/stories/loop-constructor/data-roster-forced.json +68 -68
- package/src/stories/loop-constructor/data-roster.json +83 -83
- package/src/stories/loop-constructor/loop-constructor.stories.js +180 -180
- package/src/stories/questionnaire/arithmetic-management.json +47 -0
- package/src/stories/questionnaire/logement-queen.json +23389 -22705
- package/src/stories/questionnaire/logement-s2.json +46027 -44536
- package/src/stories/questionnaire/questionnaire.stories.js +46 -13
- package/src/stories/questionnaire/update-external/data.json +1 -0
- package/src/stories/questionnaire/update-external/questionnaire.json +75 -0
- package/src/stories/suggester/data.json +4 -1
- package/src/stories/suggester/suggester-workers.stories.js +4 -1
- package/src/stories/utils/orchestrator-split.js +119 -0
- package/src/stories/utils/orchestrator.js +12 -3
- package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -158
- package/src/tests/utils/to-expose/state/state.spec.js +59 -59
- package/src/utils/lib/index.js +1 -0
- package/src/utils/lib/pagination/navigation/shared.js +5 -5
- package/src/utils/lib/splitting.js +142 -0
- package/src/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +4 -2
- package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.js → filter-accents.js} +2 -2
- package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.spec.js → filter-accents.spec.js} +1 -1
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +27 -1
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +10 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/index.js +1 -1
- package/src/utils/to-expose/handler.js +67 -28
- package/src/utils/to-expose/hooks/filter-components.js +106 -106
- package/src/utils/to-expose/hooks/index.js +2 -1
- package/src/utils/to-expose/hooks/lunatic-split.js +421 -0
- package/src/utils/to-expose/hooks/lunatic.js +39 -7
- package/src/utils/to-expose/index.js +11 -11
- package/src/utils/to-expose/state.js +23 -15
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"id": "k3ylzyo4",
|
|
5
|
-
"componentType": "RosterForLoop",
|
|
6
|
-
"mandatory": true,
|
|
7
|
-
"positioning": "HORIZONTAL",
|
|
8
|
-
"label": "\"Qui sont les personnes qui habitent dans votre logement ?\"",
|
|
9
|
-
"conditionFilter": { "value": "true" },
|
|
10
|
-
"bindingDependencies": ["PRENOM", "AGE"],
|
|
11
|
-
"lines": { "min": 1, "max": 3 },
|
|
12
|
-
"headers": [
|
|
13
|
-
{ "headerCell": true, "label": "Prénom" },
|
|
14
|
-
{ "headerCell": true, "label": "Age" }
|
|
15
|
-
],
|
|
16
|
-
"missingResponse": {
|
|
17
|
-
"name": "ROSTER_MISSING"
|
|
18
|
-
},
|
|
19
|
-
"components": [
|
|
20
|
-
{
|
|
21
|
-
"componentType": "Input",
|
|
22
|
-
"conditionFilter": { "value": "true" },
|
|
23
|
-
"maxLength": 30,
|
|
24
|
-
"bindingDependencies": ["PRENOM"],
|
|
25
|
-
"id": "k3yn2qmr",
|
|
26
|
-
"response": {
|
|
27
|
-
"name": "PRENOM"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"componentType": "InputNumber",
|
|
32
|
-
"conditionFilter": { "value": "true" },
|
|
33
|
-
"min": 0,
|
|
34
|
-
"max": 120,
|
|
35
|
-
"decimals": 0,
|
|
36
|
-
"bindingDependencies": ["AGE"],
|
|
37
|
-
"id": "k3ymundt",
|
|
38
|
-
"response": {
|
|
39
|
-
"name": "AGE"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"variables": [
|
|
46
|
-
{
|
|
47
|
-
"variableType": "COLLECTED",
|
|
48
|
-
"name": "PRENOM",
|
|
49
|
-
"componentRef": "k3ylzyo4",
|
|
50
|
-
"values": {
|
|
51
|
-
"PREVIOUS": [null],
|
|
52
|
-
"COLLECTED": [null],
|
|
53
|
-
"FORCED": [null],
|
|
54
|
-
"EDITED": [null],
|
|
55
|
-
"INPUTED": [null]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"variableType": "COLLECTED",
|
|
60
|
-
"name": "AGE",
|
|
61
|
-
"componentRef": "k3ylzyo4",
|
|
62
|
-
"values": {
|
|
63
|
-
"PREVIOUS": [null],
|
|
64
|
-
"COLLECTED": [null],
|
|
65
|
-
"FORCED": [null],
|
|
66
|
-
"EDITED": [null],
|
|
67
|
-
"INPUTED": [null]
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"variableType": "COLLECTED",
|
|
72
|
-
"name": "ROSTER_MISSING",
|
|
73
|
-
"componentRef": "k3ylzyo4",
|
|
74
|
-
"values": {
|
|
75
|
-
"PREVIOUS": null,
|
|
76
|
-
"COLLECTED": null,
|
|
77
|
-
"FORCED": null,
|
|
78
|
-
"EDITED": null,
|
|
79
|
-
"INPUTED": null
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "k3ylzyo4",
|
|
5
|
+
"componentType": "RosterForLoop",
|
|
6
|
+
"mandatory": true,
|
|
7
|
+
"positioning": "HORIZONTAL",
|
|
8
|
+
"label": "\"Qui sont les personnes qui habitent dans votre logement ?\"",
|
|
9
|
+
"conditionFilter": { "value": "true" },
|
|
10
|
+
"bindingDependencies": ["PRENOM", "AGE"],
|
|
11
|
+
"lines": { "min": 1, "max": 3 },
|
|
12
|
+
"headers": [
|
|
13
|
+
{ "headerCell": true, "label": "Prénom" },
|
|
14
|
+
{ "headerCell": true, "label": "Age" }
|
|
15
|
+
],
|
|
16
|
+
"missingResponse": {
|
|
17
|
+
"name": "ROSTER_MISSING"
|
|
18
|
+
},
|
|
19
|
+
"components": [
|
|
20
|
+
{
|
|
21
|
+
"componentType": "Input",
|
|
22
|
+
"conditionFilter": { "value": "true" },
|
|
23
|
+
"maxLength": 30,
|
|
24
|
+
"bindingDependencies": ["PRENOM"],
|
|
25
|
+
"id": "k3yn2qmr",
|
|
26
|
+
"response": {
|
|
27
|
+
"name": "PRENOM"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"componentType": "InputNumber",
|
|
32
|
+
"conditionFilter": { "value": "true" },
|
|
33
|
+
"min": 0,
|
|
34
|
+
"max": 120,
|
|
35
|
+
"decimals": 0,
|
|
36
|
+
"bindingDependencies": ["AGE"],
|
|
37
|
+
"id": "k3ymundt",
|
|
38
|
+
"response": {
|
|
39
|
+
"name": "AGE"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"variables": [
|
|
46
|
+
{
|
|
47
|
+
"variableType": "COLLECTED",
|
|
48
|
+
"name": "PRENOM",
|
|
49
|
+
"componentRef": "k3ylzyo4",
|
|
50
|
+
"values": {
|
|
51
|
+
"PREVIOUS": [null],
|
|
52
|
+
"COLLECTED": [null],
|
|
53
|
+
"FORCED": [null],
|
|
54
|
+
"EDITED": [null],
|
|
55
|
+
"INPUTED": [null]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"variableType": "COLLECTED",
|
|
60
|
+
"name": "AGE",
|
|
61
|
+
"componentRef": "k3ylzyo4",
|
|
62
|
+
"values": {
|
|
63
|
+
"PREVIOUS": [null],
|
|
64
|
+
"COLLECTED": [null],
|
|
65
|
+
"FORCED": [null],
|
|
66
|
+
"EDITED": [null],
|
|
67
|
+
"INPUTED": [null]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"variableType": "COLLECTED",
|
|
72
|
+
"name": "ROSTER_MISSING",
|
|
73
|
+
"componentRef": "k3ylzyo4",
|
|
74
|
+
"values": {
|
|
75
|
+
"PREVIOUS": null,
|
|
76
|
+
"COLLECTED": null,
|
|
77
|
+
"FORCED": null,
|
|
78
|
+
"EDITED": null,
|
|
79
|
+
"INPUTED": null
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
@@ -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
|
+
}
|