Skip to content

Commit d1e562e

Browse files
kchobantonovsdirix
authored andcommitted
chore: integrate jsonforms-vuetify-renderers
Integrate the JSON Forms Vuetify renderers into the core mono repository including their example application.
1 parent d7b7dc3 commit d1e562e

File tree

384 files changed

+14399
-23545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+14399
-23545
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ In this case, you can try to clean the repository with `git clean -dfx`. Beware
6868
- Run React Material examples: `cd packages/material-renderers && pnpm run dev`
6969
- Run Angular Material examples: `cd packages/angular-material && pnpm run dev`
7070
- Run Vue Vanilla dev setup: `cd packages/vue-vanilla && pnpm run serve`
71+
- Run Vue Vuetify dev setup: `cd packages/vue-vuetify && pnpm run dev`
7172

7273
### Dependency & Release management
7374

packages/examples-app/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h1>JSON Forms Examples</h1>
1313
<li><a href="react-material">React Material Renderers</a></li>
1414
<li><a href="angular-material">Angular Material Renderers</a></li>
1515
<li><a href="vue-vanilla">Vue Vanilla Renderers</a></li>
16+
<li><a href="vue-vuetify">Vue Vuetify Renderers</a></li>
1617
</ul>
1718
</body>
1819
</html>

packages/examples-app/prepare-examples-app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const examples = {
1515
'react-material': join(packagesDir, 'material-renderers', 'example', 'dist'),
1616
'angular-material': join(packagesDir, 'angular-material', 'example', 'dist'),
1717
'vue-vanilla': join(packagesDir, 'vue-vanilla', 'example', 'dist'),
18+
'vue-vuetify': join(packagesDir, 'vue-vuetify', 'example', 'dist'),
1819
};
1920

2021
// Clean and recreate dist dir

packages/examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"doc": "typedoc --name 'JSON Forms Examples' --excludeExternals --out docs src"
4444
},
4545
"dependencies": {
46-
"ajv-i18n": "^3.5.0",
46+
"ajv-i18n": "^4.2.0",
4747
"lodash": "^4.17.21"
4848
},
4949
"peerDependencies": {
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2017-2019 EclipseSource Munich
5+
https://github.com/eclipsesource/jsonforms
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
*/
25+
import { registerExamples } from '../register';
26+
27+
export const schema = {
28+
$schema: 'http://json-schema.org/draft-07/schema#',
29+
type: 'object',
30+
properties: {
31+
propertiesString: {
32+
type: 'string',
33+
},
34+
},
35+
propertyNames: {
36+
minLength: 2,
37+
},
38+
patternProperties: {
39+
'^string$': {
40+
type: 'string',
41+
},
42+
'^number$': {
43+
type: 'number',
44+
},
45+
'^integer$': {
46+
type: 'integer',
47+
},
48+
'^object$': {
49+
type: 'object',
50+
properties: {
51+
prop1: {
52+
type: 'string',
53+
},
54+
},
55+
},
56+
'^boolean$': {
57+
type: 'boolean',
58+
},
59+
'^stringArray$': {
60+
type: 'array',
61+
items: {
62+
type: 'string',
63+
},
64+
},
65+
'^numberArray$': {
66+
type: 'array',
67+
items: {
68+
type: 'number',
69+
},
70+
},
71+
'^integerArray$': {
72+
type: 'array',
73+
items: {
74+
type: 'integer',
75+
},
76+
},
77+
'^objectArray$': {
78+
type: 'array',
79+
items: {
80+
type: 'object',
81+
properties: {
82+
prop1: {
83+
type: 'string',
84+
},
85+
},
86+
},
87+
},
88+
'^booleanArray$': {
89+
type: 'array',
90+
items: {
91+
type: 'boolean',
92+
},
93+
},
94+
},
95+
additionalProperties: {
96+
type: 'string',
97+
title: 'Additional Properties',
98+
},
99+
maxProperties: 15,
100+
};
101+
102+
export const uischema = {
103+
type: 'Control',
104+
scope: '#/',
105+
};
106+
107+
const data = {
108+
propertiesString: 'data',
109+
string: 'string value',
110+
number: 10.2,
111+
integer: 11,
112+
object: {
113+
prop1: 'prop 1 value',
114+
},
115+
boolean: true,
116+
stringArray: ['value1', 'value2'],
117+
numberArray: [12.2],
118+
integerArray: [33],
119+
objectArray: [{ prop1: 'prop1 val' }, {}],
120+
booleanArray: [false, true],
121+
};
122+
123+
registerExamples([
124+
{
125+
name: 'additional-properties',
126+
label: 'Additional Properties',
127+
data,
128+
schema,
129+
uischema,
130+
},
131+
]);

packages/examples/src/examples/i18n.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ import {
3232
Translator,
3333
} from '@jsonforms/core';
3434
import get from 'lodash/get';
35-
// TODO change import when types are available for ajv-i18n (from v4.x)
36-
// eslint-disable-next-line @typescript-eslint/no-var-requires
37-
const localize = require('ajv-i18n');
35+
import localize from 'ajv-i18n/localize';
3836

3937
export const onChange =
4038
(dispatch: Dispatch<AnyAction>) =>
@@ -43,7 +41,8 @@ export const onChange =
4341
if (!extensionState) {
4442
return;
4543
}
46-
const localiseFunc = localize[extensionState.locale.split('-')[0]];
44+
const localiseFunc =
45+
localize[extensionState.locale.split('-')[0] as keyof typeof localize];
4746
localiseFunc(errors);
4847
dispatch(updateErrors(errors));
4948
};
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2017-2019 EclipseSource Munich
5+
https://github.com/eclipsesource/jsonforms
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
*/
25+
import { registerExamples } from '../register';
26+
27+
export const schema = {
28+
type: 'object',
29+
properties: {
30+
username: {
31+
type: 'string',
32+
description: 'Login Name',
33+
},
34+
password: {
35+
type: 'string',
36+
format: 'password',
37+
description: 'Login password',
38+
},
39+
},
40+
required: ['username', 'password'],
41+
};
42+
43+
export const uischema = {
44+
type: 'VerticalLayout',
45+
elements: [
46+
{
47+
type: 'Label',
48+
text: 'Login Information',
49+
},
50+
{
51+
type: 'HorizontalLayout',
52+
elements: [
53+
{
54+
type: 'Control',
55+
scope: '#/properties/username',
56+
},
57+
{
58+
type: 'Control',
59+
scope: '#/properties/password',
60+
},
61+
],
62+
},
63+
],
64+
};
65+
66+
const data = {
67+
username: 'john.doe@email.com',
68+
};
69+
70+
registerExamples([
71+
{
72+
name: 'login',
73+
label: 'Login Form',
74+
data,
75+
schema,
76+
uischema,
77+
},
78+
]);

