@jsonforms/examples 3.1.0-alpha.0 → 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 (111) hide show
  1. package/.eslintrc.js +29 -0
  2. package/.prettierrc.js +6 -0
  3. package/README.md +2 -2
  4. package/docs/assets/js/search.json +1 -1
  5. package/docs/globals.html +2011 -3265
  6. package/docs/index.html +1 -31
  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/control-options.d.ts +1 -0
  12. package/lib/examples/dates.d.ts +115 -1
  13. package/lib/examples/enum.d.ts +3 -0
  14. package/lib/examples/generate-dynamic.d.ts +15 -0
  15. package/lib/examples/list-with-detail-primitives.d.ts +36 -0
  16. package/lib/examples/list-with-detail-registered.d.ts +55 -1
  17. package/lib/examples/list-with-detail.d.ts +191 -1
  18. package/lib/examples/nestedCategorization.d.ts +57 -0
  19. package/lib/examples/radioGroup.d.ts +42 -1
  20. package/lib/index.d.ts +8 -19
  21. package/lib/jsonforms-examples.cjs.js +2280 -2873
  22. package/lib/jsonforms-examples.cjs.js.map +1 -1
  23. package/lib/jsonforms-examples.esm.js +2272 -2882
  24. package/lib/jsonforms-examples.esm.js.map +1 -1
  25. package/package.json +14 -7
  26. package/rollup.config.js +12 -12
  27. package/src/example.ts +3 -3
  28. package/src/examples/1884.ts +52 -48
  29. package/src/examples/1948.ts +19 -19
  30. package/src/examples/additional-errors.ts +28 -25
  31. package/src/examples/allOf.ts +18 -18
  32. package/src/examples/anyOf-oneOf-allOf-resolve.ts +21 -21
  33. package/src/examples/anyOf.ts +42 -24
  34. package/src/examples/arrays-with-custom-element-label.ts +21 -21
  35. package/src/examples/arrays-with-detail-and-rule.ts +28 -28
  36. package/src/examples/arrays-with-detail.ts +21 -21
  37. package/src/examples/arrays-with-sorting.ts +35 -35
  38. package/src/examples/arrays.ts +35 -35
  39. package/src/examples/arraysI18n.ts +107 -0
  40. package/src/examples/{steppershownav.ts → categorization-stepper-nav-buttons.ts} +6 -6
  41. package/src/examples/{stepper.ts → categorization-stepper.ts} +5 -5
  42. package/src/examples/categorization.ts +119 -119
  43. package/src/examples/conditional-schema-compositions.ts +20 -20
  44. package/src/examples/config.ts +15 -15
  45. package/src/examples/control-options.ts +81 -81
  46. package/src/examples/dates.ts +34 -34
  47. package/src/examples/default.ts +22 -22
  48. package/src/examples/{multi-enum.ts → enum-multi.ts} +14 -14
  49. package/src/examples/enum.ts +40 -33
  50. package/src/examples/enumInArray.ts +10 -10
  51. package/src/examples/{dynamic.ts → generate-dynamic.ts} +10 -10
  52. package/src/examples/generate.ts +2 -2
  53. package/src/examples/generateUI.ts +2 -2
  54. package/src/examples/huge.ts +381 -377
  55. package/src/examples/i18n.ts +37 -28
  56. package/src/examples/if_then_else.ts +4 -4
  57. package/src/examples/layout.ts +29 -29
  58. package/src/examples/{booleanToggle.ts → list-with-detail-primitives.ts} +46 -33
  59. package/src/examples/list-with-detail-registered.ts +26 -26
  60. package/src/examples/list-with-detail.ts +82 -82
  61. package/src/examples/nestedArrays.ts +40 -35
  62. package/src/examples/nestedCategorization.ts +175 -0
  63. package/src/examples/numbers.ts +17 -17
  64. package/src/examples/object.ts +24 -24
  65. package/src/examples/onChange.ts +28 -22
  66. package/src/examples/oneOf-recursive.ts +15 -15
  67. package/src/examples/oneOf.ts +99 -96
  68. package/src/examples/oneOfArray.ts +20 -20
  69. package/src/examples/person.ts +35 -35
  70. package/src/examples/radioGroup.ts +52 -53
  71. package/src/examples/readonly.ts +14 -14
  72. package/src/examples/rule.ts +26 -26
  73. package/src/examples/ruleInheritance.ts +37 -34
  74. package/src/examples/scope.ts +26 -26
  75. package/src/examples/stringArray.ts +10 -10
  76. package/src/examples/text.ts +19 -19
  77. package/src/index.ts +11 -33
  78. package/src/register.ts +6 -3
  79. package/stats.html +4949 -2051
  80. package/tsconfig.json +2 -6
  81. package/lib/examples/1169.d.ts +0 -24
  82. package/lib/examples/1220.d.ts +0 -4
  83. package/lib/examples/1253.d.ts +0 -16
  84. package/lib/examples/1254.d.ts +0 -21
  85. package/lib/examples/1645.d.ts +0 -68
  86. package/lib/examples/1779.d.ts +0 -1
  87. package/lib/examples/1996.d.ts +0 -31
  88. package/lib/examples/booleanToggle.d.ts +0 -62
  89. package/lib/examples/day1.d.ts +0 -23
  90. package/lib/examples/day2.d.ts +0 -42
  91. package/lib/examples/day3.d.ts +0 -51
  92. package/lib/examples/day4.d.ts +0 -72
  93. package/lib/examples/day5.d.ts +0 -133
  94. package/lib/examples/day6.d.ts +0 -85
  95. package/lib/examples/dynamic.d.ts +0 -1
  96. package/src/examples/1169.ts +0 -62
  97. package/src/examples/1220.ts +0 -146
  98. package/src/examples/1253.ts +0 -212
  99. package/src/examples/1254.ts +0 -67
  100. package/src/examples/1645.ts +0 -66
  101. package/src/examples/1779.ts +0 -83
  102. package/src/examples/1996.ts +0 -102
  103. package/src/examples/day1.ts +0 -61
  104. package/src/examples/day2.ts +0 -62
  105. package/src/examples/day3.ts +0 -76
  106. package/src/examples/day4.ts +0 -83
  107. package/src/examples/day5.ts +0 -169
  108. package/src/examples/day6.ts +0 -44
  109. /package/lib/examples/{steppershownav.d.ts → categorization-stepper-nav-buttons.d.ts} +0 -0
  110. /package/lib/examples/{stepper.d.ts → categorization-stepper.d.ts} +0 -0
  111. /package/lib/examples/{multi-enum.d.ts → enum-multi.d.ts} +0 -0
