@jsonforms/examples 2.5.2 → 3.0.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.
Files changed (294) hide show
  1. package/README.md +1 -1
  2. package/docs/assets/js/search.json +1 -1
  3. package/docs/globals.html +3380 -2419
  4. package/docs/index.html +16 -25
  5. package/docs/interfaces/exampledescription.html +34 -6
  6. package/docs/interfaces/stateprops.html +229 -0
  7. package/lib/example.d.ts +14 -6
  8. package/lib/example.js +0 -5
  9. package/lib/example.js.map +1 -1
  10. package/lib/{1169.d.ts → examples/1169.d.ts} +0 -0
  11. package/lib/{1169.js → examples/1169.js} +2 -1
  12. package/lib/examples/1169.js.map +1 -0
  13. package/lib/examples/1220.d.ts +4 -0
  14. package/lib/{1220.js → examples/1220.js} +51 -35
  15. package/lib/examples/1220.js.map +1 -0
  16. package/lib/{1253.d.ts → examples/1253.d.ts} +0 -0
  17. package/lib/{1253.js → examples/1253.js} +2 -1
  18. package/lib/examples/1253.js.map +1 -0
  19. package/lib/{1254.d.ts → examples/1254.d.ts} +0 -0
  20. package/lib/{1254.js → examples/1254.js} +2 -1
  21. package/lib/examples/1254.js.map +1 -0
  22. package/lib/examples/1645.d.ts +68 -0
  23. package/lib/examples/1645.js +65 -0
  24. package/lib/examples/1645.js.map +1 -0
  25. package/lib/{radioGroup.d.ts → examples/1779.d.ts} +0 -0
  26. package/lib/examples/1779.js +82 -0
  27. package/lib/examples/1779.js.map +1 -0
  28. package/lib/{allOf.d.ts → examples/allOf.d.ts} +0 -0
  29. package/lib/{allOf.js → examples/allOf.js} +2 -1
  30. package/lib/examples/allOf.js.map +1 -0
  31. package/lib/{anyOf-oneOf-allOf-resolve.d.ts → examples/anyOf-oneOf-allOf-resolve.d.ts} +0 -0
  32. package/lib/{anyOf-oneOf-allOf-resolve.js → examples/anyOf-oneOf-allOf-resolve.js} +2 -1
  33. package/lib/examples/anyOf-oneOf-allOf-resolve.js.map +1 -0
  34. package/lib/{anyOf.d.ts → examples/anyOf.d.ts} +0 -0
  35. package/lib/{anyOf.js → examples/anyOf.js} +2 -1
  36. package/lib/examples/anyOf.js.map +1 -0
  37. package/lib/{arrays-with-custom-element-label.d.ts → examples/arrays-with-custom-element-label.d.ts} +0 -0
  38. package/lib/{arrays-with-custom-element-label.js → examples/arrays-with-custom-element-label.js} +2 -1
  39. package/lib/examples/arrays-with-custom-element-label.js.map +1 -0
  40. package/lib/{arrays-with-detail-and-rule.d.ts → examples/arrays-with-detail-and-rule.d.ts} +0 -0
  41. package/lib/{arrays-with-detail-and-rule.js → examples/arrays-with-detail-and-rule.js} +2 -1
  42. package/lib/examples/arrays-with-detail-and-rule.js.map +1 -0
  43. package/lib/{arrays-with-detail.d.ts → examples/arrays-with-detail.d.ts} +0 -0
  44. package/lib/{arrays-with-detail.js → examples/arrays-with-detail.js} +2 -1
  45. package/lib/examples/arrays-with-detail.js.map +1 -0
  46. package/lib/{arrays.d.ts → examples/arrays.d.ts} +13 -0
  47. package/lib/{arrays.js → examples/arrays.js} +31 -9
  48. package/lib/examples/arrays.js.map +1 -0
  49. package/lib/{booleanToggle.d.ts → examples/booleanToggle.d.ts} +0 -0
  50. package/lib/{booleanToggle.js → examples/booleanToggle.js} +2 -1
  51. package/lib/examples/booleanToggle.js.map +1 -0
  52. package/lib/{categorization.d.ts → examples/categorization.d.ts} +0 -0
  53. package/lib/{categorization.js → examples/categorization.js} +2 -1
  54. package/lib/examples/categorization.js.map +1 -0
  55. package/lib/{config.d.ts → examples/config.d.ts} +0 -0
  56. package/lib/{config.js → examples/config.js} +2 -1
  57. package/lib/examples/config.js.map +1 -0
  58. package/lib/{control-options.d.ts → examples/control-options.d.ts} +0 -0
  59. package/lib/{control-options.js → examples/control-options.js} +3 -2
  60. package/lib/examples/control-options.js.map +1 -0
  61. package/lib/{dates.d.ts → examples/dates.d.ts} +0 -0
  62. package/lib/examples/dates.js +150 -0
  63. package/lib/examples/dates.js.map +1 -0
  64. package/lib/{day1.d.ts → examples/day1.d.ts} +0 -0
  65. package/lib/{day1.js → examples/day1.js} +2 -1
  66. package/lib/examples/day1.js.map +1 -0
  67. package/lib/{day2.d.ts → examples/day2.d.ts} +0 -0
  68. package/lib/{day2.js → examples/day2.js} +6 -5
  69. package/lib/examples/day2.js.map +1 -0
  70. package/lib/{day3.d.ts → examples/day3.d.ts} +0 -0
  71. package/lib/{day3.js → examples/day3.js} +3 -2
  72. package/lib/examples/day3.js.map +1 -0
  73. package/lib/{day4.d.ts → examples/day4.d.ts} +0 -0
  74. package/lib/{day4.js → examples/day4.js} +3 -2
  75. package/lib/examples/day4.js.map +1 -0
  76. package/lib/{day5.d.ts → examples/day5.d.ts} +0 -0
  77. package/lib/{day5.js → examples/day5.js} +2 -1
  78. package/lib/examples/day5.js.map +1 -0
  79. package/lib/{day6.d.ts → examples/day6.d.ts} +0 -0
  80. package/lib/{day6.js → examples/day6.js} +2 -1
  81. package/lib/examples/day6.js.map +1 -0
  82. package/lib/{default.d.ts → examples/default.d.ts} +0 -0
  83. package/lib/{default.js → examples/default.js} +2 -1
  84. package/lib/examples/default.js.map +1 -0
  85. package/lib/{dynamic.d.ts → examples/dynamic.d.ts} +0 -0
  86. package/lib/examples/dynamic.js +23 -0
  87. package/lib/examples/dynamic.js.map +1 -0
  88. package/lib/{enum.d.ts → examples/enum.d.ts} +0 -0
  89. package/lib/{enum.js → examples/enum.js} +2 -1
  90. package/lib/examples/enum.js.map +1 -0
  91. package/lib/examples/enumInArray.d.ts +27 -0
  92. package/lib/examples/enumInArray.js +44 -0
  93. package/lib/examples/enumInArray.js.map +1 -0
  94. package/lib/{generate.d.ts → examples/generate.d.ts} +0 -0
  95. package/lib/{generate.js → examples/generate.js} +2 -1
  96. package/lib/examples/generate.js.map +1 -0
  97. package/lib/{generateUI.d.ts → examples/generateUI.d.ts} +0 -0
  98. package/lib/{generateUI.js → examples/generateUI.js} +2 -1
  99. package/lib/examples/generateUI.js.map +1 -0
  100. package/lib/{huge.d.ts → examples/huge.d.ts} +0 -0
  101. package/lib/{huge.js → examples/huge.js} +2 -1
  102. package/lib/examples/huge.js.map +1 -0
  103. package/lib/{i18n.d.ts → examples/i18n.d.ts} +1 -1
  104. package/lib/{i18n.js → examples/i18n.js} +4 -2
  105. package/lib/examples/i18n.js.map +1 -0
  106. package/lib/{if_then_else.d.ts → examples/if_then_else.d.ts} +0 -0
  107. package/lib/{if_then_else.js → examples/if_then_else.js} +2 -1
  108. package/lib/examples/if_then_else.js.map +1 -0
  109. package/lib/{layout.d.ts → examples/layout.d.ts} +0 -0
  110. package/lib/{layout.js → examples/layout.js} +2 -1
  111. package/lib/examples/layout.js.map +1 -0
  112. package/lib/{list-with-detail-registered.d.ts → examples/list-with-detail-registered.d.ts} +0 -0
  113. package/lib/{list-with-detail-registered.js → examples/list-with-detail-registered.js} +1 -1
  114. package/lib/examples/list-with-detail-registered.js.map +1 -0
  115. package/lib/{list-with-detail.d.ts → examples/list-with-detail.d.ts} +0 -0
  116. package/lib/{list-with-detail.js → examples/list-with-detail.js} +98 -1
  117. package/lib/examples/list-with-detail.js.map +1 -0
  118. package/lib/{multi-enum.d.ts → examples/multi-enum.d.ts} +0 -0
  119. package/lib/{multi-enum.js → examples/multi-enum.js} +2 -1
  120. package/lib/examples/multi-enum.js.map +1 -0
  121. package/lib/examples/nestedArrays.d.ts +11 -0
  122. package/lib/{nestedArrays.js → examples/nestedArrays.js} +40 -24
  123. package/lib/examples/nestedArrays.js.map +1 -0
  124. package/lib/{numbers.d.ts → examples/numbers.d.ts} +0 -0
  125. package/lib/{numbers.js → examples/numbers.js} +2 -1
  126. package/lib/examples/numbers.js.map +1 -0
  127. package/lib/{object.d.ts → examples/object.d.ts} +0 -0
  128. package/lib/{object.js → examples/object.js} +2 -1
  129. package/lib/examples/object.js.map +1 -0
  130. package/lib/{onChange.d.ts → examples/onChange.d.ts} +1 -1
  131. package/lib/{onChange.js → examples/onChange.js} +6 -3
  132. package/lib/examples/onChange.js.map +1 -0
  133. package/lib/{oneOf-recursive.d.ts → examples/oneOf-recursive.d.ts} +0 -0
  134. package/lib/{oneOf-recursive.js → examples/oneOf-recursive.js} +2 -1
  135. package/lib/examples/oneOf-recursive.js.map +1 -0
  136. package/lib/{oneOf.d.ts → examples/oneOf.d.ts} +0 -0
  137. package/lib/{oneOf.js → examples/oneOf.js} +2 -1
  138. package/lib/examples/oneOf.js.map +1 -0
  139. package/lib/{oneOfArray.d.ts → examples/oneOfArray.d.ts} +0 -0
  140. package/lib/{oneOfArray.js → examples/oneOfArray.js} +2 -1
  141. package/lib/examples/oneOfArray.js.map +1 -0
  142. package/lib/{person.d.ts → examples/person.d.ts} +0 -0
  143. package/lib/{person.js → examples/person.js} +2 -1
  144. package/lib/examples/person.js.map +1 -0
  145. package/lib/examples/radioGroup.d.ts +1 -0
  146. package/lib/{radioGroup.js → examples/radioGroup.js} +1 -1
  147. package/lib/examples/radioGroup.js.map +1 -0
  148. package/lib/examples/readonly.d.ts +36 -0
  149. package/lib/examples/readonly.js +81 -0
  150. package/lib/examples/readonly.js.map +1 -0
  151. package/lib/{resolve.d.ts → examples/resolve.d.ts} +0 -0
  152. package/lib/{resolve.js → examples/resolve.js} +2 -1
  153. package/lib/examples/resolve.js.map +1 -0
  154. package/lib/{rule.d.ts → examples/rule.d.ts} +0 -0
  155. package/lib/{rule.js → examples/rule.js} +2 -1
  156. package/lib/examples/rule.js.map +1 -0
  157. package/lib/{ruleInheritance.d.ts → examples/ruleInheritance.d.ts} +0 -0
  158. package/lib/{ruleInheritance.js → examples/ruleInheritance.js} +19 -26
  159. package/lib/examples/ruleInheritance.js.map +1 -0
  160. package/lib/{scope.d.ts → examples/scope.d.ts} +0 -0
  161. package/lib/{scope.js → examples/scope.js} +2 -1
  162. package/lib/examples/scope.js.map +1 -0
  163. package/lib/{stepper.d.ts → examples/stepper.d.ts} +0 -0
  164. package/lib/{stepper.js → examples/stepper.js} +2 -1
  165. package/lib/examples/stepper.js.map +1 -0
  166. package/lib/{steppershownav.d.ts → examples/steppershownav.d.ts} +0 -0
  167. package/lib/{steppershownav.js → examples/steppershownav.js} +2 -1
  168. package/lib/examples/steppershownav.js.map +1 -0
  169. package/lib/{stringArray.d.ts → examples/stringArray.d.ts} +0 -0
  170. package/lib/{stringArray.js → examples/stringArray.js} +2 -1
  171. package/lib/examples/stringArray.js.map +1 -0
  172. package/lib/{text.d.ts → examples/text.d.ts} +0 -0
  173. package/lib/{text.js → examples/text.js} +2 -1
  174. package/lib/examples/text.js.map +1 -0
  175. package/lib/index.d.ts +56 -52
  176. package/lib/index.js +61 -51
  177. package/lib/index.js.map +1 -1
  178. package/lib/register.js +5 -2
  179. package/lib/register.js.map +1 -1
  180. package/package.json +5 -4
  181. package/src/example.ts +18 -12
  182. package/src/{1169.ts → examples/1169.ts} +1 -1
  183. package/src/{1220.ts → examples/1220.ts} +58 -36
  184. package/src/{1253.ts → examples/1253.ts} +1 -1
  185. package/src/{1254.ts → examples/1254.ts} +1 -1
  186. package/src/examples/1645.ts +66 -0
  187. package/src/examples/1779.ts +83 -0
  188. package/src/{allOf.ts → examples/allOf.ts} +1 -1
  189. package/src/{anyOf-oneOf-allOf-resolve.ts → examples/anyOf-oneOf-allOf-resolve.ts} +1 -1
  190. package/src/{anyOf.ts → examples/anyOf.ts} +1 -1
  191. package/src/{arrays-with-custom-element-label.ts → examples/arrays-with-custom-element-label.ts} +1 -1
  192. package/src/{arrays-with-detail-and-rule.ts → examples/arrays-with-detail-and-rule.ts} +1 -1
  193. package/src/{arrays-with-detail.ts → examples/arrays-with-detail.ts} +1 -1
  194. package/src/{arrays.ts → examples/arrays.ts} +36 -8
  195. package/src/{booleanToggle.ts → examples/booleanToggle.ts} +1 -1
  196. package/src/{categorization.ts → examples/categorization.ts} +1 -1
  197. package/src/{config.ts → examples/config.ts} +1 -1
  198. package/src/{control-options.ts → examples/control-options.ts} +2 -2
  199. package/src/examples/dates.ts +149 -0
  200. package/src/{day1.ts → examples/day1.ts} +1 -1
  201. package/src/{day2.ts → examples/day2.ts} +5 -5
  202. package/src/{day3.ts → examples/day3.ts} +1 -1
  203. package/src/{day4.ts → examples/day4.ts} +1 -1
  204. package/src/{day5.ts → examples/day5.ts} +1 -1
  205. package/src/{day6.ts → examples/day6.ts} +1 -1
  206. package/src/{default.ts → examples/default.ts} +1 -1
  207. package/src/{dynamic.ts → examples/dynamic.ts} +17 -2
  208. package/src/{enum.ts → examples/enum.ts} +1 -1
  209. package/src/examples/enumInArray.ts +44 -0
  210. package/src/{generate.ts → examples/generate.ts} +1 -1
  211. package/src/{generateUI.ts → examples/generateUI.ts} +1 -1
  212. package/src/{huge.ts → examples/huge.ts} +1 -1
  213. package/src/{i18n.ts → examples/i18n.ts} +1 -1
  214. package/src/{if_then_else.ts → examples/if_then_else.ts} +1 -1
  215. package/src/{layout.ts → examples/layout.ts} +1 -1
  216. package/src/{list-with-detail-registered.ts → examples/list-with-detail-registered.ts} +1 -1
  217. package/src/{list-with-detail.ts → examples/list-with-detail.ts} +100 -1
  218. package/src/{multi-enum.ts → examples/multi-enum.ts} +1 -1
  219. package/src/{nestedArrays.ts → examples/nestedArrays.ts} +49 -36
  220. package/src/{numbers.ts → examples/numbers.ts} +1 -1
  221. package/src/{object.ts → examples/object.ts} +1 -1
  222. package/src/{onChange.ts → examples/onChange.ts} +2 -2
  223. package/src/{oneOf-recursive.ts → examples/oneOf-recursive.ts} +1 -1
  224. package/src/{oneOf.ts → examples/oneOf.ts} +1 -1
  225. package/src/{oneOfArray.ts → examples/oneOfArray.ts} +1 -1
  226. package/src/{person.ts → examples/person.ts} +1 -1
  227. package/src/{radioGroup.ts → examples/radioGroup.ts} +1 -1
  228. package/src/examples/readonly.ts +81 -0
  229. package/src/{resolve.ts → examples/resolve.ts} +1 -1
  230. package/src/{rule.ts → examples/rule.ts} +1 -1
  231. package/src/{ruleInheritance.ts → examples/ruleInheritance.ts} +25 -2
  232. package/src/{scope.ts → examples/scope.ts} +1 -1
  233. package/src/{stepper.ts → examples/stepper.ts} +1 -1
  234. package/src/{steppershownav.ts → examples/steppershownav.ts} +1 -1
  235. package/src/{stringArray.ts → examples/stringArray.ts} +1 -1
  236. package/src/{text.ts → examples/text.ts} +1 -1
  237. package/src/index.ts +60 -52
  238. package/docs/interfaces/changeexampleaction.html +0 -159
  239. package/lib/1169.js.map +0 -1
  240. package/lib/1220.d.ts +0 -3
  241. package/lib/1220.js.map +0 -1
  242. package/lib/1253.js.map +0 -1
  243. package/lib/1254.js.map +0 -1
  244. package/lib/allOf.js.map +0 -1
  245. package/lib/anyOf-oneOf-allOf-resolve.js.map +0 -1
  246. package/lib/anyOf.js.map +0 -1
  247. package/lib/arrays-with-custom-element-label.js.map +0 -1
  248. package/lib/arrays-with-detail-and-rule.js.map +0 -1
  249. package/lib/arrays-with-detail.js.map +0 -1
  250. package/lib/arrays.js.map +0 -1
  251. package/lib/booleanToggle.js.map +0 -1
  252. package/lib/categorization.js.map +0 -1
  253. package/lib/config.js.map +0 -1
  254. package/lib/control-options.js.map +0 -1
  255. package/lib/dates.js +0 -88
  256. package/lib/dates.js.map +0 -1
  257. package/lib/day1.js.map +0 -1
  258. package/lib/day2.js.map +0 -1
  259. package/lib/day3.js.map +0 -1
  260. package/lib/day4.js.map +0 -1
  261. package/lib/day5.js.map +0 -1
  262. package/lib/day6.js.map +0 -1
  263. package/lib/default.js.map +0 -1
  264. package/lib/dynamic.js +0 -37
  265. package/lib/dynamic.js.map +0 -1
  266. package/lib/enum.js.map +0 -1
  267. package/lib/generate.js.map +0 -1
  268. package/lib/generateUI.js.map +0 -1
  269. package/lib/huge.js.map +0 -1
  270. package/lib/i18n.js.map +0 -1
  271. package/lib/if_then_else.js.map +0 -1
  272. package/lib/layout.js.map +0 -1
  273. package/lib/list-with-detail-registered.js.map +0 -1
  274. package/lib/list-with-detail.js.map +0 -1
  275. package/lib/multi-enum.js.map +0 -1
  276. package/lib/nestedArrays.d.ts +0 -4
  277. package/lib/nestedArrays.js.map +0 -1
  278. package/lib/numbers.js.map +0 -1
  279. package/lib/object.js.map +0 -1
  280. package/lib/onChange.js.map +0 -1
  281. package/lib/oneOf-recursive.js.map +0 -1
  282. package/lib/oneOf.js.map +0 -1
  283. package/lib/oneOfArray.js.map +0 -1
  284. package/lib/person.js.map +0 -1
  285. package/lib/radioGroup.js.map +0 -1
  286. package/lib/resolve.js.map +0 -1
  287. package/lib/rule.js.map +0 -1
  288. package/lib/ruleInheritance.js.map +0 -1
  289. package/lib/scope.js.map +0 -1
  290. package/lib/stepper.js.map +0 -1
  291. package/lib/steppershownav.js.map +0 -1
  292. package/lib/stringArray.js.map +0 -1
  293. package/lib/text.js.map +0 -1
  294. package/src/dates.ts +0 -85
