@jsonforms/core 2.5.2-alpha.0 → 3.0.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 (273) hide show
  1. package/README.md +1 -1
  2. package/docs/assets/js/search.json +1 -1
  3. package/docs/enums/ruleeffect.html +4 -4
  4. package/docs/globals.html +1061 -1120
  5. package/docs/index.html +64 -91
  6. package/docs/interfaces/addcellrendereraction.html +3 -3
  7. package/docs/interfaces/addrendereraction.html +3 -3
  8. package/docs/interfaces/adduischemaaction.html +3 -3
  9. package/docs/interfaces/andcondition.html +2 -2
  10. package/docs/interfaces/arraycontrolprops.html +22 -22
  11. package/docs/interfaces/arraylayoutprops.html +22 -22
  12. package/docs/interfaces/categorization.html +5 -5
  13. package/docs/interfaces/category.html +5 -5
  14. package/docs/interfaces/cellprops.html +14 -14
  15. package/docs/interfaces/combinatorrendererprops.html +13 -13
  16. package/docs/interfaces/combinatorsubschemarenderinfo.html +3 -3
  17. package/docs/interfaces/composablecondition.html +2 -2
  18. package/docs/interfaces/condition.html +1 -1
  19. package/docs/interfaces/controlelement.html +5 -5
  20. package/docs/interfaces/controlprops.html +17 -17
  21. package/docs/interfaces/controlstate.html +2 -2
  22. package/docs/interfaces/controlwithdetailprops.html +18 -18
  23. package/docs/interfaces/dispatchcellprops.html +13 -13
  24. package/docs/interfaces/dispatchcellstateprops.html +13 -13
  25. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  26. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  27. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  28. package/docs/interfaces/enumcellprops.html +15 -15
  29. package/docs/interfaces/enumoption.html +2 -2
  30. package/docs/interfaces/formatted.html +2 -2
  31. package/docs/interfaces/grouplayout.html +5 -5
  32. package/docs/interfaces/horizontallayout.html +4 -4
  33. package/docs/interfaces/initaction.html +6 -6
  34. package/docs/interfaces/initactionoptions.html +3 -17
  35. package/docs/interfaces/jsonformscellrendererregistryentry.html +2 -2
  36. package/docs/interfaces/jsonformscore.html +7 -21
  37. package/docs/interfaces/jsonformsdefaultdataregistryentry.html +2 -2
  38. package/docs/interfaces/jsonformsextendedstate.html +1 -1
  39. package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
  40. package/docs/interfaces/jsonformsprops.html +9 -24
  41. package/docs/interfaces/jsonformsrendererregistryentry.html +2 -2
  42. package/docs/interfaces/jsonformsstate.html +1 -1
  43. package/docs/interfaces/jsonformsstore.html +5 -5
  44. package/docs/interfaces/jsonformssubstates.html +18 -8
  45. package/docs/interfaces/jsonformsuischemaregistryentry.html +2 -2
  46. package/docs/interfaces/labeldescription.html +2 -2
  47. package/docs/interfaces/labelelement.html +4 -4
  48. package/docs/interfaces/layout.html +4 -4
  49. package/docs/interfaces/layoutprops.html +10 -10
  50. package/docs/interfaces/leafcondition.html +3 -3
  51. package/docs/interfaces/orcondition.html +2 -2
  52. package/docs/interfaces/ownpropsofcell.html +10 -10
  53. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  54. package/docs/interfaces/ownpropsofenum.html +1 -1
  55. package/docs/interfaces/ownpropsofenumcell.html +11 -11
  56. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  57. package/docs/interfaces/ownpropsoflayout.html +9 -9
  58. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  59. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  60. package/docs/interfaces/registerdefaultdataaction.html +3 -3
  61. package/docs/interfaces/removecellrendereraction.html +3 -3
  62. package/docs/interfaces/removerendereraction.html +3 -3
  63. package/docs/interfaces/removeuischemaaction.html +2 -2
  64. package/docs/interfaces/rendererprops.html +9 -9
  65. package/docs/interfaces/rule.html +2 -2
  66. package/docs/interfaces/schemabasedcondition.html +3 -3
  67. package/docs/interfaces/scopable.html +1 -1
  68. package/docs/interfaces/setajvaction.html +3 -3
  69. package/docs/interfaces/setconfigaction.html +2 -2
  70. package/docs/interfaces/setlocaleaction.html +3 -3
  71. package/docs/interfaces/setschemaaction.html +2 -2
  72. package/docs/interfaces/{setlocalizeduischemasaction.html → settranslatoraction.html} +29 -15
  73. package/docs/interfaces/setuischemaaction.html +2 -2
  74. package/docs/interfaces/setvalidationmodeaction.html +2 -2
  75. package/docs/interfaces/statepropsofarraycontrol.html +18 -18
  76. package/docs/interfaces/statepropsofarraylayout.html +18 -18
  77. package/docs/interfaces/statepropsofcell.html +13 -13
  78. package/docs/interfaces/statepropsofcombinator.html +12 -12
  79. package/docs/interfaces/statepropsofcontrol.html +16 -16
  80. package/docs/interfaces/statepropsofcontrolwithdetail.html +17 -17
  81. package/docs/interfaces/statepropsofenumcell.html +14 -14
  82. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -23
  83. package/docs/interfaces/statepropsoflayout.html +10 -10
  84. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  85. package/docs/interfaces/statepropsofrenderer.html +9 -9
  86. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  87. package/docs/interfaces/uischemaelement.html +3 -3
  88. package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
  89. package/docs/interfaces/updateaction.html +3 -3
  90. package/docs/interfaces/updatecoreaction.html +6 -6
  91. package/docs/interfaces/updateerrorsaction.html +2 -2
  92. package/docs/interfaces/{setlocalizedschemasaction.html → updatei18naction.html} +43 -15
  93. package/docs/interfaces/verticallayout.html +4 -4
  94. package/docs/interfaces/withclassname.html +1 -1
  95. package/lib/Helpers.d.ts +5 -0
  96. package/lib/Helpers.js +33 -0
  97. package/lib/Helpers.js.map +1 -0
  98. package/lib/actions/actions.d.ts +181 -0
  99. package/lib/actions/actions.js +173 -0
  100. package/lib/actions/actions.js.map +1 -0
  101. package/lib/actions/index.d.ts +1 -180
  102. package/lib/actions/index.js +26 -122
  103. package/lib/actions/index.js.map +1 -1
  104. package/lib/configDefault.js +2 -1
  105. package/lib/configDefault.js.map +1 -1
  106. package/lib/generators/Generate.d.ts +6 -0
  107. package/lib/generators/Generate.js +35 -0
  108. package/lib/generators/Generate.js.map +1 -0
  109. package/lib/generators/index.d.ts +3 -10
  110. package/lib/generators/index.js +28 -9
  111. package/lib/generators/index.js.map +1 -1
  112. package/lib/generators/schema.d.ts +1 -1
  113. package/lib/generators/schema.js +3 -1
  114. package/lib/generators/schema.js.map +1 -1
  115. package/lib/generators/uischema.d.ts +1 -2
  116. package/lib/generators/uischema.js +12 -10
  117. package/lib/generators/uischema.js.map +1 -1
  118. package/lib/i18n/i18nTypes.d.ts +15 -0
  119. package/lib/i18n/i18nTypes.js +3 -0
  120. package/lib/i18n/i18nTypes.js.map +1 -0
  121. package/lib/i18n/i18nUtil.d.ts +11 -0
  122. package/lib/i18n/i18nUtil.js +58 -0
  123. package/lib/i18n/i18nUtil.js.map +1 -0
  124. package/lib/i18n/index.d.ts +2 -0
  125. package/lib/i18n/index.js +6 -0
  126. package/lib/i18n/index.js.map +1 -0
  127. package/lib/index.d.ts +6 -18
  128. package/lib/index.js +10 -15
  129. package/lib/index.js.map +1 -1
  130. package/lib/jsonforms-core.js +9 -12
  131. package/lib/jsonforms-core.js.map +1 -1
  132. package/lib/models/draft4.js +2 -1
  133. package/lib/models/draft4.js.map +1 -1
  134. package/lib/models/index.d.ts +5 -0
  135. package/lib/models/index.js +33 -0
  136. package/lib/models/index.js.map +1 -0
  137. package/lib/models/jsonSchema.js +24 -0
  138. package/lib/models/jsonSchema.js.map +1 -1
  139. package/lib/models/uischema.js +29 -2
  140. package/lib/models/uischema.js.map +1 -1
  141. package/lib/reducers/cells.d.ts +1 -1
  142. package/lib/reducers/cells.js +27 -1
  143. package/lib/reducers/cells.js.map +1 -1
  144. package/lib/reducers/config.d.ts +1 -1
  145. package/lib/reducers/config.js +5 -3
  146. package/lib/reducers/config.js.map +1 -1
  147. package/lib/reducers/core.d.ts +5 -7
  148. package/lib/reducers/core.js +78 -63
  149. package/lib/reducers/core.js.map +1 -1
  150. package/lib/reducers/default-data.d.ts +1 -1
  151. package/lib/reducers/default-data.js +6 -3
  152. package/lib/reducers/default-data.js.map +1 -1
  153. package/lib/reducers/i18n.d.ts +8 -11
  154. package/lib/reducers/i18n.js +40 -23
  155. package/lib/reducers/i18n.js.map +1 -1
  156. package/lib/reducers/index.d.ts +9 -49
  157. package/lib/reducers/index.js +33 -91
  158. package/lib/reducers/index.js.map +1 -1
  159. package/lib/reducers/reducers.d.ts +37 -0
  160. package/lib/reducers/reducers.js +107 -0
  161. package/lib/reducers/reducers.js.map +1 -0
  162. package/lib/reducers/renderers.d.ts +1 -1
  163. package/lib/reducers/renderers.js +27 -1
  164. package/lib/reducers/renderers.js.map +1 -1
  165. package/lib/reducers/selectors.d.ts +15 -0
  166. package/lib/reducers/selectors.js +56 -0
  167. package/lib/reducers/selectors.js.map +1 -0
  168. package/lib/reducers/uischemas.d.ts +2 -2
  169. package/lib/reducers/uischemas.js +9 -6
  170. package/lib/reducers/uischemas.js.map +1 -1
  171. package/lib/store.d.ts +5 -8
  172. package/lib/store.js +24 -0
  173. package/lib/store.js.map +1 -1
  174. package/lib/testers/index.d.ts +1 -204
  175. package/lib/testers/index.js +3 -376
  176. package/lib/testers/index.js.map +1 -1
  177. package/lib/testers/testers.d.ts +203 -0
  178. package/lib/testers/testers.js +421 -0
  179. package/lib/testers/testers.js.map +1 -0
  180. package/lib/util/Formatted.js +24 -0
  181. package/lib/util/Formatted.js.map +1 -1
  182. package/lib/util/array.js +25 -0
  183. package/lib/util/array.js.map +1 -1
  184. package/lib/util/cell.d.ts +11 -4
  185. package/lib/util/cell.js +61 -17
  186. package/lib/util/cell.js.map +1 -1
  187. package/lib/util/combinators.d.ts +2 -3
  188. package/lib/util/combinators.js +5 -2
  189. package/lib/util/combinators.js.map +1 -1
  190. package/lib/util/ids.js +8 -4
  191. package/lib/util/ids.js.map +1 -1
  192. package/lib/util/index.d.ts +11 -45
  193. package/lib/util/index.js +14 -104
  194. package/lib/util/index.js.map +1 -1
  195. package/lib/util/label.d.ts +1 -2
  196. package/lib/util/label.js +7 -4
  197. package/lib/util/label.js.map +1 -1
  198. package/lib/util/path.d.ts +2 -1
  199. package/lib/util/path.js +12 -6
  200. package/lib/util/path.js.map +1 -1
  201. package/lib/util/renderer.d.ts +17 -17
  202. package/lib/util/renderer.js +163 -76
  203. package/lib/util/renderer.js.map +1 -1
  204. package/lib/util/resolvers.d.ts +1 -14
  205. package/lib/util/resolvers.js +9 -215
  206. package/lib/util/resolvers.js.map +1 -1
  207. package/lib/util/runtime.d.ts +12 -2
  208. package/lib/util/runtime.js +59 -17
  209. package/lib/util/runtime.js.map +1 -1
  210. package/lib/util/schema.js +27 -1
  211. package/lib/util/schema.js.map +1 -1
  212. package/lib/util/uischema.d.ts +1 -1
  213. package/lib/util/uischema.js +11 -7
  214. package/lib/util/uischema.js.map +1 -1
  215. package/lib/util/util.d.ts +31 -0
  216. package/lib/util/util.js +112 -0
  217. package/lib/util/util.js.map +1 -0
  218. package/lib/util/validator.d.ts +3 -2
  219. package/lib/util/validator.js +6 -5
  220. package/lib/util/validator.js.map +1 -1
  221. package/package.json +7 -9
  222. package/src/Helpers.ts +38 -0
  223. package/src/actions/actions.ts +345 -0
  224. package/src/actions/index.ts +1 -312
  225. package/src/configDefault.ts +1 -0
  226. package/src/generators/Generate.ts +43 -0
  227. package/src/generators/index.ts +3 -21
  228. package/src/generators/schema.ts +1 -1
  229. package/src/generators/uischema.ts +4 -4
  230. package/src/i18n/i18nTypes.ts +17 -0
  231. package/src/i18n/i18nUtil.ts +76 -0
  232. package/src/i18n/index.ts +2 -0
  233. package/src/index.ts +7 -31
  234. package/src/models/draft4.ts +1 -0
  235. package/src/models/index.ts +30 -0
  236. package/src/models/jsonSchema.ts +1 -0
  237. package/src/models/uischema.ts +1 -0
  238. package/src/reducers/cells.ts +2 -1
  239. package/src/reducers/config.ts +2 -1
  240. package/src/reducers/core.ts +74 -81
  241. package/src/reducers/default-data.ts +2 -1
  242. package/src/reducers/i18n.ts +42 -35
  243. package/src/reducers/index.ts +9 -158
  244. package/src/reducers/reducers.ts +148 -0
  245. package/src/reducers/renderers.ts +2 -1
  246. package/src/reducers/selectors.ts +65 -0
  247. package/src/reducers/uischemas.ts +4 -2
  248. package/src/store.ts +11 -8
  249. package/src/testers/index.ts +1 -516
  250. package/src/testers/testers.ts +547 -0
  251. package/src/util/Formatted.ts +1 -0
  252. package/src/util/array.ts +25 -0
  253. package/src/util/cell.ts +91 -19
  254. package/src/util/combinators.ts +2 -4
  255. package/src/util/ids.ts +1 -0
  256. package/src/util/index.ts +11 -126
  257. package/src/util/label.ts +2 -2
  258. package/src/util/path.ts +4 -1
  259. package/src/util/renderer.ts +168 -85
  260. package/src/util/resolvers.ts +2 -261
  261. package/src/util/runtime.ts +46 -2
  262. package/src/util/schema.ts +26 -1
  263. package/src/util/uischema.ts +2 -1
  264. package/src/util/util.ts +127 -0
  265. package/src/util/validator.ts +5 -8
  266. package/test/reducers/core.test.ts +31 -223
  267. package/test/util/cell.test.ts +33 -2
  268. package/test/util/renderer.test.ts +483 -3
  269. package/test/util/resolvers.test.ts +1 -59
  270. package/test/util/runtime.test.ts +264 -4
  271. package/docs/interfaces/labels.html +0 -157
  272. package/docs/interfaces/schemaref.html +0 -160
  273. package/docs/interfaces/schemarefs.html +0 -138