@@ -24,58 +24,57 @@
24
24
  */
25
25
  import { registerExamples } from '../register';
26
26
 
27
- const data = {
28
- };
29
-
30
- const schema = {
31
- type: 'object',
32
- properties: {
33
- exampleRadioEnum: {
34
- type: 'string',
35
- enum: ['One', 'Two', 'Three']
36
- },
37
- exampleRadioOneOfEnum: {
38
- type: 'string',
39
- oneOf: [
40
- {const: 'foo', title: 'Foo'},
41
- {const: 'bar', title: 'Bar'},
42
- {const: 'foobar', title: 'FooBar'}
43
- ]
44
- }
45
- }
46
- };
47
- const uischema = {
48
- type: 'VerticalLayout',
49
- elements: [
50
- {
51
- type: 'Group',
52
- label: 'Simple enum',
53
- elements: [
54
- {
55
- type: 'Control',
56
- scope: '#/properties/exampleRadioEnum',
57
- options: {
58
- format: 'radio'
59
- }
60
- }
61
- ]
62
- },
63
- {
64
- type: 'Group',
65
- label: 'One of Enum',
66
- elements: [
67
- {
68
- type: 'Control',
69
- scope: '#/properties/exampleRadioOneOfEnum',
70
- options: {
71
- format: 'radio'
72
- }
73
- }
74
- ]
75
- }
76
- ]
77
- };
27
+ export const data = {};
78
28
 
