@jsonforms/examples 3.1.0-alpha.1 → 3.1.0-alpha.2

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.
Files changed (110) hide show
  1. package/.eslintrc.js +29 -0
  2. package/.prettierrc.js +6 -0
  3. package/README.md +1 -1
  4. package/docs/assets/js/search.json +1 -1
  5. package/docs/globals.html +1860 -3124
  6. package/docs/index.html +0 -30
  7. package/lib/examples/1884.d.ts +8 -0
  8. package/lib/examples/additional-errors.d.ts +16 -1
  9. package/lib/examples/anyOf.d.ts +15 -2
  10. package/lib/examples/arraysI18n.d.ts +52 -0
  11. package/lib/examples/dates.d.ts +115 -1
  12. package/lib/examples/enum.d.ts +3 -0
  13. package/lib/examples/generate-dynamic.d.ts +15 -0
  14. package/lib/examples/list-with-detail-primitives.d.ts +36 -0
  15. package/lib/examples/list-with-detail-registered.d.ts +55 -1
  16. package/lib/examples/list-with-detail.d.ts +191 -1
  17. package/lib/examples/nestedCategorization.d.ts +57 -0
  18. package/lib/examples/radioGroup.d.ts +42 -1
  19. package/lib/index.d.ts +8 -19
  20. package/lib/jsonforms-examples.cjs.js +2279 -2873
  21. package/lib/jsonforms-examples.cjs.js.map +1 -1
  22. package/lib/jsonforms-examples.esm.js +2271 -2882
  23. package/lib/jsonforms-examples.esm.js.map +1 -1
  24. package/package.json +13 -6
  25. package/rollup.config.js +12 -12
  26. package/src/example.ts +3 -3
  27. package/src/examples/1884.ts +52 -48
  28. package/src/examples/1948.ts +19 -19
  29. package/src/examples/additional-errors.ts +28 -25
  30. package/src/examples/allOf.ts +18 -18
  31. package/src/examples/anyOf-oneOf-allOf-resolve.ts +21 -21
  32. package/src/examples/anyOf.ts +42 -24
  33. package/src/examples/arrays-with-custom-element-label.ts +21 -21
  34. package/src/examples/arrays-with-detail-and-rule.ts +28 -28
  35. package/src/examples/arrays-with-detail.ts +21 -21
  36. package/src/examples/arrays-with-sorting.ts +35 -35
  37. package/src/examples/arrays.ts +35 -35
  38. package/src/examples/arraysI18n.ts +107 -0
  39. package/src/examples/{steppershownav.ts → categorization-stepper-nav-buttons.ts} +6 -6
  40. package/src/examples/{stepper.ts → categorization-stepper.ts} +5 -5
  41. package/src/examples/categorization.ts +119 -119
  42. package/src/examples/conditional-schema-compositions.ts +20 -20
  43. package/src/examples/config.ts +15 -15
  44. package/src/examples/control-options.ts +81 -82
  45. package/src/examples/dates.ts +34 -34
  46. package/src/examples/default.ts +22 -22
  47. package/src/examples/{multi-enum.ts → enum-multi.ts} +14 -14
  48. package/src/examples/enum.ts +40 -33
  49. package/src/examples/enumInArray.ts +10 -10
  50. package/src/examples/{dynamic.ts → generate-dynamic.ts} +10 -10
  51. package/src/examples/generate.ts +2 -2
  52. package/src/examples/generateUI.ts +2 -2
  53. package/src/examples/huge.ts +381 -377
  54. package/src/examples/i18n.ts +37 -28
  55. package/src/examples/if_then_else.ts +4 -4
  56. package/src/examples/layout.ts +29 -29
  57. package/src/examples/{booleanToggle.ts → list-with-detail-primitives.ts} +46 -33
  58. package/src/examples/list-with-detail-registered.ts +26 -26
  59. package/src/examples/list-with-detail.ts +82 -82
  60. package/src/examples/nestedArrays.ts +40 -35
  61. package/src/examples/nestedCategorization.ts +175 -0
  62. package/src/examples/numbers.ts +17 -17
  63. package/src/examples/object.ts +24 -24
  64. package/src/examples/onChange.ts +28 -22
  65. package/src/examples/oneOf-recursive.ts +15 -15
  66. package/src/examples/oneOf.ts +99 -96
  67. package/src/examples/oneOfArray.ts +20 -20
  68. package/src/examples/person.ts +35 -35
  69. package/src/examples/radioGroup.ts +52 -53
  70. package/src/examples/readonly.ts +14 -14
  71. package/src/examples/rule.ts +26 -26
  72. package/src/examples/ruleInheritance.ts +37 -34
  73. package/src/examples/scope.ts +26 -26
  74. package/src/examples/stringArray.ts +10 -10
  75. package/src/examples/text.ts +19 -19
  76. package/src/index.ts +11 -33
  77. package/src/register.ts +6 -3
  78. package/stats.html +2462 -329
  79. package/tsconfig.json +2 -6
  80. package/lib/examples/1169.d.ts +0 -24
  81. package/lib/examples/1220.d.ts +0 -4
  82. package/lib/examples/1253.d.ts +0 -16
  83. package/lib/examples/1254.d.ts +0 -21
  84. package/lib/examples/1645.d.ts +0 -68
  85. package/lib/examples/1779.d.ts +0 -1
  86. package/lib/examples/1996.d.ts +0 -31
  87. package/lib/examples/booleanToggle.d.ts +0 -62
  88. package/lib/examples/day1.d.ts +0 -23
  89. package/lib/examples/day2.d.ts +0 -42
  90. package/lib/examples/day3.d.ts +0 -51
  91. package/lib/examples/day4.d.ts +0 -72
  92. package/lib/examples/day5.d.ts +0 -133
  93. package/lib/examples/day6.d.ts +0 -85
  94. package/lib/examples/dynamic.d.ts +0 -1
  95. package/src/examples/1169.ts +0 -62
  96. package/src/examples/1220.ts +0 -146
  97. package/src/examples/1253.ts +0 -212
  98. package/src/examples/1254.ts +0 -67
  99. package/src/examples/1645.ts +0 -66
  100. package/src/examples/1779.ts +0 -83
  101. package/src/examples/1996.ts +0 -102
  102. package/src/examples/day1.ts +0 -61
  103. package/src/examples/day2.ts +0 -62
  104. package/src/examples/day3.ts +0 -76
  105. package/src/examples/day4.ts +0 -83
  106. package/src/examples/day5.ts +0 -169
  107. package/src/examples/day6.ts +0 -44
  108. /package/lib/examples/{steppershownav.d.ts → categorization-stepper-nav-buttons.d.ts} +0 -0
  109. /package/lib/examples/{stepper.d.ts → categorization-stepper.d.ts} +0 -0
  110. /package/lib/examples/{multi-enum.d.ts → enum-multi.d.ts} +0 -0
