@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
@@ -31,15 +31,15 @@ export const schema = {
31
31
  type: 'number',
32
32
  maximum: 100,
33
33
  minimum: 1,
34
- default: 50
34
+ default: 50,
35
35
  },
36
36
  age: {
37
- type: 'integer'
37
+ type: 'integer',
38
38
  },
39
39
  height: {
40
- type: 'number'
41
- }
42
- }
40
+ type: 'number',
41
+ },
42
+ },
43
43
  };
44
44
 
45
45
  export const uischema = {
@@ -52,28 +52,28 @@ export const uischema = {
52
52
  type: 'Control',
53
53
  scope: '#/properties/price',
54
54
  label: {
55
- text: 'Price'
56
- }
55
+ text: 'Price',
56
+ },
57
57
  },
58
58
  {
59
59
  type: 'Control',
60
- scope: '#/properties/age'
60
+ scope: '#/properties/age',
61
61
  },
62
62
  {
63
63
  type: 'Control',
64
- scope: '#/properties/height'
64
+ scope: '#/properties/height',
65
65
  },
66
66
  {
67
67
  type: 'Control',
68
68
  scope: '#/properties/price',
69
69
  label: {
70
- text: 'Price with Slider'
70
+ text: 'Price with Slider',
71
71
  },
72
- options: { slider: true }
73
- }
74
- ]
75
- }
76
- ]
72
+ options: { slider: true },
73
+ },
74
+ ],
75
+ },
76
+ ],
77
77
  };
78
78
 
79
79
  export const data = {};
@@ -84,6 +84,6 @@ registerExamples([
84
84
  label: 'Numbers',
85
85
  data,
86
86
  schema,
87
- uischema
88
- }
87
+ uischema,
88
+ },
89
89
  ]);
@@ -35,24 +35,24 @@ export const schema = {
35
35
  properties: {
36
36
  street_address: { type: 'string' },
37
37
  city: { type: 'string' },
38
- state: { type: 'string' }
38
+ state: { type: 'string' },
39
39
  },
40
- required: ['street_address', 'city', 'state']
40
+ required: ['street_address', 'city', 'state'],
41
41
  },
42
42
  user: {
43
43
  type: 'object',
44
44
  properties: {
45
45
  name: { type: 'string' },
46
- mail: { type: 'string' }
46
+ mail: { type: 'string' },
47
47
  },
48
- required: ['name', 'mail']
49
- }
50
- }
48
+ required: ['name', 'mail'],
49
+ },
50
+ },
51
51
  };
52
52
 
53
53
  export const uischemaRoot = {
54
54
  type: 'Control',
55
- scope: '#'
55
+ scope: '#',
56
56
  };
57
57
 
58
58
  export const uischemaNonRoot = {
@@ -60,7 +60,7 @@ export const uischemaNonRoot = {
60
60
  elements: [
61
61
  {
62
62
  type: 'Control',
63
- scope: '#/properties/address'
63
+ scope: '#/properties/address',
64
64
  },
65
65
  {
66
66
  type: 'Control',
@@ -70,47 +70,47 @@ export const uischemaNonRoot = {
70
70
  condition: {
71
71
  type: 'LEAF',
72
72
  scope: '#/properties/address/properties/state',
73
- expectedValue: 'DC'
74
- }
73
+ expectedValue: 'DC',
74
+ },
75
75
  },
76
76
  options: {
77
77
  detail: {
78
78
  type: 'Group',
79
79
  label: 'User Data',
80
80
  elements: [
81
- { type: 'Control', scope: '#/properties/name'},
81
+ { type: 'Control', scope: '#/properties/name' },
82
82
  {
83
83
  type: 'Control',
84
- scope: '#/properties/mail'
85
- }
86
- ]
87
- }
88
- }
89
- }
90
- ]
84
+ scope: '#/properties/mail',
85
+ },
86
+ ],
87
+ },
88
+ },
89
+ },
90
+ ],
91
91
  };
92
92
 
93
93
  const data = {
94
94
  address: {
95
95
  street_address: '1600 Pennsylvania Avenue NW',
96
96
  city: 'Washington',
97
- state: 'DC'
98
- }
97
+ state: 'DC',
98
+ },
99
99
  };
100
100
 
101
101
  registerExamples([
102
102
  {
103
103
  name: 'rootObject',
104
- label: 'Root Object',
104
+ label: 'Object - Root Scope',
105
105
  data,
106
106
  schema,
107
- uischema: uischemaRoot
107
+ uischema: uischemaRoot,
108
108
  },
109
109
  {
110
110
  name: 'object',
111
111
  label: 'Object',
112
112
  data,
113
113
  schema,
114
- uischema: uischemaNonRoot
115
- }
114
+ uischema: uischemaNonRoot,
115
+ },
116
116
  ]);