packages/examples/src/examples/person.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,18 @@ export const uischema = {
126126
{
127127
type: 'Control',
128128
scope: '#/properties/occupation',
129-
suggestion: [
130-
'Accountant',
131-
'Engineer',
132-
'Freelancer',
133-
'Journalism',
134-
'Physician',
135-
'Student',
136-
'Teacher',
137-
'Other',
138-
],
129+
options: {
130+
suggestion: [
131+
'Accountant',
132+
'Engineer',
133+
'Freelancer',
134+
'Journalism',
135+
'Physician',
136+
'Student',
137+
'Teacher',
138+
'Other',
139+
],
140+
},
139141
},
140142
],
141143
},
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2017-2019 EclipseSource Munich
5+
https://github.com/eclipsesource/jsonforms
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
*/
25+
import { registerExamples } from '../register';
26+
27+
export const schema = {
28+
type: 'string',
29+
title: 'String',
30+
description: 'The form output will be a string',
31+
};
32+
33+
export const uischema = {
34+
type: 'Control',
35+
scope: '#/',
36+
};
37+
38+
export const data = 'This is a test string';
39+
40+
registerExamples([
41+
{
42+
name: 'string',
43+
label: 'String',
44+
data,
45+
schema,
46+
uischema,
47+
},
48+
]);

packages/examples/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ import * as listWithDetailPrimitives from './examples/list-with-detail-primitive
7373
import * as conditionalSchemaComposition from './examples/conditional-schema-compositions';
7474
import * as additionalErrors from './examples/additional-errors';
7575
import * as multiEnumWithLabelAndDesc from './examples/enum-multi-with-label-and-desc';
76+
import * as additionalProperties from './examples/additional-properties';
77+
import * as login from './examples/login';
78+
import * as string from './examples/string';
7679
export * from './register';
7780
export * from './example';
7881

@@ -129,6 +132,9 @@ export {
129132
listWithDetailPrimitives,
130133
conditionalSchemaComposition,
131134
additionalErrors,
135+
additionalProperties,
136+
login,
132137
issue_1884,
133138
arrayWithDefaults,
139+
string,
134140
};

0 commit comments

Comments
 (0)