@@ -24,13 +24,13 @@
24
24
  */
25
25
  import { registerExamples } from '../register';
26
26
 
27
- const data = {
27
+ export const data = {
28
28
  orders: [
29
29
  {
30
30
  customer: {
31
31
  id: '471201',
32
32
  name: 'Sirius Cybernetics Corporation',
33
- department: 'Complaints Division'
33
+ department: 'Complaints Division',
34
34
  },
35
35
  title: '42 killer robots',
36
36
  ordered: true,
@@ -38,23 +38,23 @@ const data = {
38
38
  assignee: 'Philip J. Fry',
39
39
  status: 'ordered',
40
40
  startDate: '2018-06-01',
41
- endDate: '2018-08-01'
41
+ endDate: '2018-08-01',
42
42
  },
43
43
  {
44
44
  customer: {
45
45
  id: '471202',
46
- name: 'Very Big Corporation of America'
46
+ name: 'Very Big Corporation of America',
47
47
  },
48
48
  title: '1000 gallons of MomCorp Oil',
49
49
  processId: '1890004499',
50
50
  assignee: 'Jen Barber',
51
51
  startDate: '2018-07-01',
52
- status: 'planned'
53
- }
54
- ]
52
+ status: 'planned',
53
+ },
54
+ ],
55
55
  };