@@ -22,16 +22,9 @@
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 { registerExamples } from './register';
26
- import {
27
- Actions,
28
- ControlElement,
29
- JsonSchema,
30
- NOT_APPLICABLE,
31
- VerticalLayout,
32
- AnyAction,
33
- Dispatch
34
- } from '@jsonforms/core';
25
+ import { registerExamples } from '../register';
26
+ import { ControlElement, JsonFormsUISchemaRegistryEntry, JsonSchema, NOT_APPLICABLE } from '@jsonforms/core';
27
+ import { StateProps } from '..';
35
28
 
36
29
  const schema = {
37
30
  type: 'object',
@@ -54,7 +47,7 @@ const schema = {
54
47
  }
55
48
  };
56
49
 
57
- const uischema = {
50
+ export const uischema = {
58
51
  type: 'HorizontalLayout',
59
52
  elements: [
60
53
  {
@@ -77,19 +70,6 @@ const data = {
77
70
  ]
78
71
  };
79
72
 
80
- registerExamples([
81
- {
82
- name: 'nestedArray',
83
- label: 'Nested Array',
84
- data,
85
- schema,
86
- uischema
87
- }
88
- ]);
89
-
90
- const nestedArrayTester = (_jsonSchema: JsonSchema, schemaPath: string) => {
91
- return schemaPath === '#/properties/exampleArray' ? 2 : NOT_APPLICABLE;
92
- };
93
73
  const control1: ControlElement = {
94
74
  type: 'Control',
95
75
  scope: '#/properties/name'
@@ -99,15 +79,48 @@ const control2: ControlElement = {
99
79
  type: 'Control',
100
80
  scope: '#/properties/choices'
101
81
  };
102
- export const nestedArrayLayout: VerticalLayout = {
103
- type: 'VerticalLayout',
104
- elements: [control1, control2]
105
- };
106
- export const registerNestedArrayUISchema = (dispatch: Dispatch<AnyAction>) => {
107
- dispatch(Actions.registerUISchema(nestedArrayTester, nestedArrayLayout));
108
- };
109
- export const unregisterNestedArrayUISchema = (
110
- dispatch: Dispatch<AnyAction>
111
- ) => {
112
- dispatch(Actions.unregisterUISchema(nestedArrayTester));
113
- };
82
+
83
+ const uischemas = [
84
+ {
85
+ tester: (_jsonSchema: JsonSchema, schemaPath: string) => {
86
+ return schemaPath === '#/properties/exampleArray' ? 2 : NOT_APPLICABLE;
87
+ },
88
+ uischema: {
89
+ type: 'VerticalLayout',
90
+ elements: [control1, control2]
91
+ }
92
+ }
93
+ ];
94
+
95
+ const actions = [
96
+ {
97
+ 'label': 'Register NestedArray UISchema',
98
+ 'apply': (props: StateProps) => {
99
+ return {
100
+ ...props,
101
+ uischemas: uischemas
102
+ }
103
+ }
104
+ },
105
+ {
106
+ 'label': 'Unregister NestedArray UISchema',
107
+ 'apply': (props: StateProps) => {
108
+ const uischemas: JsonFormsUISchemaRegistryEntry[] = undefined;
109
+ return {
110
+ ...props,
111
+ uischemas: uischemas
112
+ }
113
+ }
114
+ },
115
+ ]
116
+
117
+ registerExamples([
118
+ {
119
+ name: 'nestedArray',
120
+ label: 'Nested Array',
121
+ data,
122
+ schema,
123
+ uischema,
124
+ actions
125
+ }
126
+ ]);
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  type: 'object',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
  import { UISchemaElement, updateErrors, JsonFormsCore, AnyAction, Dispatch } from '@jsonforms/core';
27
27
 
28
28
  let touchedProperties: any = {
@@ -37,7 +37,7 @@ export const onChange = (dispatch: Dispatch<AnyAction>) => (_: any) => ({
37
37
  Object.keys(data).forEach(key => (touchedProperties[key] = true));
38
38
 
39
39
  const newErrors = errors.filter(error => {
40
- return touchedProperties[error.dataPath];
40
+ return touchedProperties[(error as any).dataPath ?? error.instancePath];
41
41
  });
42
42
 
43
43
  if (newErrors.length < errors.length) {
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const personCoreSchema = {
28
28
  type: 'object',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  const data = {
28
28
  };
@@ -0,0 +1,81 @@
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
+ properties: {
30
+ readonly: {
31
+ type: 'string',
32
+ readOnly: true
33
+ },
34
+ readonlyByUISchema: {
35
+ type: 'string'
36
+ },
37
+ notReadonly: {
38
+ type: 'string'
39
+ }
40
+ }
41
+ };
42
+
43
+ export const uischema = {
44
+ type: 'VerticalLayout',
45
+ elements: [
46
+ {
47
+ type: 'Control',
48
+ scope: '#/properties/readonly',
49
+ label: 'A readonly field'
50
+ },
51
+ {
52
+ type: 'Control',
53
+ scope: '#/properties/readonlyByUISchema',
54
+ label: 'A readonly field by ui schema',
55
+ options: {
56
+ readonly: true
57
+ }
58
+ },
59
+ {
60
+ type: 'Control',
61
+ scope: '#/properties/notReadonly',
62
+ label: 'A normal field'
63
+ }
64
+ ]
65
+ };
66
+
67
+ export const data = {
68
+ readonly: 'readonly by schema',
69
+ readonlyByUISchema: 'readonly by ui schema',
70
+ notReadonly: 'normal field'
71
+ };
72
+
73
+ registerExamples([
74
+ {
75
+ name: 'Readonly Fields',
76
+ label: 'Readonly examples',
77
+ data,
78
+ schema,
79
+ uischema
80
+ }
81
+ ]);
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  definitions: {
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  type: 'object',
@@ -22,7 +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 { registerExamples } from './register';
25
+ import { StateProps } from '../example';
26
+ import { registerExamples } from '../register';
26
27
 
27
28
  export const schema = {
28
29
  type: 'object',
@@ -93,12 +94,34 @@ export const data = {
93
94
  toggleControl: true
94
95
  };
95
96
 
97
+ const actions = [
98
+ {
99
+ 'label': 'Enable/Disable top layout',
100
+ 'apply': (props: StateProps) => {
101
+ return {
102
+ ...props,
103
+ data: { ...props.data, toggleTopLayout: !props.data.toggleTopLayout }
104
+ }
105
+ }
106
+ },
107
+ {
108
+ 'label': 'Show/Hide bottom layout',
109
+ 'apply': (props: StateProps) => {
110
+ return {
111
+ ...props,
112
+ data: { ...props.data, toggleBottomLayout: !props.data.toggleBottomLayout }
113
+ }
114
+ }
115
+ },
116
+ ]
117
+
96
118
  registerExamples([
97
119
  {
98
120
  name: 'rule-enable',
99
121
  label: 'Rule Inheritance',
100
122
  data,
101
123
  schema,
102
- uischema
124
+ uischema,
125
+ actions
103
126
  }
104
127
  ]);
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const orderSchema = {
28
28
  type: 'object',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
  import {
27
27
  data as categorizationData,
28
28
  schema as categorizationSchema,
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
  import {
27
27
  data as categorizationData,
28
28
  schema as categorizationSchema,
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  type: 'object',
@@ -22,7 +22,7 @@
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 { registerExamples } from './register';
25
+ import { registerExamples } from '../register';
26
26
 
27
27
  export const schema = {
28
28
  type: 'object',
package/src/index.ts CHANGED
@@ -22,60 +22,64 @@
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 * as allOf from './allOf';
26
- import * as anyOf from './anyOf';
27
- import * as oneOf from './oneOf';
28
- import * as oneOfArray from './oneOfArray';
29
- import * as anyOfOneOfAllOfResolve from './anyOf-oneOf-allOf-resolve';
30
- import * as array from './arrays';
31
- import * as nestedArray from './nestedArrays';
32
- import * as arrayWithDetail from './arrays-with-detail';
33
- import * as arrayWithDetailAndRule from './arrays-with-detail-and-rule';
34
- import * as arrayWithCustomChildLabel from './arrays-with-custom-element-label';
35
- import * as stringArray from './stringArray';
36
- import * as categorization from './categorization';
37
- import * as stepper from './stepper';
38
- import * as steppershownav from './steppershownav';
39
- import * as controlOptions from './control-options';
40
- import * as day1 from './day1';
41
- import * as day2 from './day2';
42
- import * as day3 from './day3';
43
- import * as day4 from './day4';
44
- import * as day5 from './day5';
45
- import * as day6 from './day6';
46
- import * as dates from './dates';
47
- import * as dynamic from './dynamic';
48
- import * as generateSchema from './generate';
49
- import * as generateUISchema from './generateUI';
50
- import * as layout from './layout';
51
- import * as person from './person';
52
- import * as rule from './rule';
53
- import * as ruleInheritance from './ruleInheritance';
54
- import * as resolve from './resolve';
55
- import * as config from './config';
56
- import * as text from './text';
57
- import * as numbers from './numbers';
58
- import * as scope from './scope';
59
- import * as listWithDetail from './list-with-detail';
60
- import * as listWithDetailRegistered from './list-with-detail-registered';
61
- import * as object from './object';
62
- import * as i18n from './i18n';
63
- import * as issue_1169 from './1169';
64
- import * as issue_1220 from './1220';
65
- import * as issue_1253 from './1253';
66
- import * as issue_1254 from './1254';
67
- import * as oneOfRecursive from './oneOf-recursive';
68
- import * as huge from './huge';
69
- import * as defaultExample from './default';
70
- import * as onChange from './onChange';
71
- import * as enumExample from './enum';
72
- import * as radioGroupExample from './radioGroup';
73
- import * as booleanToggle from './booleanToggle';
74
- import * as multiEnum from './multi-enum';
25
+ import * as allOf from './examples/allOf';
26
+ import * as anyOf from './examples/anyOf';
27
+ import * as oneOf from './examples/oneOf';
28
+ import * as oneOfArray from './examples/oneOfArray';
29
+ import * as anyOfOneOfAllOfResolve from './examples/anyOf-oneOf-allOf-resolve';
30
+ import * as array from './examples/arrays';
31
+ import * as nestedArray from './examples/nestedArrays';
32
+ import * as arrayWithDetail from './examples/arrays-with-detail';
33
+ import * as arrayWithDetailAndRule from './examples/arrays-with-detail-and-rule';
34
+ import * as arrayWithCustomChildLabel from './examples/arrays-with-custom-element-label';
35
+ import * as stringArray from './examples/stringArray';
36
+ import * as categorization from './examples/categorization';
37
+ import * as stepper from './examples/stepper';
38
+ import * as steppershownav from './examples/steppershownav';
39
+ import * as controlOptions from './examples/control-options';
40
+ import * as day1 from './examples/day1';
41
+ import * as day2 from './examples/day2';
42
+ import * as day3 from './examples/day3';
43
+ import * as day4 from './examples/day4';
44
+ import * as day5 from './examples/day5';
45
+ import * as day6 from './examples/day6';
46
+ import * as dates from './examples/dates';
47
+ import * as dynamic from './examples/dynamic';
48
+ import * as generateSchema from './examples/generate';
49
+ import * as generateUISchema from './examples/generateUI';
50
+ import * as layout from './examples/layout';
51
+ import * as person from './examples/person';
52
+ import * as rule from './examples/rule';
53
+ import * as ruleInheritance from './examples/ruleInheritance';
54
+ import * as resolve from './examples/resolve';
55
+ import * as config from './examples/config';
56
+ import * as text from './examples/text';
57
+ import * as numbers from './examples/numbers';
58
+ import * as scope from './examples/scope';
59
+ import * as listWithDetail from './examples/list-with-detail';
60
+ import * as listWithDetailRegistered from './examples/list-with-detail-registered';
61
+ import * as object from './examples/object';
62
+ import * as i18n from './examples/i18n';
63
+ import * as issue_1169 from './examples/1169';
64
+ import * as issue_1220 from './examples/1220';
65
+ import * as issue_1253 from './examples/1253';
66
+ import * as issue_1254 from './examples/1254';
67
+ import * as oneOfRecursive from './examples/oneOf-recursive';
68
+ import * as huge from './examples/huge';
69
+ import * as defaultExample from './examples/default';
70
+ import * as onChange from './examples/onChange';
71
+ import * as enumExample from './examples/enum';
72
+ import * as radioGroupExample from './examples/radioGroup';
73
+ import * as booleanToggle from './examples/booleanToggle';
74
+ import * as multiEnum from './examples/multi-enum';
75
+ import * as enumInArray from './examples/enumInArray';
76
+ import * as readonly from './examples/readonly';
77
+ import * as bug_1779 from './examples/1779';
78
+ import * as bug_1645 from './examples/1645';
75
79
  export * from './register';
76
80
  export * from './example';
77
81
 
78
- import * as ifThenElse from './if_then_else';
82
+ import * as ifThenElse from './examples/if_then_else';
79
83
 
80
84
  export {
81
85
  defaultExample,
@@ -128,5 +132,9 @@ export {
128
132
  enumExample,
129
133
  radioGroupExample,
130
134
  booleanToggle,
131
- multiEnum
135
+ multiEnum,
136
+ enumInArray,
137
+ readonly,
138
+ bug_1779,
139
+ bug_1645
132
140
  };