@jsonforms/examples 3.1.0-alpha.1 → 3.1.0-alpha.3
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/.eslintrc.js +29 -0
- package/.prettierrc.js +6 -0
- package/README.md +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/globals.html +2074 -3228
- package/docs/index.html +0 -30
- package/lib/examples/1884.d.ts +8 -0
- package/lib/examples/additional-errors.d.ts +16 -1
- package/lib/examples/anyOf.d.ts +15 -2
- package/lib/examples/arrays.d.ts +13 -2
- package/lib/examples/arraysI18n.d.ts +52 -0
- package/lib/examples/dates.d.ts +115 -1
- package/lib/examples/enum.d.ts +16 -0
- package/lib/examples/generate-dynamic.d.ts +15 -0
- package/lib/examples/list-with-detail-primitives.d.ts +36 -0
- package/lib/examples/list-with-detail-registered.d.ts +55 -1
- package/lib/examples/list-with-detail.d.ts +191 -1
- package/lib/examples/nestedCategorization.d.ts +57 -0
- package/lib/examples/radioGroup.d.ts +42 -1
- package/lib/index.d.ts +8 -19
- package/lib/jsonforms-examples.cjs.js +2299 -2863
- package/lib/jsonforms-examples.cjs.js.map +1 -1
- package/lib/jsonforms-examples.esm.js +2288 -2869
- package/lib/jsonforms-examples.esm.js.map +1 -1
- package/package.json +13 -6
- package/rollup.config.js +12 -12
- package/src/example.ts +3 -3
- package/src/examples/1884.ts +52 -48
- package/src/examples/1948.ts +19 -19
- package/src/examples/additional-errors.ts +28 -25
- package/src/examples/allOf.ts +18 -18
- package/src/examples/anyOf-oneOf-allOf-resolve.ts +21 -21
- package/src/examples/anyOf.ts +42 -24
- package/src/examples/arrays-with-custom-element-label.ts +21 -21
- package/src/examples/arrays-with-detail-and-rule.ts +28 -28
- package/src/examples/arrays-with-detail.ts +21 -21
- package/src/examples/arrays-with-sorting.ts +35 -35
- package/src/examples/arrays.ts +40 -35
- package/src/examples/arraysI18n.ts +107 -0
- package/src/examples/{steppershownav.ts → categorization-stepper-nav-buttons.ts} +6 -6
- package/src/examples/{stepper.ts → categorization-stepper.ts} +5 -5
- package/src/examples/categorization.ts +119 -119
- package/src/examples/conditional-schema-compositions.ts +20 -20
- package/src/examples/config.ts +15 -15
- package/src/examples/control-options.ts +81 -82
- package/src/examples/dates.ts +34 -34
- package/src/examples/default.ts +22 -22
- package/src/examples/{multi-enum.ts → enum-multi.ts} +14 -14
- package/src/examples/enum.ts +65 -33
- package/src/examples/enumInArray.ts +10 -10
- package/src/examples/{dynamic.ts → generate-dynamic.ts} +10 -10
- package/src/examples/generate.ts +2 -2
- package/src/examples/generateUI.ts +2 -2
- package/src/examples/huge.ts +381 -377
- package/src/examples/i18n.ts +37 -28
- package/src/examples/if_then_else.ts +4 -4
- package/src/examples/layout.ts +29 -29
- package/src/examples/{booleanToggle.ts → list-with-detail-primitives.ts} +46 -33
- package/src/examples/list-with-detail-registered.ts +26 -26
- package/src/examples/list-with-detail.ts +82 -82
- package/src/examples/nestedArrays.ts +40 -35
- package/src/examples/nestedCategorization.ts +175 -0
- package/src/examples/numbers.ts +17 -17
- package/src/examples/object.ts +24 -24
- package/src/examples/onChange.ts +28 -22
- package/src/examples/oneOf-recursive.ts +15 -15
- package/src/examples/oneOf.ts +99 -96
- package/src/examples/oneOfArray.ts +20 -20
- package/src/examples/person.ts +35 -35
- package/src/examples/radioGroup.ts +52 -53
- package/src/examples/readonly.ts +14 -14
- package/src/examples/rule.ts +26 -26
- package/src/examples/ruleInheritance.ts +37 -34
- package/src/examples/scope.ts +26 -26
- package/src/examples/stringArray.ts +10 -10
- package/src/examples/text.ts +19 -19
- package/src/index.ts +11 -33
- package/src/register.ts +6 -3
- package/stats.html +2462 -329
- package/tsconfig.json +2 -6
- package/lib/examples/1169.d.ts +0 -24
- package/lib/examples/1220.d.ts +0 -4
- package/lib/examples/1253.d.ts +0 -16
- package/lib/examples/1254.d.ts +0 -21
- package/lib/examples/1645.d.ts +0 -68
- package/lib/examples/1779.d.ts +0 -1
- package/lib/examples/1996.d.ts +0 -31
- package/lib/examples/booleanToggle.d.ts +0 -62
- package/lib/examples/day1.d.ts +0 -23
- package/lib/examples/day2.d.ts +0 -42
- package/lib/examples/day3.d.ts +0 -51
- package/lib/examples/day4.d.ts +0 -72
- package/lib/examples/day5.d.ts +0 -133
- package/lib/examples/day6.d.ts +0 -85
- package/lib/examples/dynamic.d.ts +0 -1
- package/src/examples/1169.ts +0 -62
- package/src/examples/1220.ts +0 -146
- package/src/examples/1253.ts +0 -212
- package/src/examples/1254.ts +0 -67
- package/src/examples/1645.ts +0 -66
- package/src/examples/1779.ts +0 -83
- package/src/examples/1996.ts +0 -102
- package/src/examples/day1.ts +0 -61
- package/src/examples/day2.ts +0 -62
- package/src/examples/day3.ts +0 -76
- package/src/examples/day4.ts +0 -83
- package/src/examples/day5.ts +0 -169
- package/src/examples/day6.ts +0 -44
- /package/lib/examples/{steppershownav.d.ts → categorization-stepper-nav-buttons.d.ts} +0 -0
- /package/lib/examples/{stepper.d.ts → categorization-stepper.d.ts} +0 -0
- /package/lib/examples/{multi-enum.d.ts → enum-multi.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/examples",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.3",
|
|
4
4
|
"description": "JSON Forms Example Data",
|
|
5
5
|
"repository": "https://github.com/eclipsesource/jsonforms",
|
|
6
6
|
"bugs": "https://github.com/eclipsesource/jsonforms/issues",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "rollup -c rollup.config.js",
|
|
39
39
|
"clean": "rimraf lib coverage dist .nyc_output 2> /dev/null",
|
|
40
|
-
"lint": "
|
|
40
|
+
"lint": "eslint .",
|
|
41
|
+
"lint:fix": "eslint --fix .",
|
|
41
42
|
"test": "echo 'Nothing to do for `examples` package'",
|
|
42
43
|
"doc": "typedoc --name 'JSON Forms Examples' --mode file --excludeExternals --theme ../../typedoc-jsonforms --out docs src"
|
|
43
44
|
},
|
|
@@ -45,19 +46,25 @@
|
|
|
45
46
|
"ajv-i18n": "^3.5.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"@jsonforms/core": "3.1.0-alpha.
|
|
49
|
+
"@jsonforms/core": "3.1.0-alpha.3"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@jsonforms/core": "^3.1.0-alpha.
|
|
52
|
+
"@jsonforms/core": "^3.1.0-alpha.3",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
54
|
+
"@typescript-eslint/parser": "^5.54.1",
|
|
55
|
+
"eslint": "^7.32.0",
|
|
56
|
+
"eslint-config-prettier": "^8.7.0",
|
|
57
|
+
"eslint-plugin-import": "^2.27.5",
|
|
58
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
59
|
+
"prettier": "^2.8.4",
|
|
52
60
|
"rimraf": "^3.0.2",
|
|
53
61
|
"rollup": "^2.78.0",
|
|
54
62
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
55
63
|
"rollup-plugin-typescript2": "^0.31.1",
|
|
56
64
|
"rollup-plugin-visualizer": "^5.4.1",
|
|
57
65
|
"tslib": "^2.2.0",
|
|
58
|
-
"tslint": "^5.20.1",
|
|
59
66
|
"typedoc": "^0.19.2",
|
|
60
67
|
"typescript": "4.2.3"
|
|
61
68
|
},
|
|
62
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f8ea38f9f9dd3d46cbfde269ec43e9eb1632e428"
|
|
63
70
|
}
|
package/rollup.config.js
CHANGED
|
@@ -9,8 +9,8 @@ const baseConfig = {
|
|
|
9
9
|
external: [
|
|
10
10
|
...Object.keys(packageJson.dependencies),
|
|
11
11
|
...Object.keys(packageJson.peerDependencies),
|
|
12
|
-
/^lodash
|
|
13
|
-
]
|
|
12
|
+
/^lodash\/.*/,
|
|
13
|
+
],
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export default [
|
|
@@ -19,30 +19,30 @@ export default [
|
|
|
19
19
|
output: {
|
|
20
20
|
file: packageJson.module,
|
|
21
21
|
format: 'esm',
|
|
22
|
-
sourcemap: true
|
|
22
|
+
sourcemap: true,
|
|
23
23
|
},
|
|
24
24
|
plugins: [
|
|
25
25
|
typescript(),
|
|
26
26
|
cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx'] }),
|
|
27
|
-
visualizer({ open: false })
|
|
28
|
-
]
|
|
27
|
+
visualizer({ open: false }),
|
|
28
|
+
],
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
...baseConfig,
|
|
32
32
|
output: {
|
|
33
33
|
file: packageJson.main,
|
|
34
34
|
format: 'cjs',
|
|
35
|
-
sourcemap: true
|
|
35
|
+
sourcemap: true,
|
|
36
36
|
},
|
|
37
37
|
plugins: [
|
|
38
38
|
typescript({
|
|
39
39
|
tsconfigOverride: {
|
|
40
40
|
compilerOptions: {
|
|
41
|
-
target: 'ES5'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
41
|
+
target: 'ES5',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
44
|
}),
|
|
45
|
-
cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx'] })
|
|
46
|
-
]
|
|
47
|
-
}
|
|
45
|
+
cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx'] }),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
48
|
];
|
package/src/example.ts
CHANGED
|
@@ -22,13 +22,13 @@
|
|
|
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 {
|
|
25
|
+
import {
|
|
26
26
|
JsonFormsCellRendererRegistryEntry,
|
|
27
27
|
JsonFormsUISchemaRegistryEntry,
|
|
28
28
|
JsonFormsRendererRegistryEntry,
|
|
29
29
|
JsonSchema,
|
|
30
30
|
UISchemaElement,
|
|
31
|
-
JsonFormsI18nState
|
|
31
|
+
JsonFormsI18nState,
|
|
32
32
|
} from '@jsonforms/core';
|
|
33
33
|
|
|
34
34
|
export interface ExampleDescription {
|
|
@@ -39,7 +39,7 @@ export interface ExampleDescription {
|
|
|
39
39
|
uischema: UISchemaElement;
|
|
40
40
|
uischemas?: JsonFormsUISchemaRegistryEntry[];
|
|
41
41
|
config?: any;
|
|
42
|
-
actions?: { label: string
|
|
42
|
+
actions?: { label: string; apply: (props: StateProps) => any }[];
|
|
43
43
|
i18n?: JsonFormsI18nState;
|
|
44
44
|
}
|
|
45
45
|
|
package/src/examples/1884.ts
CHANGED
|
@@ -31,100 +31,104 @@ export const schema = {
|
|
|
31
31
|
firstName: {
|
|
32
32
|
type: 'string',
|
|
33
33
|
minLength: 2,
|
|
34
|
-
maxLength: 20
|
|
34
|
+
maxLength: 20,
|
|
35
35
|
},
|
|
36
36
|
lastName: {
|
|
37
37
|
type: 'string',
|
|
38
38
|
minLength: 5,
|
|
39
|
-
maxLength: 15
|
|
39
|
+
maxLength: 15,
|
|
40
40
|
},
|
|
41
41
|
age: {
|
|
42
42
|
type: 'integer',
|
|
43
43
|
minimum: 18,
|
|
44
|
-
maximum: 100
|
|
44
|
+
maximum: 100,
|
|
45
45
|
},
|
|
46
46
|
gender: {
|
|
47
47
|
type: 'string',
|
|
48
|
-
enum: ['Male', 'Female', 'Undisclosed']
|
|
48
|
+
enum: ['Male', 'Female', 'Undisclosed'],
|
|
49
49
|
},
|
|
50
50
|
height: {
|
|
51
|
-
type: 'number'
|
|
51
|
+
type: 'number',
|
|
52
52
|
},
|
|
53
53
|
dateOfBirth: {
|
|
54
54
|
type: 'string',
|
|
55
|
-
format: 'date'
|
|
55
|
+
format: 'date',
|
|
56
56
|
},
|
|
57
57
|
rating: {
|
|
58
|
-
type: 'integer'
|
|
58
|
+
type: 'integer',
|
|
59
59
|
},
|
|
60
60
|
committer: {
|
|
61
|
-
type: 'boolean'
|
|
61
|
+
type: 'boolean',
|
|
62
62
|
},
|
|
63
63
|
address: {
|
|
64
64
|
type: 'object',
|
|
65
65
|
properties: {
|
|
66
66
|
street: {
|
|
67
|
-
type: 'string'
|
|
67
|
+
type: 'string',
|
|
68
68
|
},
|
|
69
69
|
streetnumber: {
|
|
70
|
-
type: 'string'
|
|
70
|
+
type: 'string',
|
|
71
71
|
},
|
|
72
72
|
postalCode: {
|
|
73
|
-
type: 'string'
|
|
73
|
+
type: 'string',
|
|
74
74
|
},
|
|
75
75
|
city: {
|
|
76
|
-
type: 'string'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
76
|
+
type: 'string',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export const uischema = {
|
|
84
84
|
type: 'VerticalLayout',
|
|
85
85
|
elements: [
|
|
86
|
+
{
|
|
87
|
+
type: 'Label',
|
|
88
|
+
text: 'Toggle the committer boolean to enable/disable the address block.',
|
|
89
|
+
},
|
|
86
90
|
{
|
|
87
91
|
type: 'HorizontalLayout',
|
|
88
92
|
elements: [
|
|
89
93
|
{
|
|
90
94
|
type: 'Control',
|
|
91
|
-
scope: '#/properties/firstName'
|
|
95
|
+
scope: '#/properties/firstName',
|
|
92
96
|
},
|
|
93
97
|
{
|
|
94
98
|
type: 'Control',
|
|
95
|
-
scope: '#/properties/lastName'
|
|
96
|
-
}
|
|
97
|
-
]
|
|
99
|
+
scope: '#/properties/lastName',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
98
102
|
},
|
|
99
103
|
{
|
|
100
104
|
type: 'HorizontalLayout',
|
|
101
105
|
elements: [
|
|
102
106
|
{
|
|
103
107
|
type: 'Control',
|
|
104
|
-
scope: '#/properties/age'
|
|
108
|
+
scope: '#/properties/age',
|
|
105
109
|
},
|
|
106
110
|
{
|
|
107
111
|
type: 'Control',
|
|
108
|
-
scope: '#/properties/dateOfBirth'
|
|
109
|
-
}
|
|
110
|
-
]
|
|
112
|
+
scope: '#/properties/dateOfBirth',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
111
115
|
},
|
|
112
116
|
{
|
|
113
117
|
type: 'HorizontalLayout',
|
|
114
118
|
elements: [
|
|
115
119
|
{
|
|
116
120
|
type: 'Control',
|
|
117
|
-
scope: '#/properties/height'
|
|
121
|
+
scope: '#/properties/height',
|
|
118
122
|
},
|
|
119
123
|
{
|
|
120
124
|
type: 'Control',
|
|
121
|
-
scope: '#/properties/gender'
|
|
125
|
+
scope: '#/properties/gender',
|
|
122
126
|
},
|
|
123
127
|
{
|
|
124
128
|
type: 'Control',
|
|
125
|
-
scope: '#/properties/committer'
|
|
126
|
-
}
|
|
127
|
-
]
|
|
129
|
+
scope: '#/properties/committer',
|
|
130
|
+
},
|
|
131
|
+
],
|
|
128
132
|
},
|
|
129
133
|
{
|
|
130
134
|
type: 'Group',
|
|
@@ -135,53 +139,53 @@ export const uischema = {
|
|
|
135
139
|
elements: [
|
|
136
140
|
{
|
|
137
141
|
type: 'Control',
|
|
138
|
-
scope: '#/properties/address/properties/street'
|
|
142
|
+
scope: '#/properties/address/properties/street',
|
|
139
143
|
},
|
|
140
144
|
{
|
|
141
145
|
type: 'Control',
|
|
142
|
-
scope: '#/properties/address/properties/streetnumber'
|
|
143
|
-
}
|
|
144
|
-
]
|
|
146
|
+
scope: '#/properties/address/properties/streetnumber',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
145
149
|
},
|
|
146
150
|
{
|
|
147
151
|
type: 'HorizontalLayout',
|
|
148
152
|
elements: [
|
|
149
153
|
{
|
|
150
154
|
type: 'Control',
|
|
151
|
-
scope: '#/properties/address/properties/postalCode'
|
|
155
|
+
scope: '#/properties/address/properties/postalCode',
|
|
152
156
|
},
|
|
153
157
|
{
|
|
154
158
|
type: 'Control',
|
|
155
|
-
scope: '#/properties/address/properties/city'
|
|
156
|
-
}
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
+
scope: '#/properties/address/properties/city',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
159
163
|
],
|
|
160
164
|
rule: {
|
|
161
165
|
effect: 'ENABLE',
|
|
162
166
|
condition: {
|
|
163
167
|
scope: '#/properties/committer',
|
|
164
168
|
schema: {
|
|
165
|
-
const: true
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
]
|
|
169
|
+
const: true,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
],
|
|
171
175
|
};
|
|
172
176
|
|
|
173
177
|
export const data = {
|
|
174
178
|
firstName: 'Max',
|
|
175
179
|
lastName: 'Power',
|
|
176
|
-
committer: false
|
|
180
|
+
committer: false,
|
|
177
181
|
};
|
|
178
182
|
|
|
179
183
|
registerExamples([
|
|
180
184
|
{
|
|
181
185
|
name: '1884',
|
|
182
|
-
label: 'Issue 1884 -
|
|
186
|
+
label: 'Issue 1884 - Nested enable/disable',
|
|
183
187
|
data,
|
|
184
188
|
schema,
|
|
185
|
-
uischema
|
|
186
|
-
}
|
|
189
|
+
uischema,
|
|
190
|
+
},
|
|
187
191
|
]);
|
package/src/examples/1948.ts
CHANGED
|
@@ -33,28 +33,28 @@ export const schema = {
|
|
|
33
33
|
type: 'object',
|
|
34
34
|
properties: {
|
|
35
35
|
eClass: {
|
|
36
|
-
const: 'http://my_schema/1.0.0#//Import'
|
|
36
|
+
const: 'http://my_schema/1.0.0#//Import',
|
|
37
37
|
},
|
|
38
38
|
document: {
|
|
39
|
-
type: 'string'
|
|
39
|
+
type: 'string',
|
|
40
40
|
},
|
|
41
41
|
package: {
|
|
42
|
-
type: 'string'
|
|
42
|
+
type: 'string',
|
|
43
43
|
},
|
|
44
44
|
prefix: {
|
|
45
|
-
type: 'string'
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
45
|
+
type: 'string',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
49
|
},
|
|
50
50
|
properties: {
|
|
51
51
|
import: {
|
|
52
52
|
type: 'array',
|
|
53
53
|
items: {
|
|
54
|
-
$ref: '#/definitions/import'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
54
|
+
$ref: '#/definitions/import',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
export const uischema: UISchemaElement = undefined;
|
|
@@ -64,24 +64,24 @@ export const data = {
|
|
|
64
64
|
{
|
|
65
65
|
document: 'Document1',
|
|
66
66
|
package: 'Package1',
|
|
67
|
-
prefix: 'Prefix'
|
|
68
|
-
}
|
|
69
|
-
]
|
|
67
|
+
prefix: 'Prefix',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
registerExamples([
|
|
73
73
|
{
|
|
74
74
|
name: '1948_with',
|
|
75
|
-
label: 'Issue 1948 with schema',
|
|
75
|
+
label: 'Issue 1948 - Array renderer selection (with schema)',
|
|
76
76
|
data,
|
|
77
77
|
schema,
|
|
78
|
-
uischema
|
|
78
|
+
uischema,
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
name: '1948_without',
|
|
82
|
-
label: 'Issue 1948 w/o schema',
|
|
82
|
+
label: 'Issue 1948 - Array renderer selection (w/o schema)',
|
|
83
83
|
data,
|
|
84
84
|
schema: undefined,
|
|
85
|
-
uischema
|
|
86
|
-
}
|
|
85
|
+
uischema,
|
|
86
|
+
},
|
|
87
87
|
]);
|
|
@@ -25,33 +25,36 @@
|
|
|
25
25
|
import { ErrorObject } from 'ajv';
|
|
26
26
|
import { StateProps } from '../example';
|
|
27
27
|
import { registerExamples } from '../register';
|
|
28
|
-
import { schema, uischema, data } from './person'
|
|
28
|
+
import { schema, uischema, data } from './person';
|
|
29
29
|
|
|
30
|
-
const additionalErrors: ErrorObject[] = [];
|
|
30
|
+
export const additionalErrors: ErrorObject[] = [];
|
|
31
31
|
|
|
32
|
-
const actions = [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
32
|
+
export const actions = [
|
|
33
|
+
{
|
|
34
|
+
label: 'Add additional error',
|
|
35
|
+
apply: (props: StateProps) => {
|
|
36
|
+
additionalErrors.push({
|
|
37
|
+
instancePath: '/personalData/age',
|
|
38
|
+
message: `New error #${additionalErrors.length + 1}`,
|
|
39
|
+
schemaPath: '',
|
|
40
|
+
keyword: '',
|
|
41
|
+
params: {},
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
...props,
|
|
45
|
+
additionalErrors: [...additionalErrors],
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
|
47
50
|
|
|
48
51
|
registerExamples([
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
{
|
|
53
|
+
name: 'additional-errors',
|
|
54
|
+
label: 'Additional errors',
|
|
55
|
+
data,
|
|
56
|
+
schema,
|
|
57
|
+
uischema,
|
|
58
|
+
actions,
|
|
59
|
+
},
|
|
57
60
|
]);
|
package/src/examples/allOf.ts
CHANGED
|
@@ -33,10 +33,10 @@ export const schema = {
|
|
|
33
33
|
properties: {
|
|
34
34
|
street_address: { type: 'string' },
|
|
35
35
|
city: { type: 'string' },
|
|
36
|
-
state: { type: 'string' }
|
|
36
|
+
state: { type: 'string' },
|
|
37
37
|
},
|
|
38
|
-
required: ['street_address', 'city', 'state']
|
|
39
|
-
}
|
|
38
|
+
required: ['street_address', 'city', 'state'],
|
|
39
|
+
},
|
|
40
40
|
},
|
|
41
41
|
|
|
42
42
|
type: 'object',
|
|
@@ -51,14 +51,14 @@ export const schema = {
|
|
|
51
51
|
properties: {
|
|
52
52
|
type: {
|
|
53
53
|
type: 'string',
|
|
54
|
-
enum: ['residential', 'business']
|
|
55
|
-
}
|
|
54
|
+
enum: ['residential', 'business'],
|
|
55
|
+
},
|
|
56
56
|
},
|
|
57
|
-
required: ['type']
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
57
|
+
required: ['type'],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
export const uischema = {
|
|
@@ -67,21 +67,21 @@ export const uischema = {
|
|
|
67
67
|
{
|
|
68
68
|
label: 'Billing address',
|
|
69
69
|
type: 'Control',
|
|
70
|
-
scope: '#/properties/billing_address'
|
|
70
|
+
scope: '#/properties/billing_address',
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
type: 'Control',
|
|
74
|
-
scope: '#/properties/shipping_address'
|
|
75
|
-
}
|
|
76
|
-
]
|
|
74
|
+
scope: '#/properties/shipping_address',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
const data = {
|
|
80
80
|
billing_address: {
|
|
81
81
|
street_address: '1600 Pennsylvania Avenue NW',
|
|
82
82
|
city: 'Washington',
|
|
83
|
-
state: 'DC'
|
|
84
|
-
}
|
|
83
|
+
state: 'DC',
|
|
84
|
+
},
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
registerExamples([
|
|
@@ -90,6 +90,6 @@ registerExamples([
|
|
|
90
90
|
label: 'allOf',
|
|
91
91
|
data,
|
|
92
92
|
schema,
|
|
93
|
-
uischema
|
|
94
|
-
}
|
|
93
|
+
uischema,
|
|
94
|
+
},
|
|
95
95
|
]);
|
|
@@ -30,9 +30,9 @@ export const schema = {
|
|
|
30
30
|
type: 'object',
|
|
31
31
|
properties: {
|
|
32
32
|
width: {
|
|
33
|
-
type: 'integer'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
33
|
+
type: 'integer',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
36
|
},
|
|
37
37
|
Child: {
|
|
38
38
|
type: 'object',
|
|
@@ -41,19 +41,19 @@ export const schema = {
|
|
|
41
41
|
{
|
|
42
42
|
properties: {
|
|
43
43
|
geometry: {
|
|
44
|
-
type: 'string'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
44
|
+
type: 'string',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
50
|
},
|
|
51
51
|
type: 'object',
|
|
52
52
|
properties: {
|
|
53
53
|
element: {
|
|
54
|
-
$ref: '#/$defs/Child'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
54
|
+
$ref: '#/$defs/Child',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
export const uischema = {
|
|
@@ -61,25 +61,25 @@ export const uischema = {
|
|
|
61
61
|
elements: [
|
|
62
62
|
{
|
|
63
63
|
type: 'Label',
|
|
64
|
-
text: 'AllOfRenderer'
|
|
64
|
+
text: 'AllOfRenderer',
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
type: 'Control',
|
|
68
|
-
scope: '#/properties/element'
|
|
68
|
+
scope: '#/properties/element',
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
type: 'Label',
|
|
72
|
-
text: 'Manual controls'
|
|
72
|
+
text: 'Manual controls',
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
type: 'Control',
|
|
76
|
-
scope: '#/properties/element/properties/width'
|
|
76
|
+
scope: '#/properties/element/properties/width',
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
type: 'Control',
|
|
80
|
-
scope: '#/properties/element/properties/geometry'
|
|
81
|
-
}
|
|
82
|
-
]
|
|
80
|
+
scope: '#/properties/element/properties/geometry',
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
const data = {};
|
|
@@ -90,6 +90,6 @@ registerExamples([
|
|
|
90
90
|
label: 'AnyOf OneOf AllOf Resolve',
|
|
91
91
|
data,
|
|
92
92
|
schema,
|
|
93
|
-
uischema
|
|
94
|
-
}
|
|
93
|
+
uischema,
|
|
94
|
+
},
|
|
95
95
|
]);
|