56
56
 
57
- const schema = {
57
+ export const schema = {
58
58
  definitions: {
59
59
  order: {
60
60
  type: 'object',
@@ -64,48 +64,48 @@ const schema = {
64
64
  properties: {
65
65
  id: { type: 'string' },
66
66
  name: { type: 'string', format: 'email' },
67
- department: { type: 'string' }
68
- }
67
+ department: { type: 'string' },
68
+ },
69
69
  },
70
70
  title: {
71
71
  type: 'string',
72
72
  minLength: 5,
73
- title: 'Official Title'
73
+ title: 'Official Title',
74
74
  },
75
75
  ordered: { type: 'boolean' },
76
76
  processId: {
77
77
  type: 'number',
78
- minimum: 0
78
+ minimum: 0,
79
79
  },
80
80
  assignee: { type: 'string' },
81
81
  startDate: {
82
82
  type: 'string',
83
- format: 'date'
83
+ format: 'date',
84
84
  },
85
85
  endDate: {
86
86
  type: 'string',
87
- format: 'date'
87
+ format: 'date',
88
88
  },
89
89
  status: {
90
90
  type: 'string',
91
- enum: ['unordered', 'planned', 'ordered']
92
- }
91
+ enum: ['unordered', 'planned', 'ordered'],
92
+ },
93
93
  },
94
- required: ['title']
95
- }
94
+ required: ['title'],
95
+ },
96
96
  },
97
97
  type: 'object',
98
98
  properties: {
99
99
  orders: {
100
100
  type: 'array',
101
101
  items: {
102
- $ref: '#/definitions/order'
103
- }
104
- }
105
- }
102
+ $ref: '#/definitions/order',
103
+ },
104
+ },
105
+ },
106
106
  };
107
107
 
108
- const uischema = {
108
+ export const uischema = {
109
109
  type: 'ListWithDetail',
110
110
  scope: '#/properties/orders',
111
111
  options: {
@@ -118,13 +118,13 @@ const uischema = {
118
118
  elements: [
119
119
  {
120
120
  type: 'Control',
121
- scope: '#/properties/title'
121
+ scope: '#/properties/title',
122
122
  },
123
123
  {
124
124
  type: 'Control',
125
- scope: '#/properties/processId'
126
- }
127
- ]
125
+ scope: '#/properties/processId',
126
+ },
127
+ ],
128
128
  },
129
129
  {
130
130
  type: 'Group',
@@ -133,19 +133,19 @@ const uischema = {
133
133
  {
134
134
  type: 'Control',
135
135
  label: 'ID',
136
- scope: '#/properties/customer/properties/id'
136
+ scope: '#/properties/customer/properties/id',
137
137
  },
138
138
  {
139
139
  type: 'Control',
140
140
  label: 'Name',
141
- scope: '#/properties/customer/properties/name'
141
+ scope: '#/properties/customer/properties/name',
142
142
  },
143
143
  {
144
144
  type: 'Control',
145
145
  label: 'Department',
146
- scope: '#/properties/customer/properties/department'
147
- }
148
- ]
146
+ scope: '#/properties/customer/properties/department',
147
+ },
148
+ ],
149
149
  },
150
150
  {
151
151
  type: 'VerticalLayout',
@@ -160,42 +160,42 @@ const uischema = {
160
160
  type: 'Control',
161
161
  scope: '#/properties/ordered',
162
162
  options: {
163
- toggle: true
164
- }
163
+ toggle: true,
164
+ },
165
165
  },
166
166
  {
167
167
  type: 'Control',
168
- scope: '#/properties/assignee'
169
- }
170
- ]
168
+ scope: '#/properties/assignee',
169
+ },
170
+ ],
171
171
  },
