Skip to content

Commit 100df18

Browse files
committed
add template layout example
1 parent 8ab915f commit 100df18

File tree

15 files changed

+10391
-8203
lines changed

15 files changed

+10391
-8203
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.5.0-beta.1",
2+
"version": "3.5.1",
33
"npmClient": "pnpm",
44
"useWorkspaces": true
55
}

packages/antd-renderers/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@
8787
"@ant-design/icons": "5.5.2",
8888
"@emotion/react": "^11.4.1",
8989
"@emotion/styled": "^11.3.0",
90-
"@jsonforms/core": "3.5.0-beta.1",
91-
"@jsonforms/react": "3.5.0-beta.1",
90+
"@jsonforms/core": "3.5.1",
91+
"@jsonforms/react": "3.5.1",
9292
"antd": "5.22.2",
9393
"react": "^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
9494
},
9595
"devDependencies": {
9696
"@ant-design/icons": "5.5.2",
9797
"@emotion/react": "^11.5.0",
9898
"@emotion/styled": "^11.3.0",
99-
"@jsonforms/core": "3.5.0-beta.1",
100-
"@jsonforms/react": "3.5.0-beta.1",
99+
"@jsonforms/core": "3.5.1",
100+
"@jsonforms/react": "3.5.1",
101101
"@rollup/plugin-commonjs": "^23.0.3",
102102
"@rollup/plugin-json": "^5.0.2",
103103
"@rollup/plugin-node-resolve": "^15.0.1",

packages/examples-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chobantonov/examples-app",
3-
"version": "3.5.0-beta.1",
3+
"version": "3.5.1",
44
"private": true,
55
"license": "MIT",
66
"type": "module",

packages/examples-react/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "@chobantonov/examples-react",
3-
"version": "3.5.0-beta.1",
3+
"version": "3.5.1",
44
"private": true,
55
"dependencies": {
6-
"@jsonforms/core": "3.5.0-beta.1",
7-
"@jsonforms/examples": "3.5.0-beta.1",
8-
"@jsonforms/react": "3.5.0-beta.1",
6+
"@jsonforms/core": "3.5.1",
7+
"@jsonforms/examples": "3.5.1",
8+
"@jsonforms/react": "3.5.1",
99
"@monaco-editor/react": "^4.6.0",
1010
"@types/react-tabs": "^2.3.3",
1111
"json-refs": "3.0.15",
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { getExamples } from '@jsonforms/examples';
2-
import * as schema from './file';
2+
import * as file from './file';
3+
import * as templateLayout from './template-layout';
34

45
const examples = getExamples();
56

6-
export { schema };
7+
export { file, templateLayout };
78
export default examples;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "John Doe",
3+
"birthDate": "1985-06-02"
4+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"en": {
3+
"name": {
4+
"label": "Name",
5+
"description": "The name of the person"
6+
},
7+
"vegetarian": {
8+
"label": "Vegetarian",
9+
"description": "Whether the person is a vegetarian"
10+
},
11+
"birth": {
12+
"label": "Birth Date",
13+
"description": ""
14+
},
15+
"nationality": {
16+
"label": "Nationality",
17+
"description": ""
18+
},
19+
"personal-data": {
20+
"age": {
21+
"label": "Age"
22+
},
23+
"driving": {
24+
"label": "Driving Skill",
25+
"description": "Indicating experience level"
26+
}
27+
},
28+
"height": {
29+
"label": "Height"
30+
},
31+
"occupation": {
32+
"label": "Occupation",
33+
"description": ""
34+
},
35+
"postal-code": {
36+
"label": "Postal Code"
37+
},
38+
"error": {
39+
"required": "field is required"
40+
}
41+
},
42+
"bg": {
43+
"name": {
44+
"label": "Име",
45+
"description": "Името на лицето"
46+
},
47+
"vegetarian": {
48+
"label": "Вегетарианец",
49+
"description": "Дали човекът е вегетарианец"
50+
},
51+
"birth": {
52+
"label": "Рождена дата",
53+
"description": ""
54+
},
55+
"nationality": {
56+
"label": "Националност",
57+
"description": ""
58+
},
59+
"personal-data": {
60+
"age": {
61+
"label": "Възраст",
62+
"description": "Моля, въведете вашата възраст."
63+
},
64+
"driving": {
65+
"label": "Шофьорски умения",
66+
"description": "Показва ниво на опит"
67+
}
68+
},
69+
"height": {
70+
"label": "Височина"
71+
},
72+
"occupation": {
73+
"label": "Професия",
74+
"description": ""
75+
},
76+
"postal-code": {
77+
"label": "Пощенски код"
78+
},
79+
"error": {
80+
"required": "полето е задължително"
81+
},
82+
"Additional Information": "Допълнителна информация",
83+
"Custom TemplateLayout with JSONForms and Vuetify": "Персонализиран TemplateLayout с JSONForms и Vuetify",
84+
"Additional Information For": "Допълнителна информация за"
85+
}
86+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { type JsonSchema } from '@jsonforms/core';
2+
import { registerExamples } from '@jsonforms/examples';
3+
import data from './data.json';
4+
//import i18n from './i18n.json';
5+
import schema from './schema.json';
6+
import uischema from './uischema.json';
7+
8+
registerExamples([
9+
{
10+
name: 'template-layout',
11+
label: 'Template Layout',
12+
data,
13+
schema: schema as any as JsonSchema,
14+
uischema,
15+
},
16+
]);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"properties": {
5+
"name": {
6+
"type": "string",
7+
"minLength": 3,
8+
"description": "Please enter your name",
9+
"i18n": "name"
10+
},
11+
"birthDate": {
12+
"type": "string",
13+
"format": "date",
14+
"i18n": "birth"
15+
},
16+
"nationality": {
17+
"type": "string",
18+
"enum": ["US", "BG", "DE", "JP", "RU", "Other"],
19+
"i18n": "nationality"
20+
}
21+
},
22+
"required": ["nationality"]
23+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"type": "TemplateLayout",
3+
"template": "{children}",
4+
"elements": [
5+
{
6+
"type": "TemplateLayout",
7+
"template": "<div>{elements.find(el => el.name === 'header').component}</div>",
8+
"elements": [
9+
{
10+
"name": "header",
11+
"type": "TemplateLayout",
12+
"template": "<div>Hello {data.name}</div><br/>"
13+
}
14+
]
15+
},
16+
{
17+
"type": "TemplateLayout",
18+
"template": "<div style='display: flex; flex-direction: row; gap: 0.5rem;'>{elements.find(el => el.name === 'name').component}{elements.find(el => el.name === 'birthDate').component}</div><div>{elements.find(el => el.name === 'nationality').component}</div>",
19+
"elements": [
20+
{
21+
"name": "name",
22+
"type": "Control",
23+
"scope": "#/properties/name"
24+
},
25+
{
26+
"name": "birthDate",
27+
"type": "Control",
28+
"scope": "#/properties/birthDate"
29+
},
30+
{
31+
"name": "nationality",
32+
"type": "Control",
33+
"scope": "#/properties/nationality"
34+
}
35+
]
36+
}
37+
]
38+
}

0 commit comments

Comments
 (0)