1- import React , { Fragment , useState , useEffect , useCallback } from " react" ;
1+ import React , { Fragment , useState , useEffect , useCallback } from ' react' ;
22import {
33 JsonForms ,
44 JsonFormsDispatch ,
55 JsonFormsReduxContext
6- } from "@jsonforms/react" ;
7- import { Provider } from "react-redux" ;
8- import Grid from "@material-ui/core/Grid" ;
9- import Typography from "@material-ui/core/Typography" ;
10- import withStyles , { WithStyles } from "@material-ui/core/styles/withStyles" ;
11- import createStyles from "@material-ui/core/styles/createStyles" ;
12- import { Tabs , Tab } from "@material-ui/core" ;
13- import logo from "./logo.svg" ;
14- import "./App.css" ;
15- import schema from "./schema.json" ;
16- import uischema from "./uischema.json" ;
17- import { materialCells , materialRenderers } from "@jsonforms/material-renderers" ;
18- import { Store } from "redux" ;
19- import { get } from "lodash" ;
20- import RatingControl from "./RatingControl" ;
21- import ratingControlTester from "./ratingControlTester" ;
6+ } from '@jsonforms/react' ;
7+ import { Provider } from 'react-redux' ;
8+ import Grid from '@material-ui/core/Grid' ;
9+ import Typography from '@material-ui/core/Typography' ;
10+ import withStyles , { WithStyles } from '@material-ui/core/styles/withStyles' ;
11+ import createStyles from '@material-ui/core/styles/createStyles' ;
12+ import { Tabs , Tab } from '@material-ui/core' ;
13+ import logo from './logo.svg' ;
14+ import './App.css' ;
15+ import schema from './schema.json' ;
16+ import uischema from './uischema.json' ;
17+ import {
18+ materialCells ,
19+ materialRenderers
20+ } from '@jsonforms/material-renderers' ;
21+ import { Store } from 'redux' ;
22+ import { get } from 'lodash' ;
23+ import RatingControl from './RatingControl' ;
24+ import ratingControlTester from './ratingControlTester' ;
2225
2326const styles = createStyles ( {
2427 container : {
25- padding : " 1em"
28+ padding : ' 1em'
2629 } ,
2730 title : {
28- textAlign : " center" ,
29- padding : " 0.25em"
31+ textAlign : ' center' ,
32+ padding : ' 0.25em'
3033 } ,
3134 dataContent : {
32- display : " flex" ,
33- justifyContent : " center" ,
34- borderRadius : " 0.25em" ,
35- backgroundColor : " #cecece"
35+ display : ' flex' ,
36+ justifyContent : ' center' ,
37+ borderRadius : ' 0.25em' ,
38+ backgroundColor : ' #cecece'
3639 } ,
3740 demoform : {
38- margin : " auto" ,
39- padding : " 1rem"
41+ margin : ' auto' ,
42+ padding : ' 1rem'
4043 }
4144} ) ;
4245
@@ -45,25 +48,25 @@ export interface AppProps extends WithStyles<typeof styles> {
4548}
4649
4750const data = {
48- name : " Send email to Adrian" ,
49- description : " Confirm if you have passed the subject\nHereby ..." ,
51+ name : ' Send email to Adrian' ,
52+ description : ' Confirm if you have passed the subject\nHereby ...' ,
5053 done : true ,
51- recurrence : " Daily" ,
54+ recurrence : ' Daily' ,
5255 rating : 3
5356} ;
5457
5558const getDataAsStringFromStore = ( store : Store ) =>
5659 store
5760 ? JSON . stringify (
58- get ( store . getState ( ) , [ " jsonforms" , " core" , " data" ] ) ,
61+ get ( store . getState ( ) , [ ' jsonforms' , ' core' , ' data' ] ) ,
5962 null ,
6063 2
6164 )
62- : "" ;
65+ : '' ;
6366
6467const App = ( { store, classes } : AppProps ) => {
6568 const [ tabIdx , setTabIdx ] = useState ( 0 ) ;
66- const [ displayDataAsString , setDisplayDataAsString ] = useState ( "" ) ;
69+ const [ displayDataAsString , setDisplayDataAsString ] = useState ( '' ) ;
6770 const [ standaloneData , setStandaloneData ] = useState ( data ) ;
6871 const handleTabChange = useCallback (
6972 ( event : any , newValue : number ) => {
@@ -92,38 +95,38 @@ const App = ({ store, classes }: AppProps) => {
9295
9396 return (
9497 < Fragment >
95- < div className = " App" >
96- < header className = " App-header" >
97- < img src = { logo } className = " App-logo" alt = " logo" />
98- < h1 className = " App-title" > Welcome to JSON Forms with React</ h1 >
99- < p className = " App-intro" > More Forms. Less Code.</ p >
98+ < div className = ' App' >
99+ < header className = ' App-header' >
100+ < img src = { logo } className = ' App-logo' alt = ' logo' />
101+ < h1 className = ' App-title' > Welcome to JSON Forms with React</ h1 >
102+ < p className = ' App-intro' > More Forms. Less Code.</ p >
100103 </ header >
101104 </ div >
102105
103106 < Grid
104107 container
105- justify = { " center" }
108+ justify = { ' center' }
106109 spacing = { 1 }
107110 className = { classes . container }
108111 >
109112 < Grid item sm = { 6 } >
110- < Typography variant = { "h3" } className = { classes . title } >
113+ < Typography variant = { 'h3' } className = { classes . title } >
111114 Bound data
112115 </ Typography >
113116 < div className = { classes . dataContent } >
114- < pre id = " boundData" > { displayDataAsString } </ pre >
117+ < pre id = ' boundData' > { displayDataAsString } </ pre >
115118 </ div >
116119 </ Grid >
117120 < Grid item sm = { 6 } >
118- < Typography variant = { "h3" } className = { classes . title } >
121+ < Typography variant = { 'h3' } className = { classes . title } >
119122 Rendered form
120123 </ Typography >
121124 < Tabs value = { tabIdx } onChange = { handleTabChange } >
122- < Tab label = " via Redux" />
123- < Tab label = " Standalone" />
125+ < Tab label = ' via Redux' />
126+ < Tab label = ' Standalone' />
124127 </ Tabs >
125128 { tabIdx === 0 && (
126- < div className = { classes . demoform } id = " form" >
129+ < div className = { classes . demoform } id = ' form' >
127130 { store ? (
128131 < Provider store = { store } >
129132 < JsonFormsReduxContext >
0 commit comments