172
172
  {
173
173
  type: 'HorizontalLayout',
174
174
  elements: [
175
175
  {
176
176
  type: 'Control',
177
- scope: '#/properties/startDate'
177
+ scope: '#/properties/startDate',
178
178
  },
179
179
  {
180
180
  type: 'Control',
181
- scope: '#/properties/endDate'
182
- }
183
- ]
181
+ scope: '#/properties/endDate',
182
+ },
183
+ ],
184
184
  },
185
185
  {
186
186
  type: 'Control',
187
- scope: '#/properties/status'
188
- }
189
- ]
190
- }
191
- ]
192
- }
193
- ]
194
- }
195
- }
187
+ scope: '#/properties/status',
188
+ },
189
+ ],
190
+ },
191
+ ],
192
+ },
193
+ ],
194
+ },
195
+ },
196
196
  };
197
197
 
198
- const uischemaNoLabelRef = {
198
+ export const uischemaNoLabelRef = {
199
199
  type: 'ListWithDetail',
200
200
  scope: '#/properties/orders',
201
201
  options: {
@@ -207,13 +207,13 @@ const uischemaNoLabelRef = {
207
207
  elements: [
208
208
  {
209
209
  type: 'Control',
210
- scope: '#/properties/title'
210
+ scope: '#/properties/title',
211
211
  },
212
212
  {
213
213
  type: 'Control',
214
- scope: '#/properties/processId'
215
- }
216
- ]
214
+ scope: '#/properties/processId',
215
+ },
216
+ ],
217
217
  },
218
218
  {
219
219
  type: 'Group',
@@ -222,19 +222,19 @@ const uischemaNoLabelRef = {
222
222
  {
223
223
  type: 'Control',
224
224
  label: 'ID',
225
- scope: '#/properties/customer/properties/id'
225
+ scope: '#/properties/customer/properties/id',
226
226
  },
227
227
  {
228
228
  type: 'Control',
229
229
  label: 'Name',
230
- scope: '#/properties/customer/properties/name'
230
+ scope: '#/properties/customer/properties/name',
231
231
  },
232
232
  {
233
233
  type: 'Control',
234
234
  label: 'Department',
235
- scope: '#/properties/customer/properties/department'
236
- }
237
- ]
235
+ scope: '#/properties/customer/properties/department',
236
+ },
237
+ ],
238
238
  },
239
239
  {
240
240
  type: 'VerticalLayout',
@@ -249,39 +249,39 @@ const uischemaNoLabelRef = {
249
249
  type: 'Control',
250
250
  scope: '#/properties/ordered',
251
251
  options: {
252
- toggle: true
253
- }
252
+ toggle: true,
253
+ },
254
254
  },
255
255
  {
256
256
  type: 'Control',
257
- scope: '#/properties/assignee'
258
- }
259
- ]
257
+ scope: '#/properties/assignee',
258
+ },
259
+ ],
260
260
  },
261
261
  {
262
262
  type: 'HorizontalLayout',
263
263
  elements: [
264
264
  {
265
265
  type: 'Control',
266
- scope: '#/properties/startDate'
266
+ scope: '#/properties/startDate',
267
267
  },
268
268
  {
269
269
  type: 'Control',
270
- scope: '#/properties/endDate'
271
- }
272
- ]
270
+ scope: '#/properties/endDate',
271
+ },
272
+ ],
273
273
  },
274
274
  {
275
275
  type: 'Control',
276
- scope: '#/properties/status'
277
- }
278
- ]
279
- }
280
- ]
281
- }
282
- ]
283
- }
284
- }
276
+ scope: '#/properties/status',
277
+ },
278
+ ],
279
+ },
280
+ ],
281
+ },
282
+ ],
283
+ },
284
+ },
285
285
  };
286
286
 
287
287
  registerExamples([
@@ -290,8 +290,8 @@ registerExamples([
290
290
  label: 'List With Detail',
291
291
  data,
292
292
  schema,
293
- uischema
294
- }
293
+ uischema,
294
+ },
295
295
  ]);
296
296
 
