@maif/react-forms 1.0.35 → 1.0.38
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 +2 -12
- package/lib/esm/index.js +614 -819
- package/lib/index.js +616 -820
- package/package.json +11 -4
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -10
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -10
- package/.github/workflows/build-playground.yml +0 -34
- package/.github/workflows/generate-release-note.yml +0 -48
- package/.github/workflows/release.yml +0 -73
- package/docs/asset-manifest.json +0 -24
- package/docs/index.html +0 -1
- package/docs/manifest.json +0 -25
- package/docs/robots.txt +0 -3
- package/docs/static/css/2.6902daba.chunk.css +0 -11
- package/docs/static/css/2.6902daba.chunk.css.map +0 -1
- package/docs/static/css/main.8693c9f3.chunk.css +0 -2
- package/docs/static/css/main.8693c9f3.chunk.css.map +0 -1
- package/docs/static/js/2.bc3a307f.chunk.js +0 -3
- package/docs/static/js/2.bc3a307f.chunk.js.LICENSE.txt +0 -147
- package/docs/static/js/2.bc3a307f.chunk.js.map +0 -1
- package/docs/static/js/main.a5abf7f1.chunk.js +0 -2
- package/docs/static/js/main.a5abf7f1.chunk.js.map +0 -1
- package/docs/static/js/runtime-main.368a22f5.js +0 -2
- package/docs/static/js/runtime-main.368a22f5.js.map +0 -1
- package/docs/static/media/fa-brands-400.2285773e.woff +0 -0
- package/docs/static/media/fa-brands-400.23f19bb0.eot +0 -0
- package/docs/static/media/fa-brands-400.2f517e09.svg +0 -3717
- package/docs/static/media/fa-brands-400.527940b1.ttf +0 -0
- package/docs/static/media/fa-brands-400.d878b0a6.woff2 +0 -0
- package/docs/static/media/fa-regular-400.4689f52c.svg +0 -801
- package/docs/static/media/fa-regular-400.491974d1.ttf +0 -0
- package/docs/static/media/fa-regular-400.77206a6b.eot +0 -0
- package/docs/static/media/fa-regular-400.7a333762.woff2 +0 -0
- package/docs/static/media/fa-regular-400.bb58e57c.woff +0 -0
- package/docs/static/media/fa-solid-900.1551f4f6.woff2 +0 -0
- package/docs/static/media/fa-solid-900.7a8b4f13.svg +0 -5034
- package/docs/static/media/fa-solid-900.9bbb245e.eot +0 -0
- package/docs/static/media/fa-solid-900.be9ee23c.ttf +0 -0
- package/docs/static/media/fa-solid-900.eeccf4f6.woff +0 -0
- package/examples/.env +0 -2
- package/examples/README.md +0 -0
- package/examples/package.json +0 -43
- package/examples/public/index.html +0 -43
- package/examples/public/manifest.json +0 -25
- package/examples/public/robots.txt +0 -3
- package/examples/src/App.css +0 -10
- package/examples/src/Playground.js +0 -158
- package/examples/src/WrapperError.js +0 -21
- package/examples/src/index.css +0 -13
- package/examples/src/index.js +0 -11
- package/examples/src/reportWebVitals.js +0 -13
- package/examples/src/schema/basic.json +0 -15
- package/examples/src/schema/constrainedBasic.json +0 -28
- package/examples/src/schema/constraintsWithRef.json +0 -44
- package/examples/src/schema/dynamicForm.json +0 -57
- package/examples/src/schema/formArray.js +0 -30
- package/examples/src/schema/formInForm.json +0 -39
- package/examples/src/schema/selector.json +0 -14
- package/jest-sync.config.json +0 -17
- package/rollup.config.js +0 -64
- package/scripts/build.sh +0 -34
- package/test/array.spec.js +0 -78
- package/test/bool.spec.js +0 -29
- package/test/date.spec.js +0 -41
- package/test/number.spec.js +0 -124
- package/test/object.spec.js +0 -14
- package/test/string.spec.js +0 -87
- package/test/testUtils.js +0 -30
- package/test-setup.js +0 -9
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/examples/.env
DELETED
package/examples/README.md
DELETED
|
File without changes
|
package/examples/package.json
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@maif/react-forms-playground",
|
|
3
|
-
"version": "1.0.1",
|
|
4
|
-
"private": true,
|
|
5
|
-
"homepage": "https://maif.github.io/react-forms/",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@maif/react-forms": "^1.0.33",
|
|
8
|
-
"babel-standalone": "^6.26.0",
|
|
9
|
-
"bootstrap": "5.1.3",
|
|
10
|
-
"react": "^17.0.2",
|
|
11
|
-
"react-dom": "^17.0.2",
|
|
12
|
-
"react-scripts": "4.0.3",
|
|
13
|
-
"react-select": "5.1.0",
|
|
14
|
-
"web-vitals": "^1.0.1"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"start": "react-scripts start",
|
|
18
|
-
"build": "react-scripts build",
|
|
19
|
-
"eject": "react-scripts eject",
|
|
20
|
-
"predeploy": "yarn run build",
|
|
21
|
-
"deploy": "gh-pages -d build"
|
|
22
|
-
},
|
|
23
|
-
"eslintConfig": {
|
|
24
|
-
"extends": [
|
|
25
|
-
"react-app"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"browserslist": {
|
|
29
|
-
"production": [
|
|
30
|
-
">0.2%",
|
|
31
|
-
"not dead",
|
|
32
|
-
"not op_mini all"
|
|
33
|
-
],
|
|
34
|
-
"development": [
|
|
35
|
-
"last 1 chrome version",
|
|
36
|
-
"last 1 firefox version",
|
|
37
|
-
"last 1 safari version"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"gh-pages": "^3.2.3"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<meta name="theme-color" content="#000000" />
|
|
8
|
-
<meta
|
|
9
|
-
name="description"
|
|
10
|
-
content="Web site created using create-react-app"
|
|
11
|
-
/>
|
|
12
|
-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
-
<!--
|
|
14
|
-
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
-
-->
|
|
17
|
-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
-
<!--
|
|
19
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
-
|
|
23
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
-
-->
|
|
27
|
-
<title>React-forms playground</title>
|
|
28
|
-
</head>
|
|
29
|
-
<body>
|
|
30
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
-
<div id="root"></div>
|
|
32
|
-
<!--
|
|
33
|
-
This HTML file is a template.
|
|
34
|
-
If you open it directly in the browser, you will see an empty page.
|
|
35
|
-
|
|
36
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
-
|
|
39
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
-
-->
|
|
42
|
-
</body>
|
|
43
|
-
</html>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React-Form playground",
|
|
3
|
-
"name": "@maif/react-forms-playground",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
package/examples/src/App.css
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import { Form, CodeInput, SelectInput } from '@maif/react-forms'
|
|
3
|
-
|
|
4
|
-
import './App.css';
|
|
5
|
-
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
6
|
-
|
|
7
|
-
import basic from './schema/basic.json';
|
|
8
|
-
import formArray from './schema/formArray';
|
|
9
|
-
import constrainedBasic from './schema/constrainedBasic.json';
|
|
10
|
-
import constraintsWithRef from './schema/constraintsWithRef.json';
|
|
11
|
-
import simpleSelector from './schema/selector.json';
|
|
12
|
-
import formInForm from './schema/formInForm.json';
|
|
13
|
-
import dynamicForm from './schema/dynamicForm.json';
|
|
14
|
-
import * as babel from 'babel-standalone'
|
|
15
|
-
import WrapperError from './WrapperError';
|
|
16
|
-
import { ValidationError } from 'yup';
|
|
17
|
-
|
|
18
|
-
const examples = {
|
|
19
|
-
basic,
|
|
20
|
-
formArray,
|
|
21
|
-
constrainedBasic,
|
|
22
|
-
constraintsWithRef,
|
|
23
|
-
simpleSelector,
|
|
24
|
-
formInForm,
|
|
25
|
-
dynamicForm
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const Playground = () => {
|
|
29
|
-
const [schema, setSchema] = useState(JSON.stringify(basic, 0, 2))
|
|
30
|
-
const [realSchema, setRealSchema] = useState(basic)
|
|
31
|
-
const [error, setError] = useState(undefined)
|
|
32
|
-
const [value, setValue] = useState()
|
|
33
|
-
|
|
34
|
-
const ref = useRef()
|
|
35
|
-
const childRef = useRef()
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (childRef.current)
|
|
39
|
-
childRef.current.reset()
|
|
40
|
-
babelize(schema)
|
|
41
|
-
}, [schema])
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
setError(undefined)
|
|
45
|
-
}, [realSchema])
|
|
46
|
-
|
|
47
|
-
const babelize = e => {
|
|
48
|
-
try {
|
|
49
|
-
const code = `() => { try { return ${(typeof e === 'object' ? JSON.stringify(e, null, 2) : e)} } catch(err) {} }`
|
|
50
|
-
const babelCode = babel.transform(code, { presets: ['react', 'es2015'] }).code;
|
|
51
|
-
|
|
52
|
-
const generatedCode = babelCode.replace('"use strict";', "").trim()
|
|
53
|
-
const func = new Function("React", `return ${generatedCode}`);
|
|
54
|
-
const res = func(React)()
|
|
55
|
-
if (res)
|
|
56
|
-
setRealSchema(res)
|
|
57
|
-
} catch (_) {
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div className="my-md-4 bd-layout">
|
|
64
|
-
<nav className="navbar navbar-expand-lg navbar-light bg-light fixed-top">
|
|
65
|
-
<div className="container-fluid">
|
|
66
|
-
<span className="navbar-brand">react-forms playground</span>
|
|
67
|
-
<button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
68
|
-
<span className="navbar-toggler-icon"></span>
|
|
69
|
-
</button>
|
|
70
|
-
<div className="collapse navbar-collapse" id="navbarSupportedContent">
|
|
71
|
-
<ul className="navbar-nav me-auto mb-2 mb-lg-0">
|
|
72
|
-
<li className="nav-item">
|
|
73
|
-
<a className="nav-link" href="https://github.com/MAIF/react-forms#readme">Documentation</a>
|
|
74
|
-
</li>
|
|
75
|
-
<li className="nav-item">
|
|
76
|
-
<a className="nav-link" href="https://github.com/MAIF/react-forms">Project</a>
|
|
77
|
-
</li>
|
|
78
|
-
</ul>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</nav>
|
|
82
|
-
<div className="container" style={{ marginTop: '70px' }}>
|
|
83
|
-
<em className='tagline px-0 py-2'>Choose a JSON schema below and check the generated form. Check the <a href='https://github.com/MAIF/react-forms'>documentation</a> for more details.</em>
|
|
84
|
-
<div className="d-flex">
|
|
85
|
-
<div className='col-8' style={{ marginRight: '10px' }}>
|
|
86
|
-
<label htmlFor="selector">Try with a schema</label>
|
|
87
|
-
<SelectInput
|
|
88
|
-
className="py-2"
|
|
89
|
-
possibleValues={Object.entries(examples)}
|
|
90
|
-
transformer={([key, value]) => ({ label: key, value })}
|
|
91
|
-
defaultValue={{ value: basic, label: "basic" }}
|
|
92
|
-
onChange={setSchema}
|
|
93
|
-
/>
|
|
94
|
-
<CodeInput
|
|
95
|
-
mode="javascript"
|
|
96
|
-
onChange={e => {
|
|
97
|
-
try {
|
|
98
|
-
setSchema(e)
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.log(error)
|
|
101
|
-
}
|
|
102
|
-
}}
|
|
103
|
-
value={typeof schema === 'object' ? JSON.stringify(schema, null, 2) : schema}
|
|
104
|
-
/>
|
|
105
|
-
<label>Default value</label>
|
|
106
|
-
<CodeInput
|
|
107
|
-
mode="json"
|
|
108
|
-
onChange={e => {
|
|
109
|
-
try {
|
|
110
|
-
setValue(JSON.parse(e))
|
|
111
|
-
} catch (_) { }
|
|
112
|
-
}}
|
|
113
|
-
value={typeof value === 'object' ? JSON.stringify(value, null, 2) : value}
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
<div className='col-4 px-2'>
|
|
117
|
-
<label>Generated form</label>
|
|
118
|
-
{error && <span style={{ color: 'tomato' }}>{error}</span>}
|
|
119
|
-
<div style={{ backgroundColor: '#ececec', padding: '10px 15px' }}>
|
|
120
|
-
<WrapperError ref={childRef}>
|
|
121
|
-
<Form
|
|
122
|
-
schema={realSchema}
|
|
123
|
-
value={value}
|
|
124
|
-
flow={Object.keys(realSchema)}
|
|
125
|
-
onSubmit={d => alert(JSON.stringify(d, null, 2))}
|
|
126
|
-
options={{
|
|
127
|
-
watch: unsaved => ref?.current?.dispatch({
|
|
128
|
-
changes: {
|
|
129
|
-
from: 0,
|
|
130
|
-
to: ref.current.state.doc.length,
|
|
131
|
-
insert: JSON.stringify(unsaved, null, 2)
|
|
132
|
-
}
|
|
133
|
-
}),
|
|
134
|
-
actions: {
|
|
135
|
-
submit: {
|
|
136
|
-
label: 'Try it'
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}}
|
|
140
|
-
/>
|
|
141
|
-
</WrapperError>
|
|
142
|
-
</div>
|
|
143
|
-
<div className='py-2'>
|
|
144
|
-
<label>Form state</label>
|
|
145
|
-
<CodeInput
|
|
146
|
-
setRef={r => ref.current = r}
|
|
147
|
-
showGutter={false}
|
|
148
|
-
mode="json"
|
|
149
|
-
/>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export default Playground;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export default class WrapperError extends React.Component {
|
|
4
|
-
state = {
|
|
5
|
-
error: undefined
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
componentDidCatch(error) {
|
|
9
|
-
this.setState({ error })
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
reset() {
|
|
13
|
-
this.setState({ error: undefined })
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
render() {
|
|
17
|
-
if (this.state.error)
|
|
18
|
-
return <div>Something wrong happened</div>
|
|
19
|
-
return this.props.children
|
|
20
|
-
}
|
|
21
|
-
}
|
package/examples/src/index.css
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
4
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
5
|
-
sans-serif;
|
|
6
|
-
-webkit-font-smoothing: antialiased;
|
|
7
|
-
-moz-osx-font-smoothing: grayscale;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
code {
|
|
11
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
12
|
-
monospace;
|
|
13
|
-
}
|
package/examples/src/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const reportWebVitals = onPerfEntry => {
|
|
2
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
3
|
-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
4
|
-
getCLS(onPerfEntry);
|
|
5
|
-
getFID(onPerfEntry);
|
|
6
|
-
getFCP(onPerfEntry);
|
|
7
|
-
getLCP(onPerfEntry);
|
|
8
|
-
getTTFB(onPerfEntry);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default reportWebVitals;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": {
|
|
3
|
-
"type": "string",
|
|
4
|
-
"label": "name",
|
|
5
|
-
"placeholder": "Your name",
|
|
6
|
-
"constraints": [
|
|
7
|
-
{
|
|
8
|
-
"type": "required",
|
|
9
|
-
"message": "required field"
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
"age": {
|
|
14
|
-
"type": "number",
|
|
15
|
-
"label": "Your age",
|
|
16
|
-
"constraints": [
|
|
17
|
-
{
|
|
18
|
-
"type": "required",
|
|
19
|
-
"message": "required field"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"type": "min",
|
|
23
|
-
"ref": 18,
|
|
24
|
-
"message": "You must be an adult"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"oldPassword": {
|
|
3
|
-
"type": "string",
|
|
4
|
-
"format": "password",
|
|
5
|
-
"label": "Old Password",
|
|
6
|
-
"constraints": [
|
|
7
|
-
{
|
|
8
|
-
"type": "required",
|
|
9
|
-
"message": "Your old password is required"
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
"newPassword": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"format": "password",
|
|
16
|
-
"label": "New password",
|
|
17
|
-
"constraints": [
|
|
18
|
-
{
|
|
19
|
-
"type": "required",
|
|
20
|
-
"message": "Your new password is required"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"confirmNewPassword": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"format": "password",
|
|
27
|
-
"label": "Confirm new password",
|
|
28
|
-
"constraints": [
|
|
29
|
-
{
|
|
30
|
-
"type": "required",
|
|
31
|
-
"message": "confirm password is required"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"type": "oneOf",
|
|
35
|
-
"arrayOfValues": [
|
|
36
|
-
{
|
|
37
|
-
"ref": "newPassword"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"message": "confirm and password must be equal"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": {
|
|
3
|
-
"type": "string",
|
|
4
|
-
"label": "type",
|
|
5
|
-
"format": "select",
|
|
6
|
-
"options": [
|
|
7
|
-
"mammal",
|
|
8
|
-
"fish",
|
|
9
|
-
"bird",
|
|
10
|
-
"insect"
|
|
11
|
-
],
|
|
12
|
-
"defaultValue": "fish"
|
|
13
|
-
},
|
|
14
|
-
"habitat": {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"label": "habitat",
|
|
17
|
-
"format": "form",
|
|
18
|
-
"conditionalSchema": {
|
|
19
|
-
"ref": "type",
|
|
20
|
-
"switch": [
|
|
21
|
-
{
|
|
22
|
-
"condition": "fish",
|
|
23
|
-
"schema": {
|
|
24
|
-
"sea": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"label": "ocean or sea"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"flow": ["sea"]
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"default": true,
|
|
33
|
-
"schema": {
|
|
34
|
-
"continent": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"label": "continent",
|
|
37
|
-
"format": "select",
|
|
38
|
-
"options": [
|
|
39
|
-
"Africa",
|
|
40
|
-
"Asia",
|
|
41
|
-
"Europe",
|
|
42
|
-
"North America",
|
|
43
|
-
"Océania",
|
|
44
|
-
"South America"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"country": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"label": "country"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"flow": ["continent", "country"]
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const schema = `{
|
|
2
|
-
"users": {
|
|
3
|
-
type: "object",
|
|
4
|
-
format: "form",
|
|
5
|
-
array: true,
|
|
6
|
-
schema: {
|
|
7
|
-
fullname: {
|
|
8
|
-
type: "string",
|
|
9
|
-
render: (props) => {
|
|
10
|
-
const { setValues, setValue, value, onChange } = props
|
|
11
|
-
console.log("coucou")
|
|
12
|
-
return <input
|
|
13
|
-
type="text"
|
|
14
|
-
onChange={e => onChange(e.target.value)}
|
|
15
|
-
value={value}
|
|
16
|
-
/>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
firstname: {
|
|
21
|
-
type: "string"
|
|
22
|
-
},
|
|
23
|
-
lastname: {
|
|
24
|
-
type: "string"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}`
|
|
29
|
-
|
|
30
|
-
export default schema
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": {
|
|
3
|
-
"type": "string",
|
|
4
|
-
"label": "type",
|
|
5
|
-
"format": "select",
|
|
6
|
-
"options": [
|
|
7
|
-
"mammal",
|
|
8
|
-
"fish",
|
|
9
|
-
"bird",
|
|
10
|
-
"insect"
|
|
11
|
-
],
|
|
12
|
-
"defaultValue": "fish"
|
|
13
|
-
},
|
|
14
|
-
"habitat": {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"label": "habitat",
|
|
17
|
-
"format": "form",
|
|
18
|
-
"schema": {
|
|
19
|
-
"continent": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"label": "continent",
|
|
22
|
-
"format": "select",
|
|
23
|
-
"options": [
|
|
24
|
-
"Africa",
|
|
25
|
-
"Asia",
|
|
26
|
-
"Europe",
|
|
27
|
-
"North America",
|
|
28
|
-
"Océania",
|
|
29
|
-
"South America"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"country": {
|
|
33
|
-
"type": "string",
|
|
34
|
-
"label": "country"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
package/jest-sync.config.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"testEnvironment": "jsdom",
|
|
3
|
-
"verbose": true,
|
|
4
|
-
"roots": [
|
|
5
|
-
"test"
|
|
6
|
-
],
|
|
7
|
-
"setupFiles": [
|
|
8
|
-
"./test-setup.js"
|
|
9
|
-
],
|
|
10
|
-
"testRegex": "(/tests/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
|
11
|
-
"transformIgnorePatterns": [
|
|
12
|
-
"node_modules/(?!(jest-)?react-native|lottie-react-native)"
|
|
13
|
-
],
|
|
14
|
-
"globals": {
|
|
15
|
-
"window": {}
|
|
16
|
-
}
|
|
17
|
-
}
|
package/rollup.config.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import babel from '@rollup/plugin-babel'
|
|
2
|
-
import external from 'rollup-plugin-peer-deps-external'
|
|
3
|
-
import del from 'rollup-plugin-delete'
|
|
4
|
-
import pkg from './package.json'
|
|
5
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
6
|
-
import resolve from "@rollup/plugin-node-resolve"
|
|
7
|
-
import { terser } from 'rollup-plugin-terser'
|
|
8
|
-
import copy from 'rollup-plugin-copy'
|
|
9
|
-
|
|
10
|
-
const isDev = process.env.NODE_ENV !== 'production'
|
|
11
|
-
|
|
12
|
-
export default [
|
|
13
|
-
{
|
|
14
|
-
input: "./src/codemirror-editor.js",
|
|
15
|
-
inlineDynamicImports: true,
|
|
16
|
-
output: {
|
|
17
|
-
file: "./src/inputs/__generated/editor.js",
|
|
18
|
-
format: "esm",
|
|
19
|
-
strict: false
|
|
20
|
-
},
|
|
21
|
-
plugins: [
|
|
22
|
-
babel({
|
|
23
|
-
exclude: [
|
|
24
|
-
'node_modules/**',
|
|
25
|
-
'src/inputs/editor.js'
|
|
26
|
-
],
|
|
27
|
-
babelHelpers: 'bundled'
|
|
28
|
-
}),
|
|
29
|
-
resolve(),
|
|
30
|
-
commonjs(),
|
|
31
|
-
isDev ? undefined : terser()
|
|
32
|
-
].filter(f => f)
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
input: pkg.source,
|
|
36
|
-
output: [
|
|
37
|
-
{ file: pkg.main, format: 'cjs' },
|
|
38
|
-
{ file: pkg.module, format: 'esm' }
|
|
39
|
-
],
|
|
40
|
-
plugins: [
|
|
41
|
-
external(),
|
|
42
|
-
babel({
|
|
43
|
-
exclude: [
|
|
44
|
-
'node_modules/**',
|
|
45
|
-
'src/inputs/__generated/editor.js'
|
|
46
|
-
],
|
|
47
|
-
babelHelpers: 'bundled'
|
|
48
|
-
}),
|
|
49
|
-
del({ targets: ['dist/*', 'lib/*', 'examples/node_modules/@maif/react-forms/lib'], verbose: true }),
|
|
50
|
-
isDev ? undefined : terser(),
|
|
51
|
-
copy({
|
|
52
|
-
targets: [
|
|
53
|
-
{
|
|
54
|
-
src: 'lib/index.js',
|
|
55
|
-
dest: 'examples/node_modules/@maif/react-forms/lib'
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
verbose: true,
|
|
59
|
-
hook: 'closeBundle'
|
|
60
|
-
})
|
|
61
|
-
].filter(f => f),
|
|
62
|
-
external: Object.keys(pkg.peerDependencies || {})
|
|
63
|
-
}
|
|
64
|
-
];
|