@@ -0,0 +1,148 @@
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
+
26
+ import { ControlElement, UISchemaElement } from '../models';
27
+ import {
28
+ coreReducer,
29
+ errorAt,
30
+ errorsAt,
31
+ getControlPath,
32
+ JsonFormsCore,
33
+ subErrorsAt,
34
+ ValidationMode
35
+ } from './core';
36
+ import { defaultDataReducer } from './default-data';
37
+ import { rendererReducer } from './renderers';
38
+ import { JsonFormsState } from '../store';
39
+ import {
40
+ findMatchingUISchema,
41
+ JsonFormsUISchemaRegistryEntry,
42
+ uischemaRegistryReducer,
43
+ UISchemaTester
44
+ } from './uischemas';
45
+ import {
46
+ fetchErrorTranslator,
47
+ fetchLocale,
48
+ i18nReducer,
49
+ } from './i18n';
50
+
51
+ import { Generate } from '../generators';
52
+ import { JsonSchema } from '../models/jsonSchema';
53
+
54
+ import { cellReducer } from './cells';
55
+ import { configReducer } from './config';
56
+ import get from 'lodash/get';
57
+ import { fetchTranslator } from '.';
58
+ import { ErrorTranslator, Translator } from '../i18n';
59
+
60
+ export {
61
+ rendererReducer,
62
+ cellReducer,
63
+ coreReducer,
64
+ i18nReducer,
65
+ configReducer,
66
+ UISchemaTester,
67
+ uischemaRegistryReducer,
68
+ findMatchingUISchema,
69
+ JsonFormsUISchemaRegistryEntry
70
+ };
71
+ export { JsonFormsCore, ValidationMode };
72
+
73
+ export const jsonFormsReducerConfig = {
74
+ core: coreReducer,
75
+ renderers: rendererReducer,
76
+ cells: cellReducer,
77
+ config: configReducer,
78
+ uischemas: uischemaRegistryReducer,
79
+ defaultData: defaultDataReducer,
80
+ i18n: i18nReducer
81
+ };
82
+
83
+ /**
84
+ * Finds a registered UI schema to use, if any.
85
+ * @param schema the JSON schema describing the data to be rendered
86
+ * @param schemaPath the according schema path
87
+ * @param path the instance path
88
+ * @param fallbackLayoutType the type of the layout to use
89
+ * @param control may be checked for embedded inline uischema options
90
+ */
91
+ export const findUISchema = (
92
+ uischemas: JsonFormsUISchemaRegistryEntry[],
93
+ schema: JsonSchema,
94
+ schemaPath: string,
95
+ path: string,
96
+ fallbackLayoutType = 'VerticalLayout',
97
+ control?: ControlElement,
98
+ rootSchema?: JsonSchema
99
+ ): UISchemaElement => {
100
+ // handle options
101
+ if (control && control.options && control.options.detail) {
102
+ if (typeof control.options.detail === 'string') {
103
+ if (control.options.detail.toUpperCase() === 'GENERATE') {
104
+ // force generation of uischema
105
+ return Generate.uiSchema(schema, fallbackLayoutType);
106
+ }
107
+ } else if (typeof control.options.detail === 'object') {
108
+ // check if detail is a valid uischema
109
+ if (
110
+ control.options.detail.type &&
111
+ typeof control.options.detail.type === 'string'
112
+ ) {
113
+ return control.options.detail as UISchemaElement;
114
+ }
115
+ }
116
+ }
117
+ // default
118
+ const uiSchema = findMatchingUISchema(uischemas)(schema, schemaPath, path);
119
+ if (uiSchema === undefined) {
120
+ return Generate.uiSchema(schema, fallbackLayoutType, '#', rootSchema);
121
+ }
122
+ return uiSchema;
123
+ };
124
+
125
+ export const getErrorAt = (instancePath: string, schema: JsonSchema) => (
126
+ state: JsonFormsState
127
+ ) => {
128
+ return errorAt(instancePath, schema)(state.jsonforms.core);
129
+ };
130
+
131
+ export { errorsAt, getControlPath };
132
+
133
+ export const getSubErrorsAt = (instancePath: string, schema: JsonSchema) => (
134
+ state: JsonFormsState
135
+ ) => subErrorsAt(instancePath, schema)(state.jsonforms.core);
136
+
137
+ export const getConfig = (state: JsonFormsState) => state.jsonforms.config;
138
+
139
+ export const getLocale = (state: JsonFormsState) =>
140
+ fetchLocale(get(state, 'jsonforms.i18n'));
141
+
142
+ export const getTranslator = () => (
143
+ state: JsonFormsState
144
+ ): Translator => fetchTranslator(get(state, 'jsonforms.i18n'));
145
+
146
+ export const getErrorTranslator = () => (
147
+ state: JsonFormsState
148
+ ): ErrorTranslator => fetchErrorTranslator(get(state, 'jsonforms.i18n'));
@@ -22,6 +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
+
25
26
  import { RankedTester } from '../testers';