@@ -23,41 +23,47 @@
23
23
  THE SOFTWARE.
24
24
  */
25
25
  import { registerExamples } from '../register';
26
- import { UISchemaElement, updateErrors, JsonFormsCore, AnyAction, Dispatch } from '@jsonforms/core';
26
+ import {
27
+ UISchemaElement,
28
+ updateErrors,
29
+ JsonFormsCore,
30
+ AnyAction,
31
+ Dispatch,
32
+ } from '@jsonforms/core';
27
33
 
28
- let touchedProperties: any = {
34
+ const touchedProperties: any = {
29
35
  name: false,
30
- description: false
36
+ description: false,
31
37
  };
32
38
 
33
- export const onChange = (dispatch: Dispatch<AnyAction>) => (_: any) => ({
34
- data,
35
- errors
36
- }: Pick<JsonFormsCore, 'data' | 'errors'>) => {
37
- Object.keys(data).forEach(key => (touchedProperties[key] = true));
39
+ export const onChange =
40
+ (dispatch: Dispatch<AnyAction>) =>
41
+ (_: any) =>
42
+ ({ data, errors }: Pick<JsonFormsCore, 'data' | 'errors'>) => {
43
+ Object.keys(data).forEach((key) => (touchedProperties[key] = true));
38
44
 
39
- const newErrors = errors.filter(error => {
40
- return touchedProperties[(error as any).dataPath ?? error.instancePath];
41
- });
45
+ const newErrors = errors.filter((error) => {
46
+ return touchedProperties[(error as any).dataPath ?? error.instancePath];
47
+ });
42
48
 
43
- if (newErrors.length < errors.length) {
44
- return dispatch(updateErrors(newErrors));
45
- }
46
- };
49
+ if (newErrors.length < errors.length) {
50
+ return dispatch(updateErrors(newErrors));
51
+ }
52
+ };
47
53
 
48
54
  export const schema = {
49
55
  type: 'object',
50
56
  properties: {
51
57
  name: {
52
58
  type: 'string',
53
- minLength: 1
59
+ minLength: 1,
54
60
  },
55
61
  description: {
56
62
  type: 'string',
57
- minLength: 1
58
- }
63
+ minLength: 1,
64
+ },
59
65
  },
60
- required: ['name', 'description']
66
+ required: ['name', 'description'],
61
67
  };
62
68
 
63
69
  export const uischema: UISchemaElement = undefined;
@@ -67,9 +73,9 @@ export const data = {};
67
73
  registerExamples([
68
74
  {
69
75
  name: 'onChange',
70
- label: 'On Change',
76
+ label: 'On Change Listener',
71
77
  data,
72
78
  schema,
73
- uischema
74
- }
79
+ uischema,
80
+ },
75
81
  ]);
@@ -29,14 +29,14 @@ export const schema = {
29
29
  definitions: {
30
30
  fileOrFolder: {
31
31
  title: 'fileOrFolder',
32
- oneOf: [{ $ref: '#/definitions/file' }, { $ref: '#/definitions/folder' }]
32
+ oneOf: [{ $ref: '#/definitions/file' }, { $ref: '#/definitions/folder' }],
33
33
  },
34
34
  file: {
35
35
  title: 'File',
36
36
  type: 'object',
37
37
  properties: {
38
- name: { type: 'string' }
39
- }
38
+ name: { type: 'string' },
39
+ },
40
40
  },
41
41
  folder: {
42
42
  type: 'object',
@@ -46,26 +46,26 @@ export const schema = {
46
46
  children: {
47
47
  type: 'array',
48
48
  items: {
49
- $ref: '#/definitions/fileOrFolder'
50
- }
51
- }
52
- }
53
- }
49
+ $ref: '#/definitions/fileOrFolder',
50
+ },
51
+ },
52
+ },
53
+ },
54
54
  },
55
55
  type: 'object',
56
56
  properties: {
57
57
  root: {
58
58
  type: 'array',
59
59
  items: {
60
- $ref: '#/definitions/folder'
61
- }
62
- }
63
- }
60
+ $ref: '#/definitions/folder',
61
+ },
62
+ },
63
+ },
64
64
  };
65
65
 
66
66
  export const uischema = {
67
67
  type: 'Control',
68
- scope: '#'
68
+ scope: '#',
69
69
  };
70
70
 
71
71
  const data = {};
@@ -76,6 +76,6 @@ registerExamples([
76
76
  label: 'oneOf recursive',
77
77
  data,
78
78
  schema,
79
- uischema
80
- }
79
+ uischema,
80
+ },
81
81
  ]);