297
297
  registerExamples([
@@ -300,6 +300,6 @@ registerExamples([
300
300
  label: 'List With Detail (No Label Ref)',
301
301
  data,
302
302
  schema,
303
- uischema:uischemaNoLabelRef
304
- }
303
+ uischema: uischemaNoLabelRef,
304
+ },
305
305
  ]);
@@ -23,7 +23,12 @@
23
23
  THE SOFTWARE.
24
24
  */
25
25
  import { registerExamples } from '../register';
26
- import { ControlElement, JsonFormsUISchemaRegistryEntry, JsonSchema, NOT_APPLICABLE } from '@jsonforms/core';
26
+ import {
27
+ ControlElement,
28
+ JsonFormsUISchemaRegistryEntry,
29
+ JsonSchema,
30
+ NOT_APPLICABLE,
31
+ } from '@jsonforms/core';
27
32
  import { StateProps } from '..';
28
33
 
29
34
  const schema = {
@@ -35,21 +40,21 @@ const schema = {
35
40
  choices: {
36
41
  type: 'array',
37
42
  items: {
38
- type: 'string'
39
- }
40
- }
41
- }
42
- }
43
+ type: 'string',
44
+ },
45
+ },
46
+ },
47
+ },
43
48
  },
44
49
  type: 'object',
45
50
  properties: {
46
51
  exampleArray: {
47
52
  type: 'array',
48
53
  items: {
49
- $ref: '#/definitions/choicesContainer'
50
- }
51
- }
52
- }
54
+ $ref: '#/definitions/choicesContainer',
55
+ },
56
+ },
57
+ },
53
58
  };
54
59
 
55
60
  export const uischema = {
@@ -59,30 +64,30 @@ export const uischema = {
59
64
  type: 'Control',
60
65
  label: {
61
66
  text: 'Example Array',
62
- show: true
67
+ show: true,
63
68
  },
64
- scope: '#/properties/exampleArray'
65
- }
66
- ]
69
+ scope: '#/properties/exampleArray',
70
+ },
71
+ ],
67
72
  };
68
73
 
69
74
  const data = {
70
75
  exampleArray: [
71
76
  {
72
77
  choices: ['This', 'is', 'an', 'example'],
73
- name: 'Hi there'
74
- }
75
- ]
78
+ name: 'Hi there',
79
+ },
80
+ ],
76
81
  };
77
82
 
78
83
  const control1: ControlElement = {
79
84
  type: 'Control',
80
- scope: '#/properties/name'
85
+ scope: '#/properties/name',
81
86
  };
82
87
  // register inner layout
83
88
  const control2: ControlElement = {
84
89
  type: 'Control',
85
- scope: '#/properties/choices'
90
+ scope: '#/properties/choices',
86
91
  };
87
92
 
88
93
  const uischemas = [
@@ -92,32 +97,32 @@ const uischemas = [
92
97
  },
93
98
  uischema: {
94
99
  type: 'VerticalLayout',
95
- elements: [control1, control2]
96
- }
97
- }
100
+ elements: [control1, control2],
101
+ },
102
+ },
98
103
  ];
99
104
 
100
105
  const actions = [
101
106
  {
102
- 'label': 'Register NestedArray UISchema',
103
- 'apply': (props: StateProps) => {
107
+ label: 'Register NestedArray UISchema',
108
+ apply: (props: StateProps) => {
104
109
  return {
105
110
  ...props,
106
- uischemas: uischemas
107
- }
108
- }
111
+ uischemas: uischemas,
112
+ };
113
+ },
109
114
  },
110
115
  {
111
- 'label': 'Unregister NestedArray UISchema',
112
- 'apply': (props: StateProps) => {
116
+ label: 'Unregister NestedArray UISchema',
117
+ apply: (props: StateProps) => {
113
118
  const uischemas: JsonFormsUISchemaRegistryEntry[] = undefined;
114
119
  return {
115
120
  ...props,
116
- uischemas: uischemas
117
- }
118
- }
121
+ uischemas: uischemas,
122
+ };
123
+ },
119
124
  },
