File tree Expand file tree Collapse file tree 2 files changed +96
-2
lines changed
packages/mui-component-mapper/demo Expand file tree Collapse file tree 2 files changed +96
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { componentTypes , validatorTypes } from '@data-driven-forms/react-form-renderer' ;
2
+
3
+ const wizardSchema = {
4
+ fields : [
5
+ {
6
+ component : componentTypes . WIZARD ,
7
+ name : 'wizzard' ,
8
+ buttonLabels : { } ,
9
+ title : 'Cokoliv' ,
10
+ stepsInfo : [ { title : 'Add a source' } , { title : 'Configure a source' } , { title : 'Summary' } ] ,
11
+ fields : [
12
+ {
13
+ title : 'Get started with adding source' ,
14
+ name : 'step-1' ,
15
+ nextStep : {
16
+ when : 'source-type' ,
17
+ stepMapper : {
18
+ aws : 'aws' ,
19
+ google : 'google'
20
+ }
21
+ } ,
22
+ fields : [
23
+ {
24
+ component : componentTypes . TEXTAREA ,
25
+ name : 'source-name' ,
26
+ type : 'text' ,
27
+ label : 'Source name'
28
+ } ,
29
+ {
30
+ component : componentTypes . SELECT ,
31
+ name : 'source-type' ,
32
+ label : 'Source type' ,
33
+ isRequired : true ,
34
+ options : [
35
+ {
36
+ value : 'aws' ,
37
+ label : 'Aws'
38
+ } ,
39
+ {
40
+ value : 'google' ,
41
+ label : 'Google'
42
+ }
43
+ ] ,
44
+ validate : [
45
+ {
46
+ type : validatorTypes . REQUIRED
47
+ }
48
+ ]
49
+ }
50
+ ]
51
+ } ,
52
+ {
53
+ title : 'Configure AWS' ,
54
+ name : 'aws' ,
55
+ nextStep : 'summary' ,
56
+ fields : [
57
+ {
58
+ component : componentTypes . TEXT_FIELD ,
59
+ name : 'aws-field' ,
60
+ label : 'Aws field part'
61
+ }
62
+ ]
63
+ } ,
64
+ {
65
+ name : 'google' ,
66
+ title : 'Configure google' ,
67
+ nextStep : 'summary' ,
68
+ fields : [
69
+ {
70
+ component : componentTypes . TEXT_FIELD ,
71
+ name : 'google-field' ,
72
+ label : 'Google field part'
73
+ }
74
+ ]
75
+ } ,
76
+ {
77
+ fields : [
78
+ {
79
+ name : 'summary' ,
80
+ component : componentTypes . TEXT_FIELD ,
81
+ isDisabled : true ,
82
+ label : 'Summary'
83
+ }
84
+ ] ,
85
+ name : 'summary'
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ } ;
91
+
92
+ export default wizardSchema ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import demoSchema from '@data-driven-forms/common/src/demoschema';
11
11
import fieldArraySchema from './demo-schemas/field-array-schema' ;
12
12
13
13
import Button from '@material-ui/core/Button' ;
14
+ import wizardSchema from './demo-schemas/wizard-schema' ;
14
15
15
16
const theme = createMuiTheme ( {
16
17
typography : {
@@ -29,7 +30,7 @@ const compositeMapper = {
29
30
} ;
30
31
31
32
const App = ( ) => {
32
- const [ schema , setSchema ] = useState ( fieldArraySchema ) ;
33
+ const [ schema , setSchema ] = useState ( wizardSchema ) ;
33
34
34
35
return (
35
36
< ThemeProvider theme = { theme } >
@@ -40,12 +41,13 @@ const App = () => {
40
41
< Grid item xs = { 12 } >
41
42
< Button onClick = { ( ) => setSchema ( demoSchema ) } > Demo schema</ Button >
42
43
< Button onClick = { ( ) => setSchema ( fieldArraySchema ) } > Field array</ Button >
44
+ < Button onClick = { ( ) => setSchema ( wizardSchema ) } > Wizard</ Button >
43
45
</ Grid >
44
46
< Grid item xs = { 12 } >
45
47
< FormRenderer
46
48
onSubmit = { console . log }
47
49
componentMapper = { compositeMapper }
48
- FormTemplate = { ( props ) => < FormTemplate { ...props } /> }
50
+ FormTemplate = { ( props ) => < FormTemplate { ...props } showFormControls = { false } /> }
49
51
schema = { schema }
50
52
onCancel = { ( ) => console . log ( 'canceling' ) }
51
53
/>
You can’t perform that action at this time.
0 commit comments