@jsonforms/examples 3.0.0-beta.4 → 3.0.0-rc.1
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/docs/assets/js/search.json +1 -1
- package/docs/globals.html +1477 -843
- package/docs/index.html +12 -0
- package/docs/interfaces/exampledescription.html +22 -8
- package/docs/interfaces/stateprops.html +7 -7
- package/lib/example.d.ts +2 -1
- package/lib/examples/1884.d.ts +91 -0
- package/lib/examples/1948.d.ts +40 -0
- package/lib/examples/1996.d.ts +31 -0
- package/lib/examples/categorization.d.ts +12 -1
- package/lib/examples/i18n.d.ts +18 -1
- package/lib/examples/stepper.d.ts +4 -1
- package/lib/examples/steppershownav.d.ts +4 -1
- package/lib/index.d.ts +4 -1
- package/lib/jsonforms-examples.cjs.js +680 -332
- package/lib/jsonforms-examples.cjs.js.map +1 -1
- package/lib/jsonforms-examples.esm.js +676 -337
- package/lib/jsonforms-examples.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/example.ts +4 -2
- package/src/examples/1884.ts +187 -0
- package/src/examples/1948.ts +87 -0
- package/src/examples/1996.ts +102 -0
- package/src/examples/categorization.ts +15 -3
- package/src/examples/i18n.ts +20 -4
- package/src/examples/oneOf.ts +2 -3
- package/src/index.ts +7 -1
- package/stats.html +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/examples",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-rc.1",
|
|
4
4
|
"description": "JSON Forms Example Data",
|
|
5
5
|
"repository": "https://github.com/eclipsesource/jsonforms",
|
|
6
6
|
"bugs": "https://github.com/eclipsesource/jsonforms/issues",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"ajv-i18n": "^3.5.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@jsonforms/core": "3.0.0-
|
|
48
|
+
"@jsonforms/core": "3.0.0-rc.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@jsonforms/core": "^3.0.0-
|
|
51
|
+
"@jsonforms/core": "^3.0.0-rc.1",
|
|
52
52
|
"rimraf": "^3.0.2",
|
|
53
53
|
"rollup": "^2.7.3",
|
|
54
54
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"typedoc": "^0.19.2",
|
|
60
60
|
"typescript": "4.2.3"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "852057ca1706007bee24bcb1b53b88c7231628a0"
|
|
63
63
|
}
|
package/src/example.ts
CHANGED
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
JsonFormsUISchemaRegistryEntry,
|
|
28
28
|
JsonFormsRendererRegistryEntry,
|
|
29
29
|
JsonSchema,
|
|
30
|
-
UISchemaElement
|
|
30
|
+
UISchemaElement,
|
|
31
|
+
JsonFormsI18nState
|
|
31
32
|
} from '@jsonforms/core';
|
|
32
33
|
|
|
33
34
|
export interface ExampleDescription {
|
|
@@ -38,7 +39,8 @@ export interface ExampleDescription {
|
|
|
38
39
|
uischema: UISchemaElement;
|
|
39
40
|
uischemas?: JsonFormsUISchemaRegistryEntry[];
|
|
40
41
|
config?: any;
|
|
41
|
-
actions?: {label: string, apply: (props: StateProps) => any}[];
|
|
42
|
+
actions?: { label: string, apply: (props: StateProps) => any }[];
|
|
43
|
+
i18n?: JsonFormsI18nState;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export interface StateProps {
|
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
required: ['age'],
|
|
30
|
+
properties: {
|
|
31
|
+
firstName: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
minLength: 2,
|
|
34
|
+
maxLength: 20
|
|
35
|
+
},
|
|
36
|
+
lastName: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
minLength: 5,
|
|
39
|
+
maxLength: 15
|
|
40
|
+
},
|
|
41
|
+
age: {
|
|
42
|
+
type: 'integer',
|
|
43
|
+
minimum: 18,
|
|
44
|
+
maximum: 100
|
|
45
|
+
},
|
|
46
|
+
gender: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
enum: ['Male', 'Female', 'Undisclosed']
|
|
49
|
+
},
|
|
50
|
+
height: {
|
|
51
|
+
type: 'number'
|
|
52
|
+
},
|
|
53
|
+
dateOfBirth: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
format: 'date'
|
|
56
|
+
},
|
|
57
|
+
rating: {
|
|
58
|
+
type: 'integer'
|
|
59
|
+
},
|
|
60
|
+
committer: {
|
|
61
|
+
type: 'boolean'
|
|
62
|
+
},
|
|
63
|
+
address: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
street: {
|
|
67
|
+
type: 'string'
|
|
68
|
+
},
|
|
69
|
+
streetnumber: {
|
|
70
|
+
type: 'string'
|
|
71
|
+
},
|
|
72
|
+
postalCode: {
|
|
73
|
+
type: 'string'
|
|
74
|
+
},
|
|
75
|
+
city: {
|
|
76
|
+
type: 'string'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const uischema = {
|
|
84
|
+
type: 'VerticalLayout',
|
|
85
|
+
elements: [
|
|
86
|
+
{
|
|
87
|
+
type: 'HorizontalLayout',
|
|
88
|
+
elements: [
|
|
89
|
+
{
|
|
90
|
+
type: 'Control',
|
|
91
|
+
scope: '#/properties/firstName'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'Control',
|
|
95
|
+
scope: '#/properties/lastName'
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: 'HorizontalLayout',
|
|
101
|
+
elements: [
|
|
102
|
+
{
|
|
103
|
+
type: 'Control',
|
|
104
|
+
scope: '#/properties/age'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'Control',
|
|
108
|
+
scope: '#/properties/dateOfBirth'
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: 'HorizontalLayout',
|
|
114
|
+
elements: [
|
|
115
|
+
{
|
|
116
|
+
type: 'Control',
|
|
117
|
+
scope: '#/properties/height'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
type: 'Control',
|
|
121
|
+
scope: '#/properties/gender'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: 'Control',
|
|
125
|
+
scope: '#/properties/committer'
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: 'Group',
|
|
131
|
+
label: 'Address for Shipping T-Shirt',
|
|
132
|
+
elements: [
|
|
133
|
+
{
|
|
134
|
+
type: 'HorizontalLayout',
|
|
135
|
+
elements: [
|
|
136
|
+
{
|
|
137
|
+
type: 'Control',
|
|
138
|
+
scope: '#/properties/address/properties/street'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'Control',
|
|
142
|
+
scope: '#/properties/address/properties/streetnumber'
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: 'HorizontalLayout',
|
|
148
|
+
elements: [
|
|
149
|
+
{
|
|
150
|
+
type: 'Control',
|
|
151
|
+
scope: '#/properties/address/properties/postalCode'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'Control',
|
|
155
|
+
scope: '#/properties/address/properties/city'
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
rule: {
|
|
161
|
+
effect: 'ENABLE',
|
|
162
|
+
condition: {
|
|
163
|
+
scope: '#/properties/committer',
|
|
164
|
+
schema: {
|
|
165
|
+
const: true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const data = {
|
|
174
|
+
firstName: 'Max',
|
|
175
|
+
lastName: 'Power',
|
|
176
|
+
committer: false
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
registerExamples([
|
|
180
|
+
{
|
|
181
|
+
name: '1884',
|
|
182
|
+
label: 'Issue 1884 - Committer enable/disable Address',
|
|
183
|
+
data,
|
|
184
|
+
schema,
|
|
185
|
+
uischema
|
|
186
|
+
}
|
|
187
|
+
]);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2022 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
|
+
import { UISchemaElement } from '@jsonforms/core';
|
|
27
|
+
|
|
28
|
+
export const schema = {
|
|
29
|
+
type: 'object',
|
|
30
|
+
definitions: {
|
|
31
|
+
import: {
|
|
32
|
+
title: 'Import',
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {
|
|
35
|
+
eClass: {
|
|
36
|
+
const: 'http://my_schema/1.0.0#//Import'
|
|
37
|
+
},
|
|
38
|
+
document: {
|
|
39
|
+
type: 'string'
|
|
40
|
+
},
|
|
41
|
+
package: {
|
|
42
|
+
type: 'string'
|
|
43
|
+
},
|
|
44
|
+
prefix: {
|
|
45
|
+
type: 'string'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
properties: {
|
|
51
|
+
import: {
|
|
52
|
+
type: 'array',
|
|
53
|
+
items: {
|
|
54
|
+
$ref: '#/definitions/import'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const uischema: UISchemaElement = undefined;
|
|
61
|
+
|
|
62
|
+
export const data = {
|
|
63
|
+
import: [
|
|
64
|
+
{
|
|
65
|
+
document: 'Document1',
|
|
66
|
+
package: 'Package1',
|
|
67
|
+
prefix: 'Prefix'
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
registerExamples([
|
|
73
|
+
{
|
|
74
|
+
name: '1948_with',
|
|
75
|
+
label: 'Issue 1948 with schema',
|
|
76
|
+
data,
|
|
77
|
+
schema,
|
|
78
|
+
uischema
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: '1948_without',
|
|
82
|
+
label: 'Issue 1948 w/o schema',
|
|
83
|
+
data,
|
|
84
|
+
schema: undefined,
|
|
85
|
+
uischema
|
|
86
|
+
}
|
|
87
|
+
]);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2022 EclipseSource
|
|
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
|
+
import { ControlElement } from '@jsonforms/core';
|
|
27
|
+
|
|
28
|
+
export const schemaAnyOf = {
|
|
29
|
+
type: "array",
|
|
30
|
+
items: {
|
|
31
|
+
anyOf: [
|
|
32
|
+
{
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
value: {
|
|
36
|
+
type: "string"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
required: ["value"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
value: {
|
|
45
|
+
type: "number"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
required: ["value"]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const schemaOneOf = {
|
|
55
|
+
type: "array",
|
|
56
|
+
items: {
|
|
57
|
+
oneOf: [
|
|
58
|
+
{
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
value: {
|
|
62
|
+
type: "string"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
required: ["value"]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "object",
|
|
69
|
+
properties: {
|
|
70
|
+
value: {
|
|
71
|
+
type: "number"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
required: ["value"]
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const uischema: ControlElement = {
|
|
81
|
+
type: 'Control',
|
|
82
|
+
scope: '#'
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const data: any[] = [];
|
|
86
|
+
|
|
87
|
+
registerExamples([
|
|
88
|
+
{
|
|
89
|
+
name: '1996_anyOf',
|
|
90
|
+
label: 'Issue 1996 - array with anyOf items',
|
|
91
|
+
data,
|
|
92
|
+
schema: schemaAnyOf,
|
|
93
|
+
uischema
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: '1996_oneOf',
|
|
97
|
+
label: 'Issue 1996 - array with oneOf items',
|
|
98
|
+
data,
|
|
99
|
+
schema: schemaOneOf,
|
|
100
|
+
uischema
|
|
101
|
+
}
|
|
102
|
+
]);
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
+
import { Translator } from '@jsonforms/core';
|
|
26
|
+
import get from 'lodash/get';
|
|
25
27
|
import { registerExamples } from '../register';
|
|
26
28
|
|
|
27
29
|
export const schema = {
|
|
@@ -93,7 +95,7 @@ export const uischema = {
|
|
|
93
95
|
elements: [
|
|
94
96
|
{
|
|
95
97
|
type: 'Category',
|
|
96
|
-
label: '
|
|
98
|
+
label: 'categoryLabelKey',
|
|
97
99
|
elements: [
|
|
98
100
|
{
|
|
99
101
|
type: 'HorizontalLayout',
|
|
@@ -133,7 +135,7 @@ export const uischema = {
|
|
|
133
135
|
},
|
|
134
136
|
{
|
|
135
137
|
type: 'Category',
|
|
136
|
-
|
|
138
|
+
i18n: 'address',
|
|
137
139
|
elements: [
|
|
138
140
|
{
|
|
139
141
|
type: 'HorizontalLayout',
|
|
@@ -284,6 +286,15 @@ const uischema_1713 = {
|
|
|
284
286
|
]
|
|
285
287
|
};
|
|
286
288
|
|
|
289
|
+
export const translations = {
|
|
290
|
+
categoryLabelKey: 'Basic',
|
|
291
|
+
address: {
|
|
292
|
+
label: "Address",
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
export const translate: Translator = (key: string, defaultMessage: string) => {
|
|
296
|
+
return get(translations, key) ?? defaultMessage
|
|
297
|
+
};
|
|
287
298
|
|
|
288
299
|
registerExamples([
|
|
289
300
|
{
|
|
@@ -291,7 +302,8 @@ registerExamples([
|
|
|
291
302
|
label: 'Categorization',
|
|
292
303
|
data,
|
|
293
304
|
schema,
|
|
294
|
-
uischema
|
|
305
|
+
uischema,
|
|
306
|
+
i18n: { locale: 'en', translate: translate }
|
|
295
307
|
},
|
|
296
308
|
{
|
|
297
309
|
name: '1713',
|
package/src/examples/i18n.ts
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { registerExamples } from '../register';
|
|
26
26
|
import { personCoreSchema } from './person';
|
|
27
|
-
import { JsonFormsCore, updateErrors, AnyAction, Dispatch } from '@jsonforms/core';
|
|
27
|
+
import { JsonFormsCore, updateErrors, AnyAction, Dispatch, Translator } from '@jsonforms/core';
|
|
28
|
+
import get from 'lodash/get';
|
|
28
29
|
const localize = require('ajv-i18n');
|
|
29
30
|
|
|
30
31
|
export const onChange = (dispatch: Dispatch<AnyAction>) => (
|
|
@@ -42,7 +43,8 @@ export const uischema = {
|
|
|
42
43
|
type: 'VerticalLayout',
|
|
43
44
|
elements: [
|
|
44
45
|
{
|
|
45
|
-
type: '
|
|
46
|
+
type: 'Group',
|
|
47
|
+
i18n: 'basicInfoGroup',
|
|
46
48
|
elements: [
|
|
47
49
|
{
|
|
48
50
|
type: 'Control',
|
|
@@ -56,7 +58,7 @@ export const uischema = {
|
|
|
56
58
|
},
|
|
57
59
|
{
|
|
58
60
|
type: 'Label',
|
|
59
|
-
text: '
|
|
61
|
+
text: 'additionalInformationLabel',
|
|
60
62
|
},
|
|
61
63
|
{
|
|
62
64
|
type: 'HorizontalLayout',
|
|
@@ -83,12 +85,26 @@ export const data = {
|
|
|
83
85
|
postalCode: '12345'
|
|
84
86
|
};
|
|
85
87
|
|
|
88
|
+
export const translations = {
|
|
89
|
+
basicInfoGroup: {
|
|
90
|
+
label: 'Basic Information'
|
|
91
|
+
},
|
|
92
|
+
additionalInformationLabel: 'Additional Information'
|
|
93
|
+
};
|
|
94
|
+
export const translate: Translator = (key: string, defaultMessage: string) => {
|
|
95
|
+
return get(translations, key) ?? defaultMessage;
|
|
96
|
+
};
|
|
97
|
+
|
|
86
98
|
registerExamples([
|
|
87
99
|
{
|
|
88
100
|
name: 'i18n',
|
|
89
101
|
label: 'Person (i18n)',
|
|
90
102
|
data,
|
|
91
103
|
schema: personCoreSchema,
|
|
92
|
-
uischema
|
|
104
|
+
uischema,
|
|
105
|
+
i18n: {
|
|
106
|
+
translate: translate,
|
|
107
|
+
locale: 'en'
|
|
108
|
+
}
|
|
93
109
|
}
|
|
94
110
|
]);
|
package/src/examples/oneOf.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -49,6 +49,7 @@ import * as generateSchema from './examples/generate';
|
|
|
49
49
|
import * as generateUISchema from './examples/generateUI';
|
|
50
50
|
import * as layout from './examples/layout';
|
|
51
51
|
import * as person from './examples/person';
|
|
52
|
+
import * as issue_1884 from './examples/1884';
|
|
52
53
|
import * as rule from './examples/rule';
|
|
53
54
|
import * as ruleInheritance from './examples/ruleInheritance';
|
|
54
55
|
import * as config from './examples/config';
|
|
@@ -59,6 +60,8 @@ import * as listWithDetail from './examples/list-with-detail';
|
|
|
59
60
|
import * as listWithDetailRegistered from './examples/list-with-detail-registered';
|
|
60
61
|
import * as object from './examples/object';
|
|
61
62
|
import * as i18n from './examples/i18n';
|
|
63
|
+
import * as issue_1948 from './examples/1948';
|
|
64
|
+
import * as issue_1996 from './examples/1996';
|
|
62
65
|
import * as issue_1169 from './examples/1169';
|
|
63
66
|
import * as issue_1220 from './examples/1220';
|
|
64
67
|
import * as issue_1253 from './examples/1253';
|
|
@@ -83,6 +86,8 @@ export * from './example';
|
|
|
83
86
|
import * as ifThenElse from './examples/if_then_else';
|
|
84
87
|
|
|
85
88
|
export {
|
|
89
|
+
issue_1948,
|
|
90
|
+
issue_1996,
|
|
86
91
|
defaultExample,
|
|
87
92
|
allOf,
|
|
88
93
|
anyOf,
|
|
@@ -138,5 +143,6 @@ export {
|
|
|
138
143
|
bug_1779,
|
|
139
144
|
bug_1645,
|
|
140
145
|
conditionalSchemaComposition,
|
|
141
|
-
additionalErrors
|
|
146
|
+
additionalErrors,
|
|
147
|
+
issue_1884,
|
|
142
148
|
};
|