120
- ]
125
+ ];
121
126
 
122
127
  registerExamples([
123
128
  {
@@ -126,6 +131,6 @@ registerExamples([
126
131
  data,
127
132
  schema,
128
133
  uischema,
129
- actions
130
- }
134
+ actions,
135
+ },
131
136
  ]);
@@ -0,0 +1,175 @@
1
+ /*
2
+ The MIT License
3
+
4
+ Copyright (c) 2023 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
+ cat1: {
31
+ type: 'object',
32
+ properties: {
33
+ subcat11: {
34
+ type: 'string',
35
+ },
36
+ },
37
+ },
38
+ cat2: {
39
+ type: 'object',
40
+ properties: {
41
+ subcat21: {
42
+ type: 'string',
43
+ },
44
+ subcat22: {
45
+ type: 'string',
46
+ },
47
+ },
48
+ },
49
+ cat3: {
50
+ type: 'object',
51
+ properties: {
52
+ subcat31: {
53
+ type: 'string',
54
+ },
55
+ subcat32: {
56
+ type: 'string',
57
+ },
58
+ subcat33: {
59
+ type: 'string',
60
+ },
61
+ },
62
+ },
63
+ },
64
+ };
65
+
66
+ export const uischema = {
67
+ type: 'Categorization',
68
+ elements: [
69
+ {
70
+ type: 'Category',
71
+ label: 'Cat1',
72
+ elements: [
73
+ {
74
+ type: 'Categorization',
75
+ elements: [
76
+ {
77
+ type: 'Category',
78
+ label: 'SubCat1-1',
79
+ elements: [
80
+ {
81
+ type: 'Control',
82
+ scope: '#/properties/cat1/properties/subcat11',
83
+ },
84
+ ],
85
+ },
86
+ ],
87
+ },
88
+ ],
89
+ },
90
+ {
91
+ type: 'Category',
92
+ label: 'Cat2',
93
+ elements: [
94
+ {
95
+ type: 'Categorization',
96
+ elements: [
97
+ {
98
+ type: 'Category',
99
+ label: 'SubCat2-1',
100
+ elements: [
101
+ {
102
+ type: 'Control',
103
+ scope: '#/properties/cat2/properties/subcat21',
104
+ },
105
+ ],
106
+ },
107
+ {
108
+ type: 'Category',
109
+ label: 'SubCat2-2',
110
+ elements: [
111
+ {
112
+ type: 'Control',
113
+ scope: '#/properties/cat2/properties/subcat22',
114
+ },
115
+ ],
116
+ },
117
+ ],
118
+ },
119
+ ],
120
+ },
121
+ {
122
+ type: 'Category',
123
+ label: 'Cat3',
124
+ elements: [
125
+ {
126
+ type: 'Categorization',
127
+ elements: [
128
+ {
129
+ type: 'Category',
130
+ label: 'SubCat3-1',
131
+ elements: [
132
+ {
133
+ type: 'Control',
134
+ scope: '#/properties/cat3/properties/subcat31',
135
+ },
136
+ ],
137
+ },
138
+ {
139
+ type: 'Category',
140
+ label: 'SubCat3-2',
141
+ elements: [
142
+ {
143
+ type: 'Control',
144
+ scope: '#/properties/cat3/properties/subcat32',
145
+ },
146
+ ],
147
+ },
148
+ {
149
+ type: 'Category',
150
+ label: 'SubCat3-3',
151
+ elements: [
152
+ {
153
+ type: 'Control',
154
+ scope: '#/properties/cat3/properties/subcat33',
155
+ },
156
+ ],
157
+ },
158
+ ],
159
+ },
160
+ ],
161
+ },
162
+ ],
163
+ };
164
+
165
+ export const data = {};
166
+
167
+ registerExamples([
168
+ {
169
+ name: 'nestedCategorization',
170
+ label: 'Nested Categorization',
171
+ data,
172
+ schema,
173
+ uischema,
174
+ },
175
+ ]);