@jsonforms/material-renderers 3.0.0-beta.2 → 3.0.0-beta.5

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/README.md CHANGED
@@ -10,7 +10,7 @@ This is the JSON Forms Material Renderers Package. This package only contains re
10
10
 
11
11
  See the official [documentation](https://jsonforms.io/docs/integrations/react/) and the JSON Forms React [seed repository](https://github.com/eclipsesource/jsonforms-react-seed) for examples on how to integrate JSON Forms with your application.
12
12
 
13
- You can combine [JSON Forms React](https://github.com/eclipsesource/jsonforms/blob/master/packages/react) with other renderers too, for example with the [Vanilla Renderers](https://github.com/eclipsesource/jsonforms/blob/master/packages/vanilla-renderers).
13
+ You can combine [JSON Forms React](https://github.com/eclipsesource/jsonforms/blob/master/packages/react) with other renderers too, for example with the [Vanilla Renderers](https://github.com/eclipsesource/jsonforms/tree/master/packages/vanilla).
14
14
 
15
15
  Check <https://www.npmjs.com/search?q=%40jsonforms> for all published JSONForms packages.
16
16
 
@@ -24,24 +24,78 @@ npm i --save @jsonforms/core @jsonforms/react @jsonforms/material-renderers
24
24
 
25
25
  Use the `JsonForms` component for each form you want to render and hand over the renderer set.
26
26
 
27
- ```js
27
+
28
+ ```ts
28
29
  import React, { useState } from 'react';
30
+ import {
31
+ materialRenderers,
32
+ materialCells
33
+ } from '@jsonforms/material-renderers';
29
34
  import { JsonForms } from '@jsonforms/react';
30
- import { materialCells, materialRenderers } from '@jsonforms/material-renderers';
35
+
36
+ const schema = {
37
+ type: 'object',
38
+ properties: {
39
+ name: {
40
+ type: 'string',
41
+ minLength: 1
42
+ },
43
+ done: {
44
+ type: 'boolean'
45
+ },
46
+ due_date: {
47
+ type: 'string',
48
+ format: 'date'
49
+ },
50
+ recurrence: {
51
+ type: 'string',
52
+ enum: ['Never', 'Daily', 'Weekly', 'Monthly']
53
+ }
54
+ },
55
+ required: ['name', 'due_date']
56
+ };
57
+
58
+ const uischema = {
59
+ type: 'VerticalLayout',
60
+ elements: [
61
+ {
62
+ type: 'Control',
63
+ label: false,
64
+ scope: '#/properties/done'
65
+ },
66
+ {
67
+ type: 'Control',
68
+ scope: '#/properties/name'
69
+ },
70
+ {
71
+ type: 'HorizontalLayout',
72
+ elements: [
73
+ {
74
+ type: 'Control',
75
+ scope: '#/properties/due_date'
76
+ },
77
+ {
78
+ type: 'Control',
79
+ scope: '#/properties/recurrence'
80
+ }
81
+ ]
82
+ }
83
+ ]
84
+ };
85
+
86
+ const initialData = {};
31
87
 
32
88
  function App() {
33
89
  const [data, setData] = useState(initialData);
34
90
  return (
35
- <div className='App'>
36
- <JsonForms
37
- schema={schema}
38
- uischema={uischema}
39
- data={data}
40
- renderers={materialRenderers}
41
- cells={materialCells}
42
- onChange={({ data, _errors }) => setData(data)}
43
- />
44
- </div>
91
+ <JsonForms
92
+ schema={schema}
93
+ uischema={uischema}
94
+ data={data}
95
+ renderers={materialRenderers}
96
+ cells={materialCells}
97
+ onChange={({ data, _errors }) => setData(data)}
98
+ />
45
99
  );
46
100
  }
47
101
  ```
@@ -62,3 +116,7 @@ If you encounter any problems feel free to [open an issue](https://github.com/ec
62
116
  For questions and discussions please use the [JSON Forms board](https://jsonforms.discourse.group).
63
117
  You can also reach us via [email](mailto:jsonforms@eclipsesource.com?subject=JSON%20Forms).
64
118
  In addition, EclipseSource also offers [professional support](https://jsonforms.io/support) for JSON Forms.
119
+
120
+ ## Migration
121
+
122
+ See our [migration guide](https://github.com/eclipsesource/jsonforms/blob/master/MIGRATION.md) when updating JSON Forms.