26
27
  import {
27
28
  ADD_RENDERER,
@@ -29,7 +30,7 @@ import {
29
30
  REMOVE_RENDERER,
30
31
  RemoveRendererAction
31
32
  } from '../actions';
32
- import { Reducer } from '../util/type';
33
+ import { Reducer } from '../util';
33
34
 
34
35
  export interface JsonFormsRendererRegistryEntry {
35
36
  tester: RankedTester;
@@ -0,0 +1,65 @@
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
+
26
+ import get from 'lodash/get';
27
+ import Ajv from 'ajv';
28
+ import { JsonFormsState } from '../store';
29
+ import { JsonSchema, UISchemaElement } from '../models';
30
+ import {
31
+ extractAjv,
32
+ extractData,
33
+ extractSchema,
34
+ extractUiSchema,
35
+ } from './core';
36
+ import {
37
+ extractDefaultData,
38
+ JsonFormsDefaultDataRegistryEntry
39
+ } from './default-data';
40
+ import { JsonFormsRendererRegistryEntry } from './renderers';
41
+ import { JsonFormsCellRendererRegistryEntry } from './cells';
42
+ import { JsonFormsUISchemaRegistryEntry } from './uischemas';
43
+
44
+ export const getData = (state: JsonFormsState) =>
45
+ extractData(get(state, 'jsonforms.core'));
46
+ export const getSchema = (state: JsonFormsState): JsonSchema =>
47
+ extractSchema(get(state, 'jsonforms.core'));
48
+ export const getUiSchema = (state: JsonFormsState): UISchemaElement =>
49
+ extractUiSchema(get(state, 'jsonforms.core'));
50
+ export const getAjv = (
51
+ state: JsonFormsState
52
+ ): Ajv => extractAjv(get(state, 'jsonforms.core'));
53
+ export const getDefaultData = (
54
+ state: JsonFormsState
55
+ ): JsonFormsDefaultDataRegistryEntry[] =>
56
+ extractDefaultData(get(state, 'jsonforms.defaultData'));
57
+ export const getRenderers = (
58
+ state: JsonFormsState
59
+ ): JsonFormsRendererRegistryEntry[] => get(state, 'jsonforms.renderers');
60
+ export const getCells = (
61
+ state: JsonFormsState
62
+ ): JsonFormsCellRendererRegistryEntry[] => get(state, 'jsonforms.cells');
63
+ export const getUISchemas = (
64
+ state: JsonFormsState
65
+ ): JsonFormsUISchemaRegistryEntry[] => get(state, 'jsonforms.uischemas')
@@ -22,11 +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
+
25
26
  import maxBy from 'lodash/maxBy';
26
27
  import remove from 'lodash/remove';
27
28
  import { ADD_UI_SCHEMA, REMOVE_UI_SCHEMA, UISchemaActions } from '../actions';
28
- import { JsonSchema, NOT_APPLICABLE, UISchemaElement } from '..';
29
- import { Reducer } from '../util/type';
29
+ import { NOT_APPLICABLE } from '../testers';
30
+ import { JsonSchema, UISchemaElement } from '../models';
31
+ import { Reducer } from '../util';
30
32
 
31
33
  export type UISchemaTester = (
32
34
  schema: JsonSchema,
package/src/store.ts CHANGED
@@ -22,12 +22,15 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
+
25
26
  import { Store } from './util';
26
- import { JsonFormsCore } from './reducers/core';
27
- import { JsonFormsCellRendererRegistryEntry } from './reducers/cells';
28
- import { JsonFormsRendererRegistryEntry } from './reducers/renderers';
29
- import { JsonFormsLocaleState } from './reducers/i18n';
30
- import { JsonFormsUISchemaRegistryEntry } from './reducers/uischemas';
27
+ import {
28
+ JsonFormsCore,
29
+ JsonFormsCellRendererRegistryEntry,
30
+ JsonFormsRendererRegistryEntry,
31
+ JsonFormsUISchemaRegistryEntry
32
+ } from './reducers';
33
+ import { JsonFormsI18nState } from './i18n';
31
34
 
32
35
  /**
33
36
  * JSONForms store.
@@ -62,11 +65,11 @@ export interface JsonFormsSubStates {
62
65
  */
63
66
  cells?: JsonFormsCellRendererRegistryEntry[];
64
67
  /**
65
- *
68
+ * I18n settings.
66
69
  */
67
- i18n?: JsonFormsLocaleState;
70
+ i18n?: JsonFormsI18nState;
68
71
  /**
69
- *
72
+ * The UI schema registry used in detail renderers.
70
73
  */
71
74
  uischemas?: JsonFormsUISchemaRegistryEntry[];
72
75
  /**