@inseefr/lunatic 3.5.7 → 3.5.8
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/shared/Combobox/Combobox.stories.d.ts +3 -2
- package/components/shared/Combobox/Combobox.stories.js +26 -21
- package/components/shared/Combobox/Combobox.stories.js.map +1 -1
- package/esm/components/shared/Combobox/Combobox.stories.d.ts +3 -2
- package/esm/components/shared/Combobox/Combobox.stories.js +28 -24
- package/esm/components/shared/Combobox/Combobox.stories.js.map +1 -1
- package/esm/hooks/useLocalStorage.d.ts +1 -0
- package/esm/hooks/useLocalStorage.js +31 -0
- package/esm/hooks/useLocalStorage.js.map +1 -0
- package/esm/type.source.d.ts +6 -0
- package/esm/use-lunatic/commons/compile-controls.js +22 -14
- package/esm/use-lunatic/commons/compile-controls.js.map +1 -1
- package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js +4 -1
- package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
- package/esm/use-lunatic/hooks/use-page-has-response.js +1 -1
- package/esm/use-lunatic/hooks/use-page-has-response.js.map +1 -1
- package/esm/use-lunatic/hooks/useOverview.spec.js +2 -2
- package/esm/use-lunatic/hooks/useOverview.spec.js.map +1 -1
- package/esm/utils/number.d.ts +4 -0
- package/esm/utils/number.js +12 -0
- package/esm/utils/number.js.map +1 -1
- package/esm/utils/object.d.ts +10 -0
- package/esm/utils/object.js +26 -0
- package/esm/utils/object.js.map +1 -1
- package/hooks/useLocalStorage.d.ts +1 -0
- package/hooks/useLocalStorage.js +34 -0
- package/hooks/useLocalStorage.js.map +1 -0
- package/package.json +76 -137
- package/src/components/shared/Combobox/Combobox.stories.tsx +48 -49
- package/src/hooks/useLocalStorage.ts +37 -0
- package/src/json.d.ts +16 -0
- package/src/stories/accordion/accordion.stories.tsx +21 -0
- package/src/stories/behaviour/cleaning/cleaning.stories.tsx +40 -0
- package/src/stories/behaviour/controls/controls.stories.tsx +51 -0
- package/src/stories/behaviour/disabled/disabled.stories.tsx +29 -0
- package/src/stories/behaviour/filter/filter.stories.tsx +34 -0
- package/src/stories/behaviour/missing/missing.stories.tsx +31 -0
- package/src/stories/behaviour/overview/overview.stories.tsx +61 -0
- package/src/stories/{overview/sourceWithHierarchy.json → behaviour/overview/source.json} +1 -1
- package/src/stories/{overview → behaviour/overview}/sourceLoop.json +1 -1
- package/src/stories/behaviour/performance/performance.stories.tsx +29 -0
- package/src/stories/behaviour/resizing/resizing.stories.tsx +34 -0
- package/src/stories/behaviour/slots.stories.tsx +34 -0
- package/src/stories/checkbox/checkbox.stories.tsx +75 -0
- package/src/stories/{checkbox-group/sourceLoop.json → checkbox/sourceGroupLoop.json} +1 -1
- package/src/stories/datepicker/datepicker.stories.tsx +21 -0
- package/src/stories/declaration/declaration.stories.tsx +27 -0
- package/src/stories/dropdown/dropdown.stories.tsx +27 -0
- package/src/stories/duration/duration.stories.tsx +27 -0
- package/src/stories/filter-description/filter-description.stories.tsx +28 -0
- package/src/stories/input/input.stories.tsx +21 -0
- package/src/stories/input-number/input-number.stories.tsx +35 -0
- package/src/stories/loop/loop.stories.tsx +35 -0
- package/src/stories/loop/roster-for-loop.stories.tsx +59 -0
- package/src/stories/pairwise/pairwise.stories.tsx +30 -0
- package/src/stories/paste.stories.tsx +85 -0
- package/src/stories/question/question.stories.tsx +21 -0
- package/src/stories/questionnaires/logement/logement.stories.tsx +26 -0
- package/src/stories/questionnaires/recensement/recensement.stories.tsx +28 -0
- package/src/stories/questionnaires/rp/rp.stories.tsx +21 -0
- package/src/stories/questionnaires/simpsons/simpsons.stories.tsx +31 -0
- package/src/stories/radio/radio.stories.tsx +53 -0
- package/src/stories/roundabout/roundabout.stories.tsx +37 -0
- package/src/stories/roundabout/source.json +1 -0
- package/src/stories/sequence/sequence.stories.tsx +28 -0
- package/src/stories/suggester/source-option-responses.json +1 -1
- package/src/stories/suggester/suggester.stories.tsx +68 -0
- package/src/stories/summary/source.json +22 -1
- package/src/stories/summary/summary.stories.tsx +31 -0
- package/src/stories/table/table.stories.tsx +35 -0
- package/src/stories/text/text.stories.tsx +38 -0
- package/src/stories/textarea/textarea.stories.tsx +21 -0
- package/src/stories/utils/Orchestrator.tsx +310 -0
- package/src/stories/utils/OrchestratorData.tsx +176 -0
- package/src/stories/utils/OrchestratorOverview.tsx +70 -0
- package/src/stories/utils/OrchestratorSidebar.tsx +119 -0
- package/src/stories/utils/SchemaValidator.tsx +29 -0
- package/src/stories/utils/referentiel.ts +9 -0
- package/src/type.source.ts +6 -0
- package/src/use-lunatic/commons/compile-controls.ts +36 -18
- package/src/use-lunatic/commons/fill-components/fill-component-expressions.ts +4 -1
- package/src/use-lunatic/hooks/use-page-has-response.ts +1 -1
- package/src/use-lunatic/hooks/useOverview.spec.ts +3 -2
- package/src/use-lunatic/use-lunatic.test.ts +53 -40
- package/src/utils/number.ts +13 -0
- package/src/utils/object.ts +40 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.d.ts +6 -0
- package/use-lunatic/commons/compile-controls.js +21 -13
- package/use-lunatic/commons/compile-controls.js.map +1 -1
- package/use-lunatic/commons/fill-components/fill-component-expressions.js +5 -2
- package/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
- package/use-lunatic/hooks/use-page-has-response.js +2 -2
- package/use-lunatic/hooks/use-page-has-response.js.map +1 -1
- package/use-lunatic/hooks/useOverview.spec.js +8 -8
- package/use-lunatic/hooks/useOverview.spec.js.map +1 -1
- package/utils/number.d.ts +4 -0
- package/utils/number.js +13 -0
- package/utils/number.js.map +1 -1
- package/utils/object.d.ts +10 -0
- package/utils/object.js +30 -0
- package/utils/object.js.map +1 -1
- package/esm/stories/overview/sourceWithHierarchy.json +0 -5151
- package/esm/tests/utils/lunatic.d.ts +0 -15
- package/esm/tests/utils/lunatic.js +0 -27
- package/esm/tests/utils/lunatic.js.map +0 -1
- package/esm/use-lunatic/replace-component-sequence.d.ts +0 -36
- package/esm/use-lunatic/replace-component-sequence.js +0 -19
- package/esm/use-lunatic/replace-component-sequence.js.map +0 -1
- package/esm/use-lunatic/test.utils.d.ts +0 -2
- package/esm/use-lunatic/test.utils.js +0 -13
- package/esm/use-lunatic/test.utils.js.map +0 -1
- package/esm/utils/is-object.d.ts +0 -4
- package/esm/utils/is-object.js +0 -7
- package/esm/utils/is-object.js.map +0 -1
- package/esm/utils/to-number.d.ts +0 -4
- package/esm/utils/to-number.js +0 -13
- package/esm/utils/to-number.js.map +0 -1
- package/src/stories/accordion/accordion.stories.jsx +0 -17
- package/src/stories/behaviour/cleaning/cleaning.stories.jsx +0 -69
- package/src/stories/behaviour/controls/controls.stories.jsx +0 -81
- package/src/stories/behaviour/filter/dataLoop.json +0 -14
- package/src/stories/behaviour/filter/filter.stories.jsx +0 -36
- package/src/stories/behaviour/missing/missing.stories.jsx +0 -69
- package/src/stories/behaviour/others/V2_DeclarationsSimples.json +0 -908
- package/src/stories/behaviour/others/V2_MinMaxSum_Boucles.json +0 -489
- package/src/stories/behaviour/others/V2_QuestSimple_Boucles.json +0 -3919
- package/src/stories/behaviour/others/V2_TCMRallyeGames.json +0 -2760
- package/src/stories/behaviour/others/test-dylan.json +0 -538
- package/src/stories/behaviour/others/test.stories.jsx +0 -78
- package/src/stories/behaviour/paste/source.json +0 -32
- package/src/stories/behaviour/paste/test.stories.jsx +0 -62
- package/src/stories/behaviour/performance/performance.stories.jsx +0 -26
- package/src/stories/behaviour/resizing/resizing.stories.jsx +0 -60
- package/src/stories/behaviour/slots.stories.jsx +0 -32
- package/src/stories/checkbox-boolean/checkboxBoolean.stories.jsx +0 -17
- package/src/stories/checkbox-group/checkbox-group.stories.jsx +0 -77
- package/src/stories/checkbox-one/checkboxOne.stories.jsx +0 -53
- package/src/stories/date-picker/data.json +0 -3
- package/src/stories/date-picker/datepicker.stories.jsx +0 -26
- package/src/stories/declaration/data.json +0 -1
- package/src/stories/declaration/input.stories.jsx +0 -18
- package/src/stories/disabled/data.json +0 -16
- package/src/stories/disabled/disabled.stories.jsx +0 -18
- package/src/stories/dropdown/data.json +0 -8
- package/src/stories/dropdown/dropdown.stories.jsx +0 -25
- package/src/stories/duration/duration.stories.jsx +0 -25
- package/src/stories/filter-description/filter-description.stories.jsx +0 -37
- package/src/stories/input/data.json +0 -1
- package/src/stories/input/input.stories.jsx +0 -18
- package/src/stories/input-number/input-number.stories.jsx +0 -23
- package/src/stories/loop/loop.stories.jsx +0 -29
- package/src/stories/loop/roster-for-loop.stories.jsx +0 -46
- package/src/stories/markdown/markdown.stories.jsx +0 -20
- package/src/stories/overview/data.json +0 -1
- package/src/stories/overview/dataLoop.json +0 -93
- package/src/stories/overview/overview.stories.jsx +0 -44
- package/src/stories/overview/source.json +0 -25
- package/src/stories/pairwise/data.json +0 -12
- package/src/stories/pairwise/pairwise-links.stories.jsx +0 -48
- package/src/stories/question/question.stories.jsx +0 -16
- package/src/stories/questionnaires/logement/logement.stories.jsx +0 -59
- package/src/stories/questionnaires/recensement/data.json +0 -12
- package/src/stories/questionnaires/recensement/recensement.stories.jsx +0 -35
- package/src/stories/questionnaires/rp/data.json +0 -5
- package/src/stories/questionnaires/rp/rp.stories.jsx +0 -23
- package/src/stories/questionnaires/simpsons/simpsons.stories.jsx +0 -246
- package/src/stories/radio/radio.stories.jsx +0 -78
- package/src/stories/roundabout/data1.json +0 -13
- package/src/stories/roundabout/data2.json +0 -16
- package/src/stories/roundabout/roundabout.stories.jsx +0 -32
- package/src/stories/sequence/sequence.stories.jsx +0 -29
- package/src/stories/suggester/suggester.stories.jsx +0 -71
- package/src/stories/summary/data.json +0 -16
- package/src/stories/summary/summary.stories.jsx +0 -23
- package/src/stories/switch/README.md +0 -29
- package/src/stories/switch/data-forced.json +0 -40
- package/src/stories/switch/source.json +0 -64
- package/src/stories/switch/switch.stories.jsx +0 -17
- package/src/stories/table/data.json +0 -1
- package/src/stories/table/table.stories.jsx +0 -30
- package/src/stories/text/data-roster.json +0 -5
- package/src/stories/text/text.stories.jsx +0 -20
- package/src/stories/textarea/data.json +0 -1
- package/src/stories/textarea/textarea.stories.jsx +0 -18
- package/src/stories/utils/SchemaValidator.jsx +0 -40
- package/src/stories/utils/default-arg-types.js +0 -39
- package/src/stories/utils/default-args.js +0 -3
- package/src/stories/utils/options.js +0 -19
- package/src/stories/utils/orchestrator.jsx +0 -267
- package/src/stories/utils/orchestrator.scss +0 -66
- package/src/stories/utils/overview.jsx +0 -39
- package/src/stories/utils/overview.scss +0 -37
- package/src/stories/utils/referentiel.js +0 -7
- package/src/tests/utils/e2e.js +0 -91
- package/src/tests/utils/lunatic.ts +0 -33
- package/src/use-lunatic/replace-component-sequence.ts +0 -25
- package/src/use-lunatic/test.utils.ts +0 -17
- package/src/utils/is-object.ts +0 -6
- package/src/utils/to-number.ts +0 -12
- package/stories/overview/sourceWithHierarchy.json +0 -5151
- package/tests/utils/lunatic.d.ts +0 -15
- package/tests/utils/lunatic.js +0 -31
- package/tests/utils/lunatic.js.map +0 -1
- package/use-lunatic/replace-component-sequence.d.ts +0 -36
- package/use-lunatic/replace-component-sequence.js +0 -22
- package/use-lunatic/replace-component-sequence.js.map +0 -1
- package/use-lunatic/test.utils.d.ts +0 -2
- package/use-lunatic/test.utils.js +0 -17
- package/use-lunatic/test.utils.js.map +0 -1
- package/utils/is-object.d.ts +0 -4
- package/utils/is-object.js +0 -10
- package/utils/is-object.js.map +0 -1
- package/utils/to-number.d.ts +0 -4
- package/utils/to-number.js +0 -16
- package/utils/to-number.js.map +0 -1
- /package/src/stories/behaviour/cleaning/{loop.json → source-loop-scopes.json} +0 -0
- /package/src/stories/behaviour/controls/{boucles-n.json → source-boucles-n.json} +0 -0
- /package/src/stories/behaviour/controls/{loop.json → source-loop.json} +0 -0
- /package/src/stories/behaviour/controls/{roundabout.json → source-roundabout.json} +0 -0
- /package/src/stories/behaviour/controls/{simple-numeric.json → source-simple-numeric.json} +0 -0
- /package/src/stories/behaviour/controls/{simple.json → source-simple.json} +0 -0
- /package/src/stories/{disabled → behaviour/disabled}/source.json +0 -0
- /package/src/stories/{checkbox-boolean → checkbox}/source.json +0 -0
- /package/src/stories/{checkbox-group/source.json → checkbox/sourceGroup.json} +0 -0
- /package/src/stories/{checkbox-group/sourceCondition.json → checkbox/sourceGroupCondition.json} +0 -0
- /package/src/stories/{checkbox-group/sourceDetail.json → checkbox/sourceGroupDetail.json} +0 -0
- /package/src/stories/{checkbox-one/source.json → checkbox/sourceOne.json} +0 -0
- /package/src/stories/{checkbox-one/sourceDetail.json → checkbox/sourceOneDetail.json} +0 -0
- /package/src/stories/{date-picker → datepicker}/source.json +0 -0
- /package/src/stories/{markdown/source.json → declaration/sourceMarkdown.json} +0 -0
- /package/src/stories/duration/{mois.json → sourceMonths.json} +0 -0
- /package/src/stories/duration/{time.json → sourceTime.json} +0 -0
- /package/src/stories/filter-description/{source-options.json → sourceOptions.json} +0 -0
- /package/src/stories/table/{table-dynamique.json → source-dynamic.json} +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Orchestrator from '../utils/orchestrator';
|
|
3
|
-
import source from './source';
|
|
4
|
-
import sourceHorizontal from './sourceHorizontal';
|
|
5
|
-
import sourceDetail from './sourceDetail';
|
|
6
|
-
import sourceCondition from './sourceCondition';
|
|
7
|
-
import defaultArgs from '../utils/default-args';
|
|
8
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
9
|
-
|
|
10
|
-
const stories = {
|
|
11
|
-
title: 'Components/Radio',
|
|
12
|
-
component: Orchestrator,
|
|
13
|
-
args: {
|
|
14
|
-
...defaultArgs,
|
|
15
|
-
shortcut: true,
|
|
16
|
-
},
|
|
17
|
-
argTypes: {
|
|
18
|
-
...defaultArgTypes,
|
|
19
|
-
shortcut: {
|
|
20
|
-
table: { disable: false },
|
|
21
|
-
control: 'boolean',
|
|
22
|
-
defaultValue: true,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default stories;
|
|
28
|
-
|
|
29
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
30
|
-
export const Default = Template.bind({});
|
|
31
|
-
|
|
32
|
-
Default.args = {
|
|
33
|
-
...stories.args,
|
|
34
|
-
source,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const Condition = Template.bind({});
|
|
38
|
-
|
|
39
|
-
Condition.args = {
|
|
40
|
-
...Default.args,
|
|
41
|
-
source: sourceCondition,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const Horizontal = Template.bind({});
|
|
45
|
-
|
|
46
|
-
Horizontal.args = {
|
|
47
|
-
...Default.args,
|
|
48
|
-
source: sourceHorizontal,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const ReadOnly = Template.bind({});
|
|
52
|
-
|
|
53
|
-
ReadOnly.args = {
|
|
54
|
-
...Default.args,
|
|
55
|
-
source,
|
|
56
|
-
readOnly: true,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const WithDetail = Template.bind({});
|
|
60
|
-
|
|
61
|
-
WithDetail.args = {
|
|
62
|
-
...Default.argTypes,
|
|
63
|
-
source: sourceDetail,
|
|
64
|
-
detailAlwaysDisplayed: false,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
WithDetail.argTypes = {
|
|
68
|
-
...Default.argTypes,
|
|
69
|
-
detailAlwaysDisplayed: {
|
|
70
|
-
control: 'boolean',
|
|
71
|
-
defaultValue: false,
|
|
72
|
-
description: 'Always display detail options',
|
|
73
|
-
table: {
|
|
74
|
-
disable: false,
|
|
75
|
-
category: 'Components Options',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Orchestrator from '../utils/orchestrator';
|
|
2
|
-
import source from './source';
|
|
3
|
-
import data1 from './data1';
|
|
4
|
-
import data2 from './data2';
|
|
5
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
6
|
-
|
|
7
|
-
const stories = {
|
|
8
|
-
title: 'Components/Roundabout',
|
|
9
|
-
component: Orchestrator,
|
|
10
|
-
argTypes: defaultArgTypes,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default stories;
|
|
14
|
-
|
|
15
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
16
|
-
export const Default = Template.bind({});
|
|
17
|
-
|
|
18
|
-
Default.args = {
|
|
19
|
-
id: 'roundabout',
|
|
20
|
-
source,
|
|
21
|
-
pagination: true,
|
|
22
|
-
data: data2,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const OneIteration = Template.bind({});
|
|
26
|
-
|
|
27
|
-
OneIteration.args = {
|
|
28
|
-
id: 'roundabout-one-iteration',
|
|
29
|
-
source,
|
|
30
|
-
pagination: true,
|
|
31
|
-
data: data1,
|
|
32
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Orchestrator from '../utils/orchestrator';
|
|
3
|
-
import sourceDeclarations from './source-declarations.json';
|
|
4
|
-
import source from './source.json';
|
|
5
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
6
|
-
|
|
7
|
-
const stories = {
|
|
8
|
-
title: 'Components/Sequence',
|
|
9
|
-
component: Orchestrator,
|
|
10
|
-
argTypes: {
|
|
11
|
-
...defaultArgTypes,
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default stories;
|
|
16
|
-
|
|
17
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
18
|
-
|
|
19
|
-
export const Default = Template.bind({});
|
|
20
|
-
Default.args = {
|
|
21
|
-
id: 'sequence-simple',
|
|
22
|
-
source: source,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const WithDeclarations = Template.bind({});
|
|
26
|
-
WithDeclarations.args = {
|
|
27
|
-
id: 'sequence-Declarations',
|
|
28
|
-
source: sourceDeclarations,
|
|
29
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
3
|
-
import Orchestrator from '../utils/orchestrator';
|
|
4
|
-
import { getReferentiel } from '../utils/referentiel';
|
|
5
|
-
import source from './source';
|
|
6
|
-
import sourceOptionResponses from './source-option-responses';
|
|
7
|
-
import sourceArbitraryResponse from './source-arbitrary-response.json';
|
|
8
|
-
import sourceError from './source-error.json';
|
|
9
|
-
import sourceMultiline from './source-multiline.json';
|
|
10
|
-
|
|
11
|
-
const stories = {
|
|
12
|
-
title: 'Components/Suggester',
|
|
13
|
-
component: Orchestrator,
|
|
14
|
-
argTypes: defaultArgTypes,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default stories;
|
|
18
|
-
|
|
19
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
20
|
-
export const Default = Template.bind({});
|
|
21
|
-
|
|
22
|
-
const getFakeReferentiel = async (name) => {
|
|
23
|
-
try {
|
|
24
|
-
return (await import(`./fakeReferentiel.json`)).default;
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.log('error', error);
|
|
27
|
-
throw new Error(`Unknown référentiel ${name}`);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Default.args = {
|
|
32
|
-
id: 'suggester',
|
|
33
|
-
source,
|
|
34
|
-
autoSuggesterLoading: true,
|
|
35
|
-
getReferentiel,
|
|
36
|
-
pagination: true,
|
|
37
|
-
};
|
|
38
|
-
export const OptionResponses = Template.bind({});
|
|
39
|
-
OptionResponses.args = {
|
|
40
|
-
id: 'suggester-with-option',
|
|
41
|
-
source: sourceOptionResponses,
|
|
42
|
-
getReferentiel: getFakeReferentiel,
|
|
43
|
-
autoSuggesterLoading: true,
|
|
44
|
-
pagination: true,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const ArbitraryResponse = Template.bind({});
|
|
48
|
-
ArbitraryResponse.args = {
|
|
49
|
-
id: 'suggester-with-option',
|
|
50
|
-
source: sourceArbitraryResponse,
|
|
51
|
-
getReferentiel: getFakeReferentiel,
|
|
52
|
-
autoSuggesterLoading: true,
|
|
53
|
-
pagination: true,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const WithError = Template.bind({});
|
|
57
|
-
WithError.args = {
|
|
58
|
-
id: 'suggester-error',
|
|
59
|
-
source: sourceError,
|
|
60
|
-
getReferentiel: getFakeReferentiel,
|
|
61
|
-
autoSuggesterLoading: true,
|
|
62
|
-
pagination: true,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const MultiLine = Template.bind({});
|
|
66
|
-
MultiLine.args = {
|
|
67
|
-
source: sourceMultiline,
|
|
68
|
-
getReferentiel: getReferentiel,
|
|
69
|
-
autoSuggesterLoading: true,
|
|
70
|
-
pagination: true,
|
|
71
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Orchestrator from '../utils/orchestrator';
|
|
3
|
-
import source from './source';
|
|
4
|
-
import data from './data.json';
|
|
5
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
6
|
-
|
|
7
|
-
const stories = {
|
|
8
|
-
title: 'Components/Summary',
|
|
9
|
-
component: Orchestrator,
|
|
10
|
-
argTypes: defaultArgTypes,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default stories;
|
|
14
|
-
|
|
15
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
16
|
-
export const Default = Template.bind({});
|
|
17
|
-
|
|
18
|
-
Default.args = {
|
|
19
|
-
id: 'Summary',
|
|
20
|
-
source,
|
|
21
|
-
data,
|
|
22
|
-
pagination: true,
|
|
23
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# CheckboxOne component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :-------------: | :----: | :--------------------------------------: | :------: | --------------------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the checkbox |
|
|
8
|
-
| label | string | "" | | Fieldset label of the checkbox |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage checkbox response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| options \* | array | - | ✓ | Options of the checkbox |
|
|
12
|
-
| handleChange | func | - | ✓ | Handler of the checkbox |
|
|
13
|
-
| disabled | bool | false | | Is the checkbox options disabled |
|
|
14
|
-
| focused | bool | false | | Is the checkbox options focused |
|
|
15
|
-
| declarations \* | array | [] | | Declarations of the checkbox |
|
|
16
|
-
| features | array | [ ] | | Component features for labels |
|
|
17
|
-
| bindings | object | [ ] | | Questionnaire bindings |
|
|
18
|
-
| management | bool | false | | Management mode of the checkbox |
|
|
19
|
-
| style \* | object | { fieldsetStyle: {}, modalityStyle: {} } | | Style of the checkbox |
|
|
20
|
-
|
|
21
|
-
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
22
|
-
- `response` props has to be a shape of `{name: string, values: object}`
|
|
23
|
-
- `options` props has to be an array made by objects with a shape of `{label: string, value: string}`
|
|
24
|
-
- `declarations` are documented in the `Declarations` component
|
|
25
|
-
- `style` props has to be composed of `fieldsetStyle` and `modalityStyle`
|
|
26
|
-
|
|
27
|
-
## Styles
|
|
28
|
-
|
|
29
|
-
**CheckboxOne** component has for classes `checkbox-group-list`, `checkbox-modality` and `checkbox-lunatic`.
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"id": "1",
|
|
5
|
-
"componentType": "Switch",
|
|
6
|
-
"isMandatory": false,
|
|
7
|
-
"label": "➡ 1. Are you ready?",
|
|
8
|
-
"response": {
|
|
9
|
-
"name": "READY"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"id": "2",
|
|
14
|
-
"componentType": "Switch",
|
|
15
|
-
"isMandatory": false,
|
|
16
|
-
"label": "➡ 2. Are you always ready?",
|
|
17
|
-
"response": {
|
|
18
|
-
"name": "READY2"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"variables": [
|
|
23
|
-
{
|
|
24
|
-
"variableType": "COLLECTED",
|
|
25
|
-
"name": "READY",
|
|
26
|
-
"componentRef": "1",
|
|
27
|
-
"values": {
|
|
28
|
-
"COLLECTED": true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"variableType": "COLLECTED",
|
|
33
|
-
"name": "READY2",
|
|
34
|
-
"componentRef": "2",
|
|
35
|
-
"values": {
|
|
36
|
-
"COLLECTED": true
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"id": "1",
|
|
5
|
-
"componentType": "Switch",
|
|
6
|
-
"isMandatory": false,
|
|
7
|
-
"label": { "value": "\"➡ 1. Are you ready?\"", "type": "VTL|MD" },
|
|
8
|
-
"statusLabel": { "true": "Yes", "false": "No" },
|
|
9
|
-
"response": {
|
|
10
|
-
"name": "READY"
|
|
11
|
-
},
|
|
12
|
-
"missingResponse": {
|
|
13
|
-
"name": "READY_MISSING"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"id": "2",
|
|
18
|
-
"componentType": "Switch",
|
|
19
|
-
"isMandatory": false,
|
|
20
|
-
"label": { "value": "\"➡ 2. Are you always ready?\"", "type": "VTL|MD" },
|
|
21
|
-
"response": {
|
|
22
|
-
"name": "READY2"
|
|
23
|
-
},
|
|
24
|
-
"missingResponse": {
|
|
25
|
-
"name": "READY2_MISSING"
|
|
26
|
-
},
|
|
27
|
-
"statusLabel": { "true": "Always", "false": "Never" }
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"variables": [
|
|
31
|
-
{
|
|
32
|
-
"variableType": "COLLECTED",
|
|
33
|
-
"name": "READY",
|
|
34
|
-
"componentRef": "1",
|
|
35
|
-
"values": {
|
|
36
|
-
"COLLECTED": null
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"variableType": "COLLECTED",
|
|
41
|
-
"name": "READY_MISSING",
|
|
42
|
-
"componentRef": "1",
|
|
43
|
-
"values": {
|
|
44
|
-
"COLLECTED": null
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"variableType": "COLLECTED",
|
|
49
|
-
"name": "READY2",
|
|
50
|
-
"componentRef": "2",
|
|
51
|
-
"values": {
|
|
52
|
-
"COLLECTED": true
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"variableType": "COLLECTED",
|
|
57
|
-
"name": "READY2_MISSING",
|
|
58
|
-
"componentRef": "2",
|
|
59
|
-
"values": {
|
|
60
|
-
"COLLECTED": null
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Orchestrator from '../utils/orchestrator';
|
|
3
|
-
import source from './source';
|
|
4
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
5
|
-
|
|
6
|
-
const stories = {
|
|
7
|
-
title: 'Components/Switch',
|
|
8
|
-
component: Orchestrator,
|
|
9
|
-
argTypes: defaultArgTypes,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default stories;
|
|
13
|
-
|
|
14
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
15
|
-
export const Default = Template.bind({});
|
|
16
|
-
|
|
17
|
-
Default.args = { id: 'switch', source };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Orchestrator from '../utils/orchestrator';
|
|
3
|
-
import source from './source.json';
|
|
4
|
-
import data from './data.json';
|
|
5
|
-
import sourceColspan from './source-colspan.json';
|
|
6
|
-
import sourceDynamic from './table-dynamique.json';
|
|
7
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
8
|
-
|
|
9
|
-
const stories = {
|
|
10
|
-
title: 'Components/Table',
|
|
11
|
-
component: Orchestrator,
|
|
12
|
-
argTypes: defaultArgTypes,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default stories;
|
|
16
|
-
|
|
17
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
18
|
-
|
|
19
|
-
export const Default = Template.bind({});
|
|
20
|
-
Default.args = { id: 'table', source: source, data: data };
|
|
21
|
-
|
|
22
|
-
export const Colspan = Template.bind({});
|
|
23
|
-
Colspan.args = { id: 'table', source: sourceColspan };
|
|
24
|
-
|
|
25
|
-
export const DynamicTable = Template.bind({});
|
|
26
|
-
|
|
27
|
-
DynamicTable.args = {
|
|
28
|
-
id: 'dynamic-table',
|
|
29
|
-
source: sourceDynamic,
|
|
30
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Orchestrator from '../utils/orchestrator';
|
|
2
|
-
import source from './source.json';
|
|
3
|
-
import sourceRoster from './source-roster.json';
|
|
4
|
-
import dataRoster from './data-roster.json';
|
|
5
|
-
import sourceTable from './source-table.json';
|
|
6
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Components/Text',
|
|
10
|
-
component: Orchestrator,
|
|
11
|
-
argTypes: defaultArgTypes,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
|
|
16
|
-
export const Text = { args: { id: 'table', source: source } };
|
|
17
|
-
|
|
18
|
-
export const Roster = { args: { source: sourceRoster, data: dataRoster } };
|
|
19
|
-
|
|
20
|
-
export const Table = { args: { source: sourceTable } };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Orchestrator from '../utils/orchestrator';
|
|
3
|
-
import source from './source.json';
|
|
4
|
-
import data from './data';
|
|
5
|
-
import defaultArgTypes from '../utils/default-arg-types';
|
|
6
|
-
|
|
7
|
-
const stories = {
|
|
8
|
-
title: 'Components/Textarea',
|
|
9
|
-
component: Orchestrator,
|
|
10
|
-
argTypes: defaultArgTypes,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default stories;
|
|
14
|
-
|
|
15
|
-
const Template = (args) => <Orchestrator {...args} />;
|
|
16
|
-
export const Default = Template.bind({});
|
|
17
|
-
|
|
18
|
-
Default.args = { id: 'input', source, data };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import Ajv from 'ajv/dist/2020.js';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import LunaticSchema from '../../../lunatic-schema.json';
|
|
4
|
-
|
|
5
|
-
export function SchemaValidator({ source }) {
|
|
6
|
-
const errors = useMemo(() => {
|
|
7
|
-
const ajv = new Ajv({
|
|
8
|
-
removeAdditional: true,
|
|
9
|
-
strict: false,
|
|
10
|
-
allErrors: true,
|
|
11
|
-
discriminator: true,
|
|
12
|
-
});
|
|
13
|
-
const validator = ajv.compile(LunaticSchema);
|
|
14
|
-
const isSourceValid = validator(structuredClone(source)); // ajv mutate the object, send a clone
|
|
15
|
-
if (!isSourceValid) {
|
|
16
|
-
return validator.errors;
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
}, [source]);
|
|
20
|
-
|
|
21
|
-
if (!errors) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div className="json-errors">
|
|
27
|
-
<p>
|
|
28
|
-
<strong>{errors.length}</strong> erreurs
|
|
29
|
-
</p>
|
|
30
|
-
<ul>
|
|
31
|
-
{errors.map((err, k) => (
|
|
32
|
-
<li key={k}>
|
|
33
|
-
<strong>{err.instancePath}</strong> : {err.message}{' '}
|
|
34
|
-
<small>({err.schemaPath})</small>
|
|
35
|
-
</li>
|
|
36
|
-
))}
|
|
37
|
-
</ul>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const fields = [
|
|
2
|
-
'source',
|
|
3
|
-
'id',
|
|
4
|
-
'disableFilters',
|
|
5
|
-
'pagination',
|
|
6
|
-
'data',
|
|
7
|
-
'management',
|
|
8
|
-
'activeControls',
|
|
9
|
-
'features',
|
|
10
|
-
'initialPage',
|
|
11
|
-
'getStoreInfo',
|
|
12
|
-
'missing',
|
|
13
|
-
'shortcut',
|
|
14
|
-
'disableFiltersDescription',
|
|
15
|
-
'disabled',
|
|
16
|
-
'showOverview',
|
|
17
|
-
'missingStrategy',
|
|
18
|
-
'detailAlwaysDisplayed',
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
const defaultArgTypes = fields.reduce(
|
|
22
|
-
(acc, f) => ({
|
|
23
|
-
...acc,
|
|
24
|
-
[f]: {
|
|
25
|
-
table: {
|
|
26
|
-
disable: true,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
{
|
|
31
|
-
readOnly: {
|
|
32
|
-
table: { disable: false },
|
|
33
|
-
control: 'boolean',
|
|
34
|
-
defaultValue: false,
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
export default defaultArgTypes;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const labelPositionOptions = {
|
|
2
|
-
Default: 'DEFAULT',
|
|
3
|
-
Top: 'TOP',
|
|
4
|
-
Right: 'RIGHT',
|
|
5
|
-
Bottom: 'BOTTOM',
|
|
6
|
-
Left: 'LEFT',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const unitPositionOptions = {
|
|
10
|
-
Default: 'DEFAULT',
|
|
11
|
-
Before: 'BEFORE',
|
|
12
|
-
After: 'AFTER',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const featuresOptions = {
|
|
16
|
-
None: [],
|
|
17
|
-
Vtl: ['VTL'],
|
|
18
|
-
'Vtl Md': ['VTL', 'MD'],
|
|
19
|
-
};
|