29
+ export const schema = {
30
+ type: 'object',
31
+ properties: {
32
+ exampleRadioEnum: {
33
+ type: 'string',
34
+ enum: ['One', 'Two', 'Three'],
35
+ },
36
+ exampleRadioOneOfEnum: {
37
+ type: 'string',
38
+ oneOf: [
39
+ { const: 'foo', title: 'Foo' },
40
+ { const: 'bar', title: 'Bar' },
41
+ { const: 'foobar', title: 'FooBar' },
42
+ ],
43
+ },
44
+ },
45
+ };
46
+ export const uischema = {
47
+ type: 'VerticalLayout',
48
+ elements: [
49
+ {
50
+ type: 'Group',
51
+ label: 'Simple enum',
52
+ elements: [
53
+ {
54
+ type: 'Control',
55
+ scope: '#/properties/exampleRadioEnum',
56
+ options: {
57
+ format: 'radio',
58
+ orientation: 'vertical',
59
+ },
60
+ },
61
+ ],
62
+ },
63
+ {
64
+ type: 'Group',
65
+ label: 'One of Enum',
66
+ elements: [
67
+ {
68
+ type: 'Control',
69
+ scope: '#/properties/exampleRadioOneOfEnum',
70
+ options: {
71
+ format: 'radio',
72
+ },
73
+ },
74
+ ],
75
+ },
76
+ ],
77
+ };
79
78
 
80
79
  registerExamples([
81
80
  {
@@ -83,6 +82,6 @@ registerExamples([
83
82
  label: 'Radio Group',
84
83
  data,
85
84
  schema,
86
- uischema
87
- }
85
+ uischema,
86
+ },
88
87
  ]);
@@ -29,15 +29,15 @@ export const schema = {
29
29
  properties: {
30
30
  readonly: {
31
31
  type: 'string',
32
- readOnly: true
32
+ readOnly: true,
33
33
  },
34
34
  readonlyByUISchema: {
35
- type: 'string'
35
+ type: 'string',
36
36
  },
37
37
  notReadonly: {
38
- type: 'string'
39
- }
40
- }
38
+ type: 'string',
39
+ },
40
+ },
41
41
  };
42
42
 
43
43
  export const uischema = {
@@ -46,28 +46,28 @@ export const uischema = {
46
46
  {
47
47
  type: 'Control',
48
48
  scope: '#/properties/readonly',
49
- label: 'A readonly field'
49
+ label: 'A readonly field',
50
50
  },
51
51
  {
52
52
  type: 'Control',
53
53
  scope: '#/properties/readonlyByUISchema',
54
54
  label: 'A readonly field by ui schema',
55
55
  options: {
56
- readonly: true
57
- }
56
+ readonly: true,
57
+ },
58
58
  },
59
59
  {
60
60
  type: 'Control',
61
61
  scope: '#/properties/notReadonly',
62
- label: 'A normal field'
63
- }
64
- ]
62
+ label: 'A normal field',
63
+ },
64
+ ],
65
65
  };
66
66
 
67
67
  export const data = {
68
68
  readonly: 'readonly by schema',
69
69
  readonlyByUISchema: 'readonly by ui schema',
70
- notReadonly: 'normal field'
70
+ notReadonly: 'normal field',
71
71
  };
72
72
 
73
73
  registerExamples([
@@ -76,6 +76,6 @@ registerExamples([
76
76
  label: 'Readonly examples',
77
77
  data,
78
78
  schema,
79
- uischema
80
- }
79
+ uischema,
80
+ },
81
81
  ]);
@@ -28,23 +28,23 @@ export const schema = {
28
28
  type: 'object',
29
29
  properties: {
30
30
  name: {
31
- type: 'string'
31
+ type: 'string',
32
32
  },
33
33
  dead: {
34
- type: 'boolean'
34
+ type: 'boolean',
35
35
  },
36
36
  kindOfDead: {
37
37
  type: 'string',
38
- enum: ['Zombie', 'Vampire', 'Ghoul']
38
+ enum: ['Zombie', 'Vampire', 'Ghoul'],
39
39
  },
40
40
  vegetables: {
41
- type: 'boolean'
41
+ type: 'boolean',
42
42
  },
43
43
  kindOfVegetables: {
44
44
  type: 'string',
45
- enum: ['All', 'Some', 'Only potatoes']
46
- }
47
- }
45
+ enum: ['All', 'Some', 'Only potatoes'],
46
+ },
47
+ },
48
48
  };
49
49
 
50
50
  export const uischema = {
@@ -53,7 +53,7 @@ export const uischema = {
53
53
  {
54
54
  type: 'Control',
55
55
  label: 'Name',
56
- scope: '#/properties/name'
56
+ scope: '#/properties/name',
57
57
  },
58
58
  {
59
59
  type: 'Group',
@@ -61,7 +61,7 @@ export const uischema = {
61
61
  {
62
62
  type: 'Control',
63
63
  label: 'Is Dead?',
64
- scope: '#/properties/dead'
64
+ scope: '#/properties/dead',
65
65
  },
66
66
  {
67
67
  type: 'Control',
@@ -72,12 +72,12 @@ export const uischema = {
72
72
  condition: {
73
73
  scope: '#/properties/dead',
74
74
  schema: {
75
- const: true
76
- }
77
- }
78
- }
79
- }
80
- ]
75
+ const: true,
76
+ },
77
+ },
78
+ },
79
+ },
80
+ ],
81
81
  },
82
82
  {
83
83
  type: 'Group',
@@ -85,7 +85,7 @@ export const uischema = {
85
85
  {
86
86
  type: 'Control',
87
87
  label: 'Eats vegetables?',
88
- scope: '#/properties/vegetables'
88
+ scope: '#/properties/vegetables',
89
89
  },
90
90
  {
91
91
  type: 'Control',
@@ -96,14 +96,14 @@ export const uischema = {
96
96
  condition: {
97
97
  scope: '#/properties/vegetables',
98
98
  schema: {
99
- const: false
100
- }
101
- }
102
- }
103
- }
104
- ]
105
- }
106
- ]
99
+ const: false,
100
+ },
101
+ },
102
+ },
103
+ },
104
+ ],
105
+ },
106
+ ],
107
107
  };
108
108
 
109
109
  export const data = {
@@ -118,6 +118,6 @@ registerExamples([
118
118
  label: 'Rule',
119
119
  data,
120
120
  schema,
121
- uischema
122
- }
121
+ uischema,
122
+ },
123
123
  ]);
@@ -29,21 +29,21 @@ export const schema = {
29
29
  type: 'object',
30
30
  properties: {
31
31
  toggleTopLayout: {
32
- type: 'boolean'
32
+ type: 'boolean',
33
33
  },
34
34
  topString: {
35
- type: 'string'
35
+ type: 'string',
36
36
  },
37
37
  middleNumber: {
38
- type: 'number'
38
+ type: 'number',
39
39
  },
40
40
  toggleBottomLayout: {
41
- type: 'boolean'
41
+ type: 'boolean',
42
42
  },
43
43
  bottomBoolean: {
44
- type: 'boolean'
45
- }
46
- }
44
+ type: 'boolean',
45
+ },
46
+ },
47
47
  };
48
48
  export const uischema = {
49
49
  type: 'VerticalLayout',
@@ -51,20 +51,20 @@ export const uischema = {
51
51
  effect: 'ENABLE',
52
52
  condition: {
53
53
  scope: '#/properties/toggleTopLayout',
54
- schema: { const: true }
55
- }
54
+ schema: { const: true },
55
+ },
56
56
  },
57
57
  elements: [
58
58
  {
59
59
  type: 'Control',
60
- scope: '#/properties/topString'
60
+ scope: '#/properties/topString',
61
61
  },
62
62
  {
63
63
  type: 'HorizontalLayout',
64
64
  elements: [
65
65
  {
66
66
  type: 'Control',
67
- scope: '#/properties/middleNumber'
67
+ scope: '#/properties/middleNumber',
68
68
  },
69
69
  {
70
70
  type: 'Group',
@@ -73,47 +73,50 @@ export const uischema = {
73
73
  effect: 'SHOW',
74
74
  condition: {
75
75
  scope: '#/properties/toggleBottomLayout',
76
- schema: { const: true }
77
- }
76
+ schema: { const: true },
77
+ },
78
78
  },
79
79
  elements: [
80
80
  {
81
81
  type: 'Control',
82
- scope: '#/properties/bottomBoolean'
83
- }
84
- ]
85
- }
86
- ]
87
- }
88
- ]
82
+ scope: '#/properties/bottomBoolean',
83
+ },
84
+ ],
85
+ },
86
+ ],
87
+ },
88
+ ],
89
89
  } as any;
90
90
 
91
91
  export const data = {
92
92
  toggleTopLayout: true,
93
93
  toggleBottomLayout: true,
94
- toggleControl: true
94
+ toggleControl: true,
95
95
  };
96
96
 
97
97
  const actions = [
98
98
  {
99
- 'label': 'Enable/Disable top layout',
100
- 'apply': (props: StateProps) => {
99
+ label: 'Enable/Disable top layout',
100
+ apply: (props: StateProps) => {
101
101
  return {
102
102
  ...props,
103
- data: { ...props.data, toggleTopLayout: !props.data.toggleTopLayout }
104
- }
105
- }
103
+ data: { ...props.data, toggleTopLayout: !props.data.toggleTopLayout },
104
+ };
105
+ },
106
106
  },
107
107
  {
108
- 'label': 'Show/Hide bottom layout',
109
- 'apply': (props: StateProps) => {
108
+ label: 'Show/Hide bottom layout',
109
+ apply: (props: StateProps) => {
110
110
  return {
111
111
  ...props,
112
- data: { ...props.data, toggleBottomLayout: !props.data.toggleBottomLayout }
113
- }
114
- }
112
+ data: {
113
+ ...props.data,
114
+ toggleBottomLayout: !props.data.toggleBottomLayout,
115
+ },
116
+ };
117
+ },
115
118
  },
116
- ]
119
+ ];
117
120
 
118
121
  registerExamples([
119
122
  {
@@ -122,6 +125,6 @@ registerExamples([
122
125
  data,
123
126
  schema,
124
127
  uischema,
125
- actions
126
- }
128
+ actions,
129
+ },
127
130
  ]);
@@ -28,32 +28,32 @@ export const orderSchema = {
28
28
  type: 'object',
29
29
  properties: {
30
30
  orderId: {
31
- type: 'string'
31
+ type: 'string',
32
32
  },
33
33
  purchaseDate: {
34
34
  type: 'string',
35
- format: 'date'
35
+ format: 'date',
36
36
  },
37
37
  price: {
38
- type: 'number'
38
+ type: 'number',
39
39
  },
40
40
  shippingAddress: {
41
- $ref: '#/definitions/shippingAddress'
42
- }
41
+ $ref: '#/definitions/shippingAddress',
42
+ },
43
43
  },
44
44
  definitions: {
45
45
  shippingAddress: {
46
46
  type: 'object',
47
47
  properties: {
48
48
  aptNo: {
49
- type: 'integer'
49
+ type: 'integer',
50
50
  },
51
51
  streetNumber: {
52
- type: 'integer'
53
- }
54
- }
55
- }
56
- }
52
+ type: 'integer',
53
+ },
54
+ },
55
+ },
56
+ },
57
57
  };
58
58
 
59
59
  export const uischema = {
@@ -64,32 +64,32 @@ export const uischema = {
64
64
  elements: [
65
65
  {
66
66
  type: 'Control',
67
- scope: '#/properties/orderId'
67
+ scope: '#/properties/orderId',
68
68
  },
69
69
  {
70
70
  type: 'Control',
71
- scope: '#/properties/purchaseDate'
71
+ scope: '#/properties/purchaseDate',
72
72
  },
73
73
  {
74
74
  type: 'Control',
75
- scope: '#/properties/price'
76
- }
77
- ]
75
+ scope: '#/properties/price',
76
+ },
77
+ ],
78
78
  },
79
79
  {
80
80
  type: 'HorizontalLayout',
81
81
  elements: [
82
82
  {
83
83
  type: 'Control',
84
- scope: '#/properties/shippingAddress/properties/aptNo'
84
+ scope: '#/properties/shippingAddress/properties/aptNo',
85
85
  },
86
86
  {
87
87
  type: 'Control',
88
- scope: '#/properties/shippingAddress/properties/streetNumber'
89
- }
90
- ]
91
- }
92
- ]
88
+ scope: '#/properties/shippingAddress/properties/streetNumber',
89
+ },
90
+ ],
91
+ },
92
+ ],
93
93
  };
94
94
 
95
95
  export const data = {
@@ -98,8 +98,8 @@ export const data = {
98
98
  price: 16,
99
99
  shippingAddress: {
100
100
  aptNo: 3,
101
- streetNumber: 12
102
- }
101
+ streetNumber: 12,
102
+ },
103
103
  };
104
104
 
105
105
  registerExamples([
@@ -108,6 +108,6 @@ registerExamples([
108
108
  label: 'Scope',
109
109
  data,
110
110
  schema: orderSchema,
111
- uischema
112
- }
111
+ uischema,
112
+ },
113
113
  ]);
@@ -31,10 +31,10 @@ export const schema = {
31
31
  type: 'array',
32
32
  items: {
33
33
  type: 'string',
34
- maxLength: 5
35
- }
36
- }
37
- }
34
+ maxLength: 5,
35
+ },
36
+ },
37
+ },
38
38
  };
39
39
 
40
40
  export const uischema = {
@@ -42,13 +42,13 @@ export const uischema = {
42
42
  elements: [
43
43
  {
44
44
  type: 'Control',
45
- scope: '#/properties/comments'
46
- }
47
- ]
45
+ scope: '#/properties/comments',
46
+ },
47
+ ],
48
48
  };
49
49
 
50
50
  export const data = {
51
- comments: ['one string', 'two strings']
51
+ comments: ['one string', 'two strings'],
52
52
  };
53
53
 
54
54
  registerExamples([
@@ -57,6 +57,6 @@ registerExamples([
57
57
  label: 'Array of Strings',
58
58
  data,
59
59
  schema,
60
- uischema
61
- }
60
+ uischema,
61
+ },
62
62
  ]);
@@ -29,17 +29,17 @@ export const schema = {
29
29
  properties: {
30
30
  zipCode: {
31
31
  type: 'string',
32
- maxLength: 5
32
+ maxLength: 5,
33
33
  },
34
34
  zipCodeWithoutTrim: {
35
35
  type: 'string',
36
- maxLength: 5
36
+ maxLength: 5,
37
37
  },
38
38
  zipCodeWithoutRestrict: {
39
39
  type: 'string',
40
- maxLength: 5
41
- }
42
- }
40
+ maxLength: 5,
41
+ },
42
+ },
43
43
  };
44
44
 
45
45
  export const uischema = {
@@ -54,8 +54,8 @@ export const uischema = {
54
54
  label: 'ZIP Code (with trim and restrict options)',
55
55
  options: {
56
56
  trim: true,
57
- restrict: true
58
- }
57
+ restrict: true,
58
+ },
59
59
  },
60
60
  {
61
61
  type: 'Control',
@@ -63,8 +63,8 @@ export const uischema = {
63
63
  label: 'ZIP Code (without trimming)',
64
64
  options: {
65
65
  trim: false,
66
- restrict: true
67
- }
66
+ restrict: true,
67
+ },
68
68
  },
69
69
  {
70
70
  type: 'Control',
@@ -72,26 +72,26 @@ export const uischema = {
72
72
  label: 'ZIP Code (without restricting)',
73
73
  options: {
74
74
  trim: true,
75
- restrict: false
76
- }
77
- }
78
- ]
79
- }
80
- ]
75
+ restrict: false,
76
+ },
77
+ },
78
+ ],
79
+ },
80
+ ],
81
81
  };
82
82
 
83
83
  export const data = {
84
84
  zipCode: '12345',
85
85
  zipCodeWithoutTrim: '12345678',
86
- zipCodeWithoutRestrict: '12345678'
86
+ zipCodeWithoutRestrict: '12345678',
87
87
  };
88
88
 
89
89
  registerExamples([
90
90
  {
91
91
  name: 'text',
92
- label: 'Text',
92
+ label: 'Text Control Options',
93
93
  data,
94
94
  schema,
95
- uischema
96
- }
95
+ uischema,
96
+ },
97
97
  ]);