@jsonforms/core 3.0.0-alpha.1 → 3.0.0-beta.1

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 (228) hide show
  1. package/docs/assets/js/search.json +1 -1
  2. package/docs/globals.html +822 -405
  3. package/docs/index.html +69 -36
  4. package/docs/interfaces/addcellrendereraction.html +3 -3
  5. package/docs/interfaces/addrendereraction.html +3 -3
  6. package/docs/interfaces/adduischemaaction.html +3 -3
  7. package/docs/interfaces/arraycontrolprops.html +21 -21
  8. package/docs/interfaces/arraylayoutprops.html +21 -21
  9. package/docs/interfaces/cellprops.html +14 -14
  10. package/docs/interfaces/combinatorrendererprops.html +13 -13
  11. package/docs/interfaces/controlprops.html +16 -16
  12. package/docs/interfaces/controlstate.html +2 -2
  13. package/docs/interfaces/controlwithdetailprops.html +17 -17
  14. package/docs/interfaces/dispatchcellprops.html +13 -13
  15. package/docs/interfaces/dispatchcellstateprops.html +13 -13
  16. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  17. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  18. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  19. package/docs/interfaces/enumcellprops.html +15 -15
  20. package/docs/interfaces/enumoption.html +2 -2
  21. package/docs/interfaces/initaction.html +6 -6
  22. package/docs/interfaces/initactionoptions.html +3 -3
  23. package/docs/interfaces/jsonformscore.html +7 -7
  24. package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
  25. package/docs/interfaces/jsonformsprops.html +9 -9
  26. package/docs/interfaces/jsonformssubstates.html +11 -1
  27. package/docs/interfaces/layoutprops.html +10 -10
  28. package/docs/interfaces/ownpropsofcell.html +10 -10
  29. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  30. package/docs/interfaces/ownpropsofenum.html +1 -1
  31. package/docs/interfaces/ownpropsofenumcell.html +11 -11
  32. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  33. package/docs/interfaces/ownpropsoflayout.html +9 -9
  34. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  35. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  36. package/docs/interfaces/registerdefaultdataaction.html +3 -3
  37. package/docs/interfaces/removecellrendereraction.html +3 -3
  38. package/docs/interfaces/removerendereraction.html +3 -3
  39. package/docs/interfaces/removeuischemaaction.html +2 -2
  40. package/docs/interfaces/rendererprops.html +9 -9
  41. package/docs/interfaces/setajvaction.html +3 -3
  42. package/docs/interfaces/setconfigaction.html +2 -2
  43. package/docs/interfaces/setlocaleaction.html +3 -3
  44. package/docs/interfaces/setschemaaction.html +2 -2
  45. package/docs/interfaces/{setlocalizedschemasaction.html → settranslatoraction.html} +29 -15
  46. package/docs/interfaces/setuischemaaction.html +2 -2
  47. package/docs/interfaces/setvalidationmodeaction.html +2 -2
  48. package/docs/interfaces/statepropsofarraycontrol.html +17 -17
  49. package/docs/interfaces/statepropsofarraylayout.html +17 -17
  50. package/docs/interfaces/statepropsofcell.html +13 -13
  51. package/docs/interfaces/statepropsofcombinator.html +12 -12
  52. package/docs/interfaces/statepropsofcontrol.html +15 -15
  53. package/docs/interfaces/statepropsofcontrolwithdetail.html +16 -16
  54. package/docs/interfaces/statepropsofenumcell.html +14 -14
  55. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
  56. package/docs/interfaces/statepropsoflayout.html +10 -10
  57. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  58. package/docs/interfaces/statepropsofrenderer.html +9 -9
  59. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  60. package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
  61. package/docs/interfaces/updateaction.html +3 -3
  62. package/docs/interfaces/updatecoreaction.html +6 -6
  63. package/docs/interfaces/updateerrorsaction.html +2 -2
  64. package/docs/interfaces/{setlocalizeduischemasaction.html → updatei18naction.html} +43 -15
  65. package/docs/interfaces/withclassname.html +1 -1
  66. package/lib/Helpers.d.ts +5 -5
  67. package/lib/actions/actions.d.ts +181 -177
  68. package/lib/actions/index.d.ts +1 -1
  69. package/lib/configDefault.d.ts +6 -6
  70. package/lib/generators/Generate.d.ts +6 -6
  71. package/lib/generators/index.d.ts +3 -3
  72. package/lib/generators/schema.d.ts +8 -8
  73. package/lib/generators/uischema.d.ts +12 -12
  74. package/lib/i18n/i18nTypes.d.ts +15 -0
  75. package/lib/i18n/i18nUtil.d.ts +18 -0
  76. package/lib/i18n/index.d.ts +2 -0
  77. package/lib/index.d.ts +11 -10
  78. package/lib/jsonforms-core.cjs.js +2445 -0
  79. package/lib/jsonforms-core.cjs.js.map +1 -0
  80. package/lib/jsonforms-core.esm.js +2164 -0
  81. package/lib/jsonforms-core.esm.js.map +1 -0
  82. package/lib/models/draft4.d.ts +198 -198
  83. package/lib/models/index.d.ts +5 -5
  84. package/lib/models/jsonSchema.d.ts +3 -3
  85. package/lib/models/jsonSchema4.d.ts +110 -110
  86. package/lib/models/jsonSchema7.d.ts +119 -119
  87. package/lib/models/uischema.d.ts +201 -201
  88. package/lib/reducers/cells.d.ts +11 -11
  89. package/lib/reducers/config.d.ts +3 -3
  90. package/lib/reducers/core.d.ts +24 -23
  91. package/lib/reducers/default-data.d.ts +10 -10
  92. package/lib/reducers/i18n.d.ts +8 -11
  93. package/lib/reducers/index.d.ts +9 -9
  94. package/lib/reducers/reducers.d.ts +29 -36
  95. package/lib/reducers/renderers.d.ts +10 -10
  96. package/lib/reducers/selectors.d.ts +15 -15
  97. package/lib/reducers/uischemas.d.ts +10 -10
  98. package/lib/store.d.ts +53 -52
  99. package/lib/testers/index.d.ts +1 -1
  100. package/lib/testers/testers.d.ts +203 -203
  101. package/lib/util/Formatted.d.ts +19 -19
  102. package/lib/util/array.d.ts +3 -3
  103. package/lib/util/cell.d.ts +79 -79
  104. package/lib/util/combinators.d.ts +10 -10
  105. package/lib/util/ids.d.ts +3 -3
  106. package/lib/util/index.d.ts +15 -15
  107. package/lib/util/label.d.ts +9 -9
  108. package/lib/util/path.d.ts +25 -25
  109. package/lib/util/renderer.d.ts +398 -387
  110. package/lib/util/resolvers.d.ts +25 -25
  111. package/lib/util/runtime.d.ts +18 -19
  112. package/lib/util/schema.d.ts +1 -1
  113. package/lib/util/type.d.ts +174 -174
  114. package/lib/util/uischema.d.ts +5 -5
  115. package/lib/util/util.d.ts +31 -31
  116. package/lib/util/validator.d.ts +3 -2
  117. package/package.json +18 -14
  118. package/rollup.config.js +44 -0
  119. package/src/actions/actions.ts +46 -36
  120. package/src/i18n/i18nTypes.ts +17 -0
  121. package/src/i18n/i18nUtil.ts +105 -0
  122. package/src/i18n/index.ts +2 -0
  123. package/src/index.ts +1 -0
  124. package/src/reducers/core.ts +70 -48
  125. package/src/reducers/i18n.ts +41 -35
  126. package/src/reducers/reducers.ts +10 -29
  127. package/src/reducers/selectors.ts +1 -1
  128. package/src/store.ts +4 -4
  129. package/src/util/cell.ts +26 -6
  130. package/src/util/renderer.ts +127 -38
  131. package/src/util/runtime.ts +1 -1
  132. package/src/util/util.ts +1 -1
  133. package/src/util/validator.ts +5 -9
  134. package/stats.html +3279 -0
  135. package/{lib/reducers/cells.js → test/i18n/i18nUtil.test.ts} +25 -17
  136. package/test/reducers/core.test.ts +31 -44
  137. package/test/util/cell.test.ts +2 -2
  138. package/test/util/renderer.test.ts +488 -35
  139. package/lib/Helpers.js +0 -32
  140. package/lib/Helpers.js.map +0 -1
  141. package/lib/actions/actions.js +0 -149
  142. package/lib/actions/actions.js.map +0 -1
  143. package/lib/actions/index.js +0 -29
  144. package/lib/actions/index.js.map +0 -1
  145. package/lib/configDefault.js +0 -47
  146. package/lib/configDefault.js.map +0 -1
  147. package/lib/generators/Generate.js +0 -34
  148. package/lib/generators/Generate.js.map +0 -1
  149. package/lib/generators/index.js +0 -31
  150. package/lib/generators/index.js.map +0 -1
  151. package/lib/generators/schema.js +0 -152
  152. package/lib/generators/schema.js.map +0 -1
  153. package/lib/generators/uischema.js +0 -166
  154. package/lib/generators/uischema.js.map +0 -1
  155. package/lib/index.js +0 -37
  156. package/lib/index.js.map +0 -1
  157. package/lib/jsonforms-core.js +0 -19
  158. package/lib/jsonforms-core.js.map +0 -1
  159. package/lib/models/draft4.js +0 -173
  160. package/lib/models/draft4.js.map +0 -1
  161. package/lib/models/index.js +0 -30
  162. package/lib/models/index.js.map +0 -1
  163. package/lib/models/jsonSchema.js +0 -27
  164. package/lib/models/jsonSchema.js.map +0 -1
  165. package/lib/models/jsonSchema4.js +0 -30
  166. package/lib/models/jsonSchema4.js.map +0 -1
  167. package/lib/models/jsonSchema7.js +0 -30
  168. package/lib/models/jsonSchema7.js.map +0 -1
  169. package/lib/models/uischema.js +0 -55
  170. package/lib/models/uischema.js.map +0 -1
  171. package/lib/reducers/cells.js.map +0 -1
  172. package/lib/reducers/config.js +0 -44
  173. package/lib/reducers/config.js.map +0 -1
  174. package/lib/reducers/core.js +0 -259
  175. package/lib/reducers/core.js.map +0 -1
  176. package/lib/reducers/default-data.js +0 -42
  177. package/lib/reducers/default-data.js.map +0 -1
  178. package/lib/reducers/i18n.js +0 -65
  179. package/lib/reducers/i18n.js.map +0 -1
  180. package/lib/reducers/index.js +0 -37
  181. package/lib/reducers/index.js.map +0 -1
  182. package/lib/reducers/reducers.js +0 -99
  183. package/lib/reducers/reducers.js.map +0 -1
  184. package/lib/reducers/renderers.js +0 -41
  185. package/lib/reducers/renderers.js.map +0 -1
  186. package/lib/reducers/selectors.js +0 -47
  187. package/lib/reducers/selectors.js.map +0 -1
  188. package/lib/reducers/uischemas.js +0 -57
  189. package/lib/reducers/uischemas.js.map +0 -1
  190. package/lib/store.js +0 -27
  191. package/lib/store.js.map +0 -1
  192. package/lib/testers/index.js +0 -29
  193. package/lib/testers/index.js.map +0 -1
  194. package/lib/testers/testers.js +0 -401
  195. package/lib/testers/testers.js.map +0 -1
  196. package/lib/util/Formatted.js +0 -27
  197. package/lib/util/Formatted.js.map +0 -1
  198. package/lib/util/array.js +0 -43
  199. package/lib/util/array.js.map +0 -1
  200. package/lib/util/cell.js +0 -133
  201. package/lib/util/cell.js.map +0 -1
  202. package/lib/util/combinators.js +0 -56
  203. package/lib/util/combinators.js.map +0 -1
  204. package/lib/util/ids.js +0 -50
  205. package/lib/util/ids.js.map +0 -1
  206. package/lib/util/index.js +0 -41
  207. package/lib/util/index.js.map +0 -1
  208. package/lib/util/label.js +0 -70
  209. package/lib/util/label.js.map +0 -1
  210. package/lib/util/path.js +0 -85
  211. package/lib/util/path.js.map +0 -1
  212. package/lib/util/renderer.js +0 -451
  213. package/lib/util/renderer.js.map +0 -1
  214. package/lib/util/resolvers.js +0 -165
  215. package/lib/util/resolvers.js.map +0 -1
  216. package/lib/util/runtime.js +0 -159
  217. package/lib/util/runtime.js.map +0 -1
  218. package/lib/util/schema.js +0 -40
  219. package/lib/util/schema.js.map +0 -1
  220. package/lib/util/type.js +0 -27
  221. package/lib/util/type.js.map +0 -1
  222. package/lib/util/uischema.js +0 -52
  223. package/lib/util/uischema.js.map +0 -1
  224. package/lib/util/util.js +0 -107
  225. package/lib/util/util.js.map +0 -1
  226. package/lib/util/validator.js +0 -36
  227. package/lib/util/validator.js.map +0 -1
  228. package/webpack.build.js +0 -13
@@ -0,0 +1,2445 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isEmpty = require('lodash/isEmpty');
6
+ var startCase = require('lodash/startCase');
7
+ var keys = require('lodash/keys');
8
+ var union = require('lodash/union');
9
+ var merge = require('lodash/merge');
10
+ var cloneDeep = require('lodash/cloneDeep');
11
+ var setFp = require('lodash/fp/set');
12
+ var get = require('lodash/get');
13
+ var filter = require('lodash/filter');
14
+ var isEqual = require('lodash/isEqual');
15
+ var isFunction = require('lodash/isFunction');
16
+ var maxBy = require('lodash/maxBy');
17
+ var remove = require('lodash/remove');
18
+ var endsWith = require('lodash/endsWith');
19
+ var last = require('lodash/last');
20
+ var isArray = require('lodash/isArray');
21
+ var reduce = require('lodash/reduce');
22
+ var toPairs = require('lodash/toPairs');
23
+ var includes = require('lodash/includes');
24
+ var find = require('lodash/find');
25
+ var range = require('lodash/range');
26
+ var has = require('lodash/has');
27
+ var Ajv = require('ajv');
28
+ var addFormats = require('ajv-formats');
29
+
30
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
31
+
32
+ var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
33
+ var startCase__default = /*#__PURE__*/_interopDefaultLegacy(startCase);
34
+ var keys__default = /*#__PURE__*/_interopDefaultLegacy(keys);
35
+ var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
36
+ var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
37
+ var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
38
+ var setFp__default = /*#__PURE__*/_interopDefaultLegacy(setFp);
39
+ var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
40
+ var filter__default = /*#__PURE__*/_interopDefaultLegacy(filter);
41
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
42
+ var isFunction__default = /*#__PURE__*/_interopDefaultLegacy(isFunction);
43
+ var maxBy__default = /*#__PURE__*/_interopDefaultLegacy(maxBy);
44
+ var remove__default = /*#__PURE__*/_interopDefaultLegacy(remove);
45
+ var endsWith__default = /*#__PURE__*/_interopDefaultLegacy(endsWith);
46
+ var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
47
+ var isArray__default = /*#__PURE__*/_interopDefaultLegacy(isArray);
48
+ var reduce__default = /*#__PURE__*/_interopDefaultLegacy(reduce);
49
+ var toPairs__default = /*#__PURE__*/_interopDefaultLegacy(toPairs);
50
+ var includes__default = /*#__PURE__*/_interopDefaultLegacy(includes);
51
+ var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
52
+ var range__default = /*#__PURE__*/_interopDefaultLegacy(range);
53
+ var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
54
+ var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv);
55
+ var addFormats__default = /*#__PURE__*/_interopDefaultLegacy(addFormats);
56
+
57
+ var ADDITIONAL_PROPERTIES = 'additionalProperties';
58
+ var REQUIRED_PROPERTIES = 'required';
59
+ var distinct = function (properties, discriminator) {
60
+ var known = {};
61
+ return properties.filter(function (item) {
62
+ var discriminatorValue = discriminator(item);
63
+ if (known.hasOwnProperty(discriminatorValue)) {
64
+ return false;
65
+ }
66
+ else {
67
+ known[discriminatorValue] = true;
68
+ return true;
69
+ }
70
+ });
71
+ };
72
+ var Gen = (function () {
73
+ function Gen(findOption) {
74
+ var _this = this;
75
+ this.findOption = findOption;
76
+ this.schemaObject = function (data) {
77
+ var props = _this.properties(data);
78
+ var schema = {
79
+ type: 'object',
80
+ properties: props,
81
+ additionalProperties: _this.findOption(props)(ADDITIONAL_PROPERTIES)
82
+ };
83
+ var required = _this.findOption(props)(REQUIRED_PROPERTIES);
84
+ if (required.length > 0) {
85
+ schema.required = required;
86
+ }
87
+ return schema;
88
+ };
89
+ this.properties = function (data) {
90
+ var emptyProps = {};
91
+ return Object.keys(data).reduce(function (acc, propName) {
92
+ acc[propName] = _this.property(data[propName]);
93
+ return acc;
94
+ }, emptyProps);
95
+ };
96
+ this.property = function (data) {
97
+ switch (typeof data) {
98
+ case 'string':
99
+ return { type: 'string' };
100
+ case 'boolean':
101
+ return { type: 'boolean' };
102
+ case 'number':
103
+ if (Number.isInteger(data)) {
104
+ return { type: 'integer' };
105
+ }
106
+ return { type: 'number' };
107
+ case 'object':
108
+ if (data == null) {
109
+ return { type: 'null' };
110
+ }
111
+ return _this.schemaObjectOrArray(data);
112
+ default:
113
+ return {};
114
+ }
115
+ };
116
+ this.schemaObjectOrArray = function (data) {
117
+ if (data instanceof Array) {
118
+ return _this.schemaArray(data);
119
+ }
120
+ else {
121
+ return _this.schemaObject(data);
122
+ }
123
+ };
124
+ this.schemaArray = function (data) {
125
+ if (data.length > 0) {
126
+ var allProperties = data.map(_this.property);
127
+ var uniqueProperties = distinct(allProperties, function (prop) {
128
+ return JSON.stringify(prop);
129
+ });
130
+ if (uniqueProperties.length === 1) {
131
+ return {
132
+ type: 'array',
133
+ items: uniqueProperties[0]
134
+ };
135
+ }
136
+ else {
137
+ return {
138
+ type: 'array',
139
+ items: {
140
+ oneOf: uniqueProperties
141
+ }
142
+ };
143
+ }
144
+ }
145
+ else {
146
+ return {
147
+ type: 'array',
148
+ items: {}
149
+ };
150
+ }
151
+ };
152
+ }
153
+ return Gen;
154
+ }());
155
+ var generateJsonSchema = function (instance, options) {
156
+ if (options === void 0) { options = {}; }
157
+ var findOption = function (props) { return function (optionName) {
158
+ switch (optionName) {
159
+ case ADDITIONAL_PROPERTIES:
160
+ if (options.hasOwnProperty(ADDITIONAL_PROPERTIES)) {
161
+ return options[ADDITIONAL_PROPERTIES];
162
+ }
163
+ return true;
164
+ case REQUIRED_PROPERTIES:
165
+ if (options.hasOwnProperty(REQUIRED_PROPERTIES)) {
166
+ return options[REQUIRED_PROPERTIES](props);
167
+ }
168
+ return Object.keys(props);
169
+ default:
170
+ return;
171
+ }
172
+ }; };
173
+ var gen = new Gen(findOption);
174
+ return gen.schemaObject(instance);
175
+ };
176
+
177
+ var Draft4 = {
178
+ id: 'http://json-schema.org/draft-04/schema#',
179
+ $schema: 'http://json-schema.org/draft-04/schema#',
180
+ description: 'Core schema meta-schema',
181
+ definitions: {
182
+ schemaArray: {
183
+ type: 'array',
184
+ minItems: 1,
185
+ items: { $ref: '#' }
186
+ },
187
+ positiveInteger: {
188
+ type: 'integer',
189
+ minimum: 0
190
+ },
191
+ positiveIntegerDefault0: {
192
+ allOf: [{ $ref: '#/definitions/positiveInteger' }, { default: 0 }]
193
+ },
194
+ simpleTypes: {
195
+ enum: [
196
+ 'array',
197
+ 'boolean',
198
+ 'integer',
199
+ 'null',
200
+ 'number',
201
+ 'object',
202
+ 'string'
203
+ ]
204
+ },
205
+ stringArray: {
206
+ type: 'array',
207
+ items: { type: 'string' },
208
+ minItems: 1,
209
+ uniqueItems: true
210
+ }
211
+ },
212
+ type: 'object',
213
+ properties: {
214
+ id: {
215
+ type: 'string',
216
+ format: 'uri'
217
+ },
218
+ $schema: {
219
+ type: 'string',
220
+ format: 'uri'
221
+ },
222
+ title: {
223
+ type: 'string'
224
+ },
225
+ description: {
226
+ type: 'string'
227
+ },
228
+ default: {},
229
+ multipleOf: {
230
+ type: 'number',
231
+ minimum: 0,
232
+ exclusiveMinimum: true
233
+ },
234
+ maximum: {
235
+ type: 'number'
236
+ },
237
+ exclusiveMaximum: {
238
+ type: 'boolean',
239
+ default: false
240
+ },
241
+ minimum: {
242
+ type: 'number'
243
+ },
244
+ exclusiveMinimum: {
245
+ type: 'boolean',
246
+ default: false
247
+ },
248
+ maxLength: { $ref: '#/definitions/positiveInteger' },
249
+ minLength: { $ref: '#/definitions/positiveIntegerDefault0' },
250
+ pattern: {
251
+ type: 'string',
252
+ format: 'regex'
253
+ },
254
+ additionalItems: {
255
+ anyOf: [{ type: 'boolean' }, { $ref: '#' }],
256
+ default: {}
257
+ },
258
+ items: {
259
+ anyOf: [{ $ref: '#' }, { $ref: '#/definitions/schemaArray' }],
260
+ default: {}
261
+ },
262
+ maxItems: { $ref: '#/definitions/positiveInteger' },
263
+ minItems: { $ref: '#/definitions/positiveIntegerDefault0' },
264
+ uniqueItems: {
265
+ type: 'boolean',
266
+ default: false
267
+ },
268
+ maxProperties: { $ref: '#/definitions/positiveInteger' },
269
+ minProperties: { $ref: '#/definitions/positiveIntegerDefault0' },
270
+ required: { $ref: '#/definitions/stringArray' },
271
+ additionalProperties: {
272
+ anyOf: [{ type: 'boolean' }, { $ref: '#' }],
273
+ default: {}
274
+ },
275
+ definitions: {
276
+ type: 'object',
277
+ additionalProperties: { $ref: '#' },
278
+ default: {}
279
+ },
280
+ properties: {
281
+ type: 'object',
282
+ additionalProperties: { $ref: '#' },
283
+ default: {}
284
+ },
285
+ patternProperties: {
286
+ type: 'object',
287
+ additionalProperties: { $ref: '#' },
288
+ default: {}
289
+ },
290
+ dependencies: {
291
+ type: 'object',
292
+ additionalProperties: {
293
+ anyOf: [{ $ref: '#' }, { $ref: '#/definitions/stringArray' }]
294
+ }
295
+ },
296
+ enum: {
297
+ type: 'array',
298
+ minItems: 1,
299
+ uniqueItems: true
300
+ },
301
+ type: {
302
+ anyOf: [
303
+ { $ref: '#/definitions/simpleTypes' },
304
+ {
305
+ type: 'array',
306
+ items: { $ref: '#/definitions/simpleTypes' },
307
+ minItems: 1,
308
+ uniqueItems: true
309
+ }
310
+ ]
311
+ },
312
+ allOf: { $ref: '#/definitions/schemaArray' },
313
+ anyOf: { $ref: '#/definitions/schemaArray' },
314
+ oneOf: { $ref: '#/definitions/schemaArray' },
315
+ not: { $ref: '#' }
316
+ },
317
+ dependencies: {
318
+ exclusiveMaximum: ['maximum'],
319
+ exclusiveMinimum: ['minimum']
320
+ },
321
+ default: {}
322
+ };
323
+
324
+ exports.RuleEffect = void 0;
325
+ (function (RuleEffect) {
326
+ RuleEffect["HIDE"] = "HIDE";
327
+ RuleEffect["SHOW"] = "SHOW";
328
+ RuleEffect["ENABLE"] = "ENABLE";
329
+ RuleEffect["DISABLE"] = "DISABLE";
330
+ })(exports.RuleEffect || (exports.RuleEffect = {}));
331
+ var isGroup = function (layout) {
332
+ return layout.type === 'Group';
333
+ };
334
+ var isLayout = function (uischema) {
335
+ return uischema.elements !== undefined;
336
+ };
337
+
338
+ var move = function (array, index, delta) {
339
+ var newIndex = index + delta;
340
+ if (newIndex < 0 || newIndex >= array.length) {
341
+ return;
342
+ }
343
+ var indexes = [index, newIndex].sort(function (a, b) { return a - b; });
344
+ array.splice(indexes[0], 2, array[indexes[1]], array[indexes[0]]);
345
+ };
346
+ var moveUp = function (array, toMove) {
347
+ move(array, toMove, -1);
348
+ };
349
+ var moveDown = function (array, toMove) {
350
+ move(array, toMove, 1);
351
+ };
352
+
353
+ /*! *****************************************************************************
354
+ Copyright (c) Microsoft Corporation.
355
+
356
+ Permission to use, copy, modify, and/or distribute this software for any
357
+ purpose with or without fee is hereby granted.
358
+
359
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
360
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
361
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
362
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
363
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
364
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
365
+ PERFORMANCE OF THIS SOFTWARE.
366
+ ***************************************************************************** */
367
+
368
+ var __assign = function() {
369
+ __assign = Object.assign || function __assign(t) {
370
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
371
+ s = arguments[i];
372
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
373
+ }
374
+ return t;
375
+ };
376
+ return __assign.apply(this, arguments);
377
+ };
378
+
379
+ function __rest(s, e) {
380
+ var t = {};
381
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
382
+ t[p] = s[p];
383
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
384
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
385
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
386
+ t[p[i]] = s[p[i]];
387
+ }
388
+ return t;
389
+ }
390
+
391
+ var cellReducer = function (state, _a) {
392
+ if (state === void 0) { state = []; }
393
+ var type = _a.type, tester = _a.tester, cell = _a.cell;
394
+ switch (type) {
395
+ case ADD_CELL:
396
+ return state.concat([{ tester: tester, cell: cell }]);
397
+ case REMOVE_CELL:
398
+ return state.filter(function (t) { return t.tester !== tester; });
399
+ default:
400
+ return state;
401
+ }
402
+ };
403
+
404
+ var configDefault = {
405
+ restrict: false,
406
+ trim: false,
407
+ showUnfocusedDescription: false,
408
+ hideRequiredAsterisk: false
409
+ };
410
+
411
+ var applyDefaultConfiguration = function (config) {
412
+ if (config === void 0) { config = {}; }
413
+ return merge__default["default"]({}, configDefault, config);
414
+ };
415
+ var configReducer = function (state, action) {
416
+ if (state === void 0) { state = applyDefaultConfiguration(); }
417
+ switch (action.type) {
418
+ case SET_CONFIG:
419
+ return applyDefaultConfiguration(action.config);
420
+ default:
421
+ return state;
422
+ }
423
+ };
424
+
425
+ var validate = function (validator, data) {
426
+ if (validator === undefined) {
427
+ return [];
428
+ }
429
+ var valid = validator(data);
430
+ if (valid) {
431
+ return [];
432
+ }
433
+ return validator.errors;
434
+ };
435
+ var initState = {
436
+ data: {},
437
+ schema: {},
438
+ uischema: undefined,
439
+ errors: [],
440
+ validator: undefined,
441
+ ajv: undefined,
442
+ validationMode: 'ValidateAndShow',
443
+ };
444
+ var reuseAjvForSchema = function (ajv, schema) {
445
+ if (schema.hasOwnProperty('id') || schema.hasOwnProperty('$id')) {
446
+ ajv.removeSchema(schema);
447
+ }
448
+ return ajv;
449
+ };
450
+ var getOrCreateAjv = function (state, action) {
451
+ if (action) {
452
+ if (hasAjvOption(action.options)) {
453
+ return action.options.ajv;
454
+ }
455
+ else if (action.options !== undefined) {
456
+ if (isFunction__default["default"](action.options.compile)) {
457
+ return action.options;
458
+ }
459
+ }
460
+ }
461
+ if (state.ajv) {
462
+ return (action === null || action === void 0 ? void 0 : action.schema)
463
+ ? reuseAjvForSchema(state.ajv, action.schema)
464
+ : state.ajv;
465
+ }
466
+ return createAjv();
467
+ };
468
+ var hasAjvOption = function (option) {
469
+ if (option) {
470
+ return option.ajv !== undefined;
471
+ }
472
+ return false;
473
+ };
474
+ var getValidationMode = function (state, action) {
475
+ if (action && hasValidationModeOption(action.options)) {
476
+ return action.options.validationMode;
477
+ }
478
+ return state.validationMode;
479
+ };
480
+ var hasValidationModeOption = function (option) {
481
+ if (option) {
482
+ return option.validationMode !== undefined;
483
+ }
484
+ return false;
485
+ };
486
+ var coreReducer = function (state, action) {
487
+ if (state === void 0) { state = initState; }
488
+ switch (action.type) {
489
+ case INIT: {
490
+ var thisAjv = getOrCreateAjv(state, action);
491
+ var validationMode = getValidationMode(state, action);
492
+ var v = validationMode === 'NoValidation' ? undefined : thisAjv.compile(action.schema);
493
+ var e = validate(v, action.data);
494
+ return __assign(__assign({}, state), { data: action.data, schema: action.schema, uischema: action.uischema, errors: e, validator: v, ajv: thisAjv, validationMode: validationMode });
495
+ }
496
+ case UPDATE_CORE: {
497
+ var thisAjv = getOrCreateAjv(state, action);
498
+ var validationMode = getValidationMode(state, action);
499
+ var validator = state.validator;
500
+ var errors = state.errors;
501
+ if (state.schema !== action.schema ||
502
+ state.validationMode !== validationMode ||
503
+ state.ajv !== thisAjv) {
504
+ validator =
505
+ validationMode === 'NoValidation'
506
+ ? undefined
507
+ : thisAjv.compile(action.schema);
508
+ errors = validate(validator, action.data);
509
+ }
510
+ else if (state.data !== action.data) {
511
+ errors = validate(validator, action.data);
512
+ }
513
+ var stateChanged = state.data !== action.data ||
514
+ state.schema !== action.schema ||
515
+ state.uischema !== action.uischema ||
516
+ state.ajv !== thisAjv ||
517
+ state.errors !== errors ||
518
+ state.validator !== validator ||
519
+ state.validationMode !== validationMode;
520
+ return stateChanged
521
+ ? __assign(__assign({}, state), { data: action.data, schema: action.schema, uischema: action.uischema, ajv: thisAjv, errors: isEqual__default["default"](errors, state.errors) ? state.errors : errors, validator: validator, validationMode: validationMode }) : state;
522
+ }
523
+ case SET_AJV: {
524
+ var currentAjv = action.ajv;
525
+ var validator = state.validationMode === 'NoValidation' ? undefined : currentAjv.compile(state.schema);
526
+ var errors = validate(validator, state.data);
527
+ return __assign(__assign({}, state), { validator: validator,
528
+ errors: errors });
529
+ }
530
+ case SET_SCHEMA: {
531
+ var needsNewValidator = action.schema && state.ajv && state.validationMode !== 'NoValidation';
532
+ var v = needsNewValidator
533
+ ? reuseAjvForSchema(state.ajv, action.schema).compile(action.schema)
534
+ : state.validator;
535
+ var errors = validate(v, state.data);
536
+ return __assign(__assign({}, state), { validator: v, schema: action.schema, errors: errors });
537
+ }
538
+ case SET_UISCHEMA: {
539
+ return __assign(__assign({}, state), { uischema: action.uischema });
540
+ }
541
+ case UPDATE_DATA: {
542
+ if (action.path === undefined || action.path === null) {
543
+ return state;
544
+ }
545
+ else if (action.path === '') {
546
+ var result = action.updater(cloneDeep__default["default"](state.data));
547
+ var errors = validate(state.validator, result);
548
+ return __assign(__assign({}, state), { data: result, errors: errors });
549
+ }
550
+ else {
551
+ var oldData = get__default["default"](state.data, action.path);
552
+ var newData = action.updater(cloneDeep__default["default"](oldData));
553
+ var newState = setFp__default["default"](action.path, newData, state.data === undefined ? {} : state.data);
554
+ var errors = validate(state.validator, newState);
555
+ return __assign(__assign({}, state), { data: newState, errors: errors });
556
+ }
557
+ }
558
+ case UPDATE_ERRORS: {
559
+ return __assign(__assign({}, state), { errors: action.errors });
560
+ }
561
+ case SET_VALIDATION_MODE: {
562
+ if (state.validationMode === action.validationMode) {
563
+ return state;
564
+ }
565
+ if (action.validationMode === 'NoValidation') {
566
+ var errors = validate(undefined, state.data);
567
+ return __assign(__assign({}, state), { errors: errors, validationMode: action.validationMode });
568
+ }
569
+ if (state.validationMode === 'NoValidation') {
570
+ var validator = reuseAjvForSchema(state.ajv, state.schema).compile(state.schema);
571
+ var errors = validate(validator, state.data);
572
+ return __assign(__assign({}, state), { validator: validator,
573
+ errors: errors, validationMode: action.validationMode });
574
+ }
575
+ return __assign(__assign({}, state), { validationMode: action.validationMode });
576
+ }
577
+ default:
578
+ return state;
579
+ }
580
+ };
581
+ var extractData = function (state) { return get__default["default"](state, 'data'); };
582
+ var extractSchema = function (state) { return get__default["default"](state, 'schema'); };
583
+ var extractUiSchema = function (state) { return get__default["default"](state, 'uischema'); };
584
+ var extractAjv = function (state) { return get__default["default"](state, 'ajv'); };
585
+ var getInvalidProperty = function (error) {
586
+ switch (error.keyword) {
587
+ case 'required':
588
+ case 'dependencies':
589
+ return error.params.missingProperty;
590
+ case 'additionalProperties':
591
+ return error.params.additionalProperty;
592
+ default:
593
+ return undefined;
594
+ }
595
+ };
596
+ var getControlPath = function (error) {
597
+ var dataPath = error.dataPath;
598
+ if (dataPath) {
599
+ return dataPath.replace(/\//g, '.').substr(1);
600
+ }
601
+ var controlPath = error.instancePath;
602
+ controlPath = controlPath.replace(/\//g, '.');
603
+ var invalidProperty = getInvalidProperty(error);
604
+ if (invalidProperty !== undefined && !controlPath.endsWith(invalidProperty)) {
605
+ controlPath = controlPath + "." + invalidProperty;
606
+ }
607
+ controlPath = controlPath.replace(/^./, '');
608
+ return controlPath;
609
+ };
610
+ var errorsAt = function (instancePath, schema, matchPath) { return function (errors) {
611
+ var combinatorPaths = filter__default["default"](errors, function (error) { return error.keyword === 'oneOf' || error.keyword === 'anyOf'; }).map(function (error) { return getControlPath(error); });
612
+ return filter__default["default"](errors, function (error) {
613
+ if (filteredErrorKeywords.indexOf(error.keyword) !== -1) {
614
+ return false;
615
+ }
616
+ var controlPath = getControlPath(error);
617
+ var result = matchPath(controlPath);
618
+ var parentSchema = error.parentSchema;
619
+ if (result && !isObjectSchema$1(parentSchema)
620
+ && combinatorPaths.findIndex(function (p) { return instancePath.startsWith(p); }) !== -1) {
621
+ result = result && isEqual__default["default"](parentSchema, schema);
622
+ }
623
+ return result;
624
+ });
625
+ }; };
626
+ var isObjectSchema$1 = function (schema) {
627
+ return (schema === null || schema === void 0 ? void 0 : schema.type) === 'object' || !!(schema === null || schema === void 0 ? void 0 : schema.properties);
628
+ };
629
+ var filteredErrorKeywords = ['additionalProperties', 'allOf', 'anyOf', 'oneOf'];
630
+ var getErrorsAt = function (instancePath, schema, matchPath) { return function (state) {
631
+ return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide' ? [] : state.errors);
632
+ }; };
633
+ var errorAt = function (instancePath, schema) {
634
+ return getErrorsAt(instancePath, schema, function (path) { return path === instancePath; });
635
+ };
636
+ var subErrorsAt = function (instancePath, schema) {
637
+ return getErrorsAt(instancePath, schema, function (path) { return path.startsWith(instancePath); });
638
+ };
639
+
640
+ var defaultDataReducer = function (state, action) {
641
+ if (state === void 0) { state = []; }
642
+ switch (action.type) {
643
+ case ADD_DEFAULT_DATA:
644
+ return state.concat([
645
+ { schemaPath: action.schemaPath, data: action.data }
646
+ ]);
647
+ case REMOVE_DEFAULT_DATA:
648
+ return state.filter(function (t) { return t.schemaPath !== action.schemaPath; });
649
+ default:
650
+ return state;
651
+ }
652
+ };
653
+ var extractDefaultData = function (state) { return state; };
654
+
655
+ var getI18nKeyPrefixBySchema = function (schema, uischema) {
656
+ var _a, _b, _c;
657
+ return (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.i18n) !== null && _b !== void 0 ? _b : schema === null || schema === void 0 ? void 0 : schema.i18n) !== null && _c !== void 0 ? _c : undefined;
658
+ };
659
+ var transformPathToI18nPrefix = function (path) {
660
+ return ((path === null || path === void 0 ? void 0 : path.split('.').filter(function (segment) { return !/^\d+$/.test(segment); }).join('.')) || 'root');
661
+ };
662
+ var getI18nKeyPrefix = function (schema, uischema, path) {
663
+ var _a;
664
+ return ((_a = getI18nKeyPrefixBySchema(schema, uischema)) !== null && _a !== void 0 ? _a : transformPathToI18nPrefix(path));
665
+ };
666
+ var getI18nKey = function (schema, uischema, path, key) {
667
+ return getI18nKeyPrefix(schema, uischema, path) + "." + key;
668
+ };
669
+ var defaultTranslator = function (_id, defaultMessage) { return defaultMessage; };
670
+ var defaultErrorTranslator = function (error, t, uischema) {
671
+ var _a;
672
+ var i18nKey = getI18nKey(error.parentSchema, uischema, getControlPath(error), "error." + error.keyword);
673
+ var specializedKeywordMessage = t(i18nKey, undefined);
674
+ if (specializedKeywordMessage !== undefined) {
675
+ return specializedKeywordMessage;
676
+ }
677
+ var genericKeywordMessage = t("error." + error.keyword, undefined);
678
+ if (genericKeywordMessage !== undefined) {
679
+ return genericKeywordMessage;
680
+ }
681
+ var messageCustomization = t(error.message, undefined);
682
+ if (messageCustomization !== undefined) {
683
+ return messageCustomization;
684
+ }
685
+ if (error.keyword === 'required' && ((_a = error.message) === null || _a === void 0 ? void 0 : _a.startsWith('must have required property'))) {
686
+ return t('is a required property', 'is a required property');
687
+ }
688
+ return error.message;
689
+ };
690
+ var getCombinedErrorMessage = function (errors, et, t, schema, uischema, path) {
691
+ if (errors.length > 0 && t) {
692
+ var customErrorKey = getI18nKey(schema, uischema, path, 'error.custom');
693
+ var specializedErrorMessage = t(customErrorKey, undefined);
694
+ if (specializedErrorMessage !== undefined) {
695
+ return specializedErrorMessage;
696
+ }
697
+ }
698
+ return formatErrorMessage(errors.map(function (error) { return et(error, t, uischema); }));
699
+ };
700
+
701
+ var defaultJsonFormsI18nState = {
702
+ locale: 'en',
703
+ translate: defaultTranslator,
704
+ translateError: defaultErrorTranslator
705
+ };
706
+ var i18nReducer = function (state, action) {
707
+ var _a, _b, _c, _d, _e, _f;
708
+ if (state === void 0) { state = defaultJsonFormsI18nState; }
709
+ switch (action.type) {
710
+ case UPDATE_I18N: {
711
+ var locale = (_a = action.locale) !== null && _a !== void 0 ? _a : defaultJsonFormsI18nState.locale;
712
+ var translate = (_b = action.translator) !== null && _b !== void 0 ? _b : defaultJsonFormsI18nState.translate;
713
+ var translateError = (_c = action.errorTranslator) !== null && _c !== void 0 ? _c : defaultJsonFormsI18nState.translateError;
714
+ if (locale !== state.locale ||
715
+ translate !== state.translate ||
716
+ translateError !== state.translateError) {
717
+ return __assign(__assign({}, state), { locale: locale,
718
+ translate: translate,
719
+ translateError: translateError });
720
+ }
721
+ return state;
722
+ }
723
+ case SET_TRANSLATOR:
724
+ return __assign(__assign({}, state), { translate: (_d = action.translator) !== null && _d !== void 0 ? _d : defaultTranslator, translateError: (_e = action.errorTranslator) !== null && _e !== void 0 ? _e : defaultErrorTranslator });
725
+ case SET_LOCALE:
726
+ return __assign(__assign({}, state), { locale: (_f = action.locale) !== null && _f !== void 0 ? _f : navigator.languages[0] });
727
+ default:
728
+ return state;
729
+ }
730
+ };
731
+ var fetchLocale = function (state) {
732
+ if (state === undefined) {
733
+ return undefined;
734
+ }
735
+ return state.locale;
736
+ };
737
+ var fetchTranslator = function (state) {
738
+ if (state === undefined) {
739
+ return defaultTranslator;
740
+ }
741
+ return state.translate;
742
+ };
743
+ var fetchErrorTranslator = function (state) {
744
+ if (state === undefined) {
745
+ return defaultErrorTranslator;
746
+ }
747
+ return state.translateError;
748
+ };
749
+
750
+ var rendererReducer = function (state, action) {
751
+ if (state === void 0) { state = []; }
752
+ switch (action.type) {
753
+ case ADD_RENDERER:
754
+ return state.concat([
755
+ { tester: action.tester, renderer: action.renderer }
756
+ ]);
757
+ case REMOVE_RENDERER:
758
+ return state.filter(function (t) { return t.tester !== action.tester; });
759
+ default:
760
+ return state;
761
+ }
762
+ };
763
+
764
+ var NOT_APPLICABLE = -1;
765
+ var isControl = function (uischema) {
766
+ return !isEmpty__default["default"](uischema) && uischema.scope !== undefined;
767
+ };
768
+ var schemaMatches = function (predicate) { return function (uischema, schema) {
769
+ if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
770
+ return false;
771
+ }
772
+ if (isEmpty__default["default"](schema)) {
773
+ return false;
774
+ }
775
+ var schemaPath = uischema.scope;
776
+ if (isEmpty__default["default"](schemaPath)) {
777
+ return false;
778
+ }
779
+ var currentDataSchema = schema;
780
+ if (hasType(schema, 'object')) {
781
+ currentDataSchema = resolveSchema(schema, schemaPath);
782
+ }
783
+ if (currentDataSchema === undefined) {
784
+ return false;
785
+ }
786
+ return predicate(currentDataSchema);
787
+ }; };
788
+ var schemaSubPathMatches = function (subPath, predicate) { return function (uischema, schema) {
789
+ if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
790
+ return false;
791
+ }
792
+ var schemaPath = uischema.scope;
793
+ var currentDataSchema = schema;
794
+ if (hasType(schema, 'object')) {
795
+ currentDataSchema = resolveSchema(schema, schemaPath);
796
+ }
797
+ currentDataSchema = get__default["default"](currentDataSchema, subPath);
798
+ if (currentDataSchema === undefined) {
799
+ return false;
800
+ }
801
+ return predicate(currentDataSchema);
802
+ }; };
803
+ var schemaTypeIs = function (expectedType) {
804
+ return schemaMatches(function (schema) { return !isEmpty__default["default"](schema) && hasType(schema, expectedType); });
805
+ };
806
+ var formatIs = function (expectedFormat) {
807
+ return schemaMatches(function (schema) {
808
+ return !isEmpty__default["default"](schema) &&
809
+ schema.format === expectedFormat &&
810
+ schema.type === 'string';
811
+ });
812
+ };
813
+ var uiTypeIs = function (expected) { return function (uischema) { return !isEmpty__default["default"](uischema) && uischema.type === expected; }; };
814
+ var optionIs = function (optionName, optionValue) { return function (uischema) {
815
+ if (isEmpty__default["default"](uischema)) {
816
+ return false;
817
+ }
818
+ var options = uischema.options;
819
+ return !isEmpty__default["default"](options) && options[optionName] === optionValue;
820
+ }; };
821
+ var scopeEndsWith = function (expected) { return function (uischema) {
822
+ if (isEmpty__default["default"](expected) || !isControl(uischema)) {
823
+ return false;
824
+ }
825
+ return endsWith__default["default"](uischema.scope, expected);
826
+ }; };
827
+ var scopeEndIs = function (expected) { return function (uischema) {
828
+ if (isEmpty__default["default"](expected) || !isControl(uischema)) {
829
+ return false;
830
+ }
831
+ var schemaPath = uischema.scope;
832
+ return !isEmpty__default["default"](schemaPath) && last__default["default"](schemaPath.split('/')) === expected;
833
+ }; };
834
+ var and = function () {
835
+ var testers = [];
836
+ for (var _i = 0; _i < arguments.length; _i++) {
837
+ testers[_i] = arguments[_i];
838
+ }
839
+ return function (uischema, schema) { return testers.reduce(function (acc, tester) { return acc && tester(uischema, schema); }, true); };
840
+ };
841
+ var or = function () {
842
+ var testers = [];
843
+ for (var _i = 0; _i < arguments.length; _i++) {
844
+ testers[_i] = arguments[_i];
845
+ }
846
+ return function (uischema, schema) { return testers.reduce(function (acc, tester) { return acc || tester(uischema, schema); }, false); };
847
+ };
848
+ var rankWith = function (rank, tester) { return function (uischema, schema) {
849
+ if (tester(uischema, schema)) {
850
+ return rank;
851
+ }
852
+ return NOT_APPLICABLE;
853
+ }; };
854
+ var withIncreasedRank = function (by, rankedTester) { return function (uischema, schema) {
855
+ var rank = rankedTester(uischema, schema);
856
+ if (rank === NOT_APPLICABLE) {
857
+ return NOT_APPLICABLE;
858
+ }
859
+ return rank + by;
860
+ }; };
861
+ var isBooleanControl = and(uiTypeIs('Control'), schemaTypeIs('boolean'));
862
+ var isObjectControl = and(uiTypeIs('Control'), schemaTypeIs('object'));
863
+ var isAllOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('allOf'); }));
864
+ var isAnyOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('anyOf'); }));
865
+ var isOneOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('oneOf'); }));
866
+ var isEnumControl = and(uiTypeIs('Control'), or(schemaMatches(function (schema) { return schema.hasOwnProperty('enum'); }), schemaMatches(function (schema) { return schema.hasOwnProperty('const'); })));
867
+ var isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
868
+ return schema.hasOwnProperty('oneOf') &&
869
+ schema.oneOf.every(function (s) { return s.const !== undefined; });
870
+ }));
871
+ var isIntegerControl = and(uiTypeIs('Control'), schemaTypeIs('integer'));
872
+ var isNumberControl = and(uiTypeIs('Control'), schemaTypeIs('number'));
873
+ var isStringControl = and(uiTypeIs('Control'), schemaTypeIs('string'));
874
+ var isMultiLineControl = and(uiTypeIs('Control'), optionIs('multi', true));
875
+ var isDateControl = and(uiTypeIs('Control'), or(formatIs('date'), optionIs('format', 'date')));
876
+ var isTimeControl = and(uiTypeIs('Control'), or(formatIs('time'), optionIs('format', 'time')));
877
+ var isDateTimeControl = and(uiTypeIs('Control'), or(formatIs('date-time'), optionIs('format', 'date-time')));
878
+ var isObjectArray = and(schemaMatches(function (schema) { return hasType(schema, 'array') && !Array.isArray(schema.items); }
879
+ ), schemaSubPathMatches('items', function (schema) { return hasType(schema, 'object'); }));
880
+ var isObjectArrayControl = and(uiTypeIs('Control'), isObjectArray);
881
+ var traverse = function (any, pred) {
882
+ if (isArray__default["default"](any)) {
883
+ return reduce__default["default"](any, function (acc, el) { return acc || traverse(el, pred); }, false);
884
+ }
885
+ if (pred(any)) {
886
+ return true;
887
+ }
888
+ if (any.items) {
889
+ return traverse(any.items, pred);
890
+ }
891
+ if (any.properties) {
892
+ return reduce__default["default"](toPairs__default["default"](any.properties), function (acc, _a) {
893
+ _a[0]; var val = _a[1];
894
+ return acc || traverse(val, pred);
895
+ }, false);
896
+ }
897
+ return false;
898
+ };
899
+ var isObjectArrayWithNesting = function (uischema, schema) {
900
+ if (!uiTypeIs('Control')(uischema, schema)) {
901
+ return false;
902
+ }
903
+ var schemaPath = uischema.scope;
904
+ var resolvedSchema = resolveSchema(schema, schemaPath);
905
+ var wantedNestingByType = {
906
+ object: 2,
907
+ array: 1
908
+ };
909
+ if (resolvedSchema !== undefined && resolvedSchema.items !== undefined) {
910
+ if (traverse(resolvedSchema.items, function (val) {
911
+ if (val === schema) {
912
+ return false;
913
+ }
914
+ if (typeof val.type !== 'string') {
915
+ return true;
916
+ }
917
+ var typeCount = wantedNestingByType[val.type];
918
+ if (typeCount === undefined) {
919
+ return false;
920
+ }
921
+ wantedNestingByType[val.type] = typeCount - 1;
922
+ return wantedNestingByType[val.type] === 0;
923
+ })) {
924
+ return true;
925
+ }
926
+ if (uischema.options && uischema.options.detail) {
927
+ if (typeof uischema.options.detail === 'string') {
928
+ return uischema.options.detail.toUpperCase() !== 'DEFAULT';
929
+ }
930
+ else if (typeof uischema.options.detail === 'object' &&
931
+ uischema.options.detail.type) {
932
+ return true;
933
+ }
934
+ }
935
+ }
936
+ return false;
937
+ };
938
+ var isArrayObjectControl = isObjectArrayControl;
939
+ var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return deriveTypes(schema).length !== 0 && !Array.isArray(schema.items); }
940
+ ), schemaSubPathMatches('items', function (schema) {
941
+ var types = deriveTypes(schema);
942
+ return (types.length === 1 &&
943
+ includes__default["default"](['integer', 'number', 'boolean', 'string'], types[0]));
944
+ }));
945
+ var isRangeControl = and(uiTypeIs('Control'), or(schemaTypeIs('number'), schemaTypeIs('integer')), schemaMatches(function (schema) {
946
+ return schema.hasOwnProperty('maximum') &&
947
+ schema.hasOwnProperty('minimum') &&
948
+ schema.hasOwnProperty('default');
949
+ }), optionIs('slider', true));
950
+ var isNumberFormatControl = and(uiTypeIs('Control'), schemaTypeIs('integer'), optionIs('format', true));
951
+ var isCategorization = function (category) { return category.type === 'Categorization'; };
952
+ var isCategory = function (uischema) {
953
+ return uischema.type === 'Category';
954
+ };
955
+ var hasCategory = function (categorization) {
956
+ if (isEmpty__default["default"](categorization.elements)) {
957
+ return false;
958
+ }
959
+ return categorization.elements
960
+ .map(function (elem) {
961
+ return isCategorization(elem) ? hasCategory(elem) : isCategory(elem);
962
+ })
963
+ .reduce(function (prev, curr) { return prev && curr; }, true);
964
+ };
965
+ var categorizationHasCategory = function (uischema) {
966
+ return hasCategory(uischema);
967
+ };
968
+ var not = function (tester) { return function (uischema, schema) { return !tester(uischema, schema); }; };
969
+
970
+ var index$1 = /*#__PURE__*/Object.freeze({
971
+ __proto__: null,
972
+ NOT_APPLICABLE: NOT_APPLICABLE,
973
+ isControl: isControl,
974
+ schemaMatches: schemaMatches,
975
+ schemaSubPathMatches: schemaSubPathMatches,
976
+ schemaTypeIs: schemaTypeIs,
977
+ formatIs: formatIs,
978
+ uiTypeIs: uiTypeIs,
979
+ optionIs: optionIs,
980
+ scopeEndsWith: scopeEndsWith,
981
+ scopeEndIs: scopeEndIs,
982
+ and: and,
983
+ or: or,
984
+ rankWith: rankWith,
985
+ withIncreasedRank: withIncreasedRank,
986
+ isBooleanControl: isBooleanControl,
987
+ isObjectControl: isObjectControl,
988
+ isAllOfControl: isAllOfControl,
989
+ isAnyOfControl: isAnyOfControl,
990
+ isOneOfControl: isOneOfControl,
991
+ isEnumControl: isEnumControl,
992
+ isOneOfEnumControl: isOneOfEnumControl,
993
+ isIntegerControl: isIntegerControl,
994
+ isNumberControl: isNumberControl,
995
+ isStringControl: isStringControl,
996
+ isMultiLineControl: isMultiLineControl,
997
+ isDateControl: isDateControl,
998
+ isTimeControl: isTimeControl,
999
+ isDateTimeControl: isDateTimeControl,
1000
+ isObjectArray: isObjectArray,
1001
+ isObjectArrayControl: isObjectArrayControl,
1002
+ isObjectArrayWithNesting: isObjectArrayWithNesting,
1003
+ isArrayObjectControl: isArrayObjectControl,
1004
+ isPrimitiveArrayControl: isPrimitiveArrayControl,
1005
+ isRangeControl: isRangeControl,
1006
+ isNumberFormatControl: isNumberFormatControl,
1007
+ isCategorization: isCategorization,
1008
+ isCategory: isCategory,
1009
+ hasCategory: hasCategory,
1010
+ categorizationHasCategory: categorizationHasCategory,
1011
+ not: not
1012
+ });
1013
+
1014
+ var uischemaRegistryReducer = function (state, action) {
1015
+ if (state === void 0) { state = []; }
1016
+ switch (action.type) {
1017
+ case ADD_UI_SCHEMA:
1018
+ return state
1019
+ .slice()
1020
+ .concat({ tester: action.tester, uischema: action.uischema });
1021
+ case REMOVE_UI_SCHEMA:
1022
+ var copy = state.slice();
1023
+ remove__default["default"](copy, function (entry) { return entry.tester === action.tester; });
1024
+ return copy;
1025
+ default:
1026
+ return state;
1027
+ }
1028
+ };
1029
+ var findMatchingUISchema = function (state) { return function (jsonSchema, schemaPath, path) {
1030
+ var match = maxBy__default["default"](state, function (entry) {
1031
+ return entry.tester(jsonSchema, schemaPath, path);
1032
+ });
1033
+ if (match !== undefined &&
1034
+ match.tester(jsonSchema, schemaPath, path) !== NOT_APPLICABLE) {
1035
+ return match.uischema;
1036
+ }
1037
+ return undefined;
1038
+ }; };
1039
+
1040
+ var jsonFormsReducerConfig = {
1041
+ core: coreReducer,
1042
+ renderers: rendererReducer,
1043
+ cells: cellReducer,
1044
+ config: configReducer,
1045
+ uischemas: uischemaRegistryReducer,
1046
+ defaultData: defaultDataReducer,
1047
+ i18n: i18nReducer,
1048
+ };
1049
+ var findUISchema = function (uischemas, schema, schemaPath, path, fallbackLayoutType, control, rootSchema) {
1050
+ if (fallbackLayoutType === void 0) { fallbackLayoutType = 'VerticalLayout'; }
1051
+ if (control && control.options && control.options.detail) {
1052
+ if (typeof control.options.detail === 'string') {
1053
+ if (control.options.detail.toUpperCase() === 'GENERATE') {
1054
+ return Generate.uiSchema(schema, fallbackLayoutType);
1055
+ }
1056
+ }
1057
+ else if (typeof control.options.detail === 'object') {
1058
+ if (control.options.detail.type &&
1059
+ typeof control.options.detail.type === 'string') {
1060
+ return control.options.detail;
1061
+ }
1062
+ }
1063
+ }
1064
+ var uiSchema = findMatchingUISchema(uischemas)(schema, schemaPath, path);
1065
+ if (uiSchema === undefined) {
1066
+ return Generate.uiSchema(schema, fallbackLayoutType, '#', rootSchema);
1067
+ }
1068
+ return uiSchema;
1069
+ };
1070
+ var getErrorAt = function (instancePath, schema) { return function (state) {
1071
+ return errorAt(instancePath, schema)(state.jsonforms.core);
1072
+ }; };
1073
+ var getSubErrorsAt = function (instancePath, schema) { return function (state) { return subErrorsAt(instancePath, schema)(state.jsonforms.core); }; };
1074
+ var getConfig = function (state) { return state.jsonforms.config; };
1075
+ var getLocale = function (state) {
1076
+ return fetchLocale(get__default["default"](state, 'jsonforms.i18n'));
1077
+ };
1078
+ var getTranslator = function () { return function (state) { return fetchTranslator(get__default["default"](state, 'jsonforms.i18n')); }; };
1079
+ var getErrorTranslator = function () { return function (state) { return fetchErrorTranslator(get__default["default"](state, 'jsonforms.i18n')); }; };
1080
+
1081
+ var getData = function (state) {
1082
+ return extractData(get__default["default"](state, 'jsonforms.core'));
1083
+ };
1084
+ var getSchema = function (state) {
1085
+ return extractSchema(get__default["default"](state, 'jsonforms.core'));
1086
+ };
1087
+ var getUiSchema = function (state) {
1088
+ return extractUiSchema(get__default["default"](state, 'jsonforms.core'));
1089
+ };
1090
+ var getAjv = function (state) { return extractAjv(get__default["default"](state, 'jsonforms.core')); };
1091
+ var getDefaultData = function (state) {
1092
+ return extractDefaultData(get__default["default"](state, 'jsonforms.defaultData'));
1093
+ };
1094
+ var getRenderers = function (state) { return get__default["default"](state, 'jsonforms.renderers'); };
1095
+ var getCells = function (state) { return get__default["default"](state, 'jsonforms.cells'); };
1096
+ var getUISchemas = function (state) { return get__default["default"](state, 'jsonforms.uischemas'); };
1097
+
1098
+ var isObjectSchema = function (schema) {
1099
+ return schema.properties !== undefined;
1100
+ };
1101
+ var isArraySchema = function (schema) {
1102
+ return schema.type === 'array' && schema.items !== undefined;
1103
+ };
1104
+ var resolveData = function (instance, dataPath) {
1105
+ if (isEmpty__default["default"](dataPath)) {
1106
+ return instance;
1107
+ }
1108
+ var dataPathSegments = dataPath.split('.');
1109
+ return dataPathSegments
1110
+ .map(function (segment) { return decodeURIComponent(segment); })
1111
+ .reduce(function (curInstance, decodedSegment) {
1112
+ if (!curInstance || !curInstance.hasOwnProperty(decodedSegment)) {
1113
+ return undefined;
1114
+ }
1115
+ return curInstance[decodedSegment];
1116
+ }, instance);
1117
+ };
1118
+ var findAllRefs = function (schema, result, resolveTuples) {
1119
+ if (result === void 0) { result = {}; }
1120
+ if (resolveTuples === void 0) { resolveTuples = false; }
1121
+ if (isObjectSchema(schema)) {
1122
+ Object.keys(schema.properties).forEach(function (key) {
1123
+ return findAllRefs(schema.properties[key], result);
1124
+ });
1125
+ }
1126
+ if (isArraySchema(schema)) {
1127
+ if (Array.isArray(schema.items)) {
1128
+ if (resolveTuples) {
1129
+ var items = schema.items;
1130
+ items.forEach(function (child) { return findAllRefs(child, result); });
1131
+ }
1132
+ }
1133
+ else {
1134
+ findAllRefs(schema.items, result);
1135
+ }
1136
+ }
1137
+ if (Array.isArray(schema.anyOf)) {
1138
+ var anyOf = schema.anyOf;
1139
+ anyOf.forEach(function (child) { return findAllRefs(child, result); });
1140
+ }
1141
+ if (schema.$ref !== undefined) {
1142
+ result[schema.$ref] = schema;
1143
+ }
1144
+ return result;
1145
+ };
1146
+ var invalidSegment = function (pathSegment) {
1147
+ return pathSegment === '#' || pathSegment === undefined || pathSegment === '';
1148
+ };
1149
+ var resolveSchema = function (schema, schemaPath, rootSchema) {
1150
+ var _a, _b, _c;
1151
+ if (isEmpty__default["default"](schema)) {
1152
+ return undefined;
1153
+ }
1154
+ var validPathSegments = schemaPath.split('/');
1155
+ var resultSchema = schema;
1156
+ for (var i = 0; i < validPathSegments.length; i++) {
1157
+ var pathSegment = validPathSegments[i];
1158
+ resultSchema =
1159
+ resultSchema === undefined || resultSchema.$ref === undefined
1160
+ ? resultSchema
1161
+ : resolveSchema(schema, resultSchema.$ref);
1162
+ if (invalidSegment(pathSegment)) {
1163
+ continue;
1164
+ }
1165
+ var curSchema = get__default["default"](resultSchema, pathSegment);
1166
+ if (!curSchema) {
1167
+ var schemas = [].concat((_a = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.oneOf) !== null && _a !== void 0 ? _a : [], (_b = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.allOf) !== null && _b !== void 0 ? _b : [], (_c = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.anyOf) !== null && _c !== void 0 ? _c : []);
1168
+ for (var _i = 0, schemas_1 = schemas; _i < schemas_1.length; _i++) {
1169
+ var item = schemas_1[_i];
1170
+ curSchema = resolveSchema(item, validPathSegments.slice(i).join('/'));
1171
+ if (curSchema) {
1172
+ break;
1173
+ }
1174
+ }
1175
+ if (curSchema) {
1176
+ resultSchema = curSchema;
1177
+ break;
1178
+ }
1179
+ }
1180
+ resultSchema = curSchema;
1181
+ }
1182
+ if (resultSchema !== undefined && resultSchema.$ref !== undefined) {
1183
+ try {
1184
+ return retrieveResolvableSchema(schema, resultSchema.$ref);
1185
+ }
1186
+ catch (e) {
1187
+ return retrieveResolvableSchema(rootSchema, resultSchema.$ref);
1188
+ }
1189
+ }
1190
+ return resultSchema;
1191
+ };
1192
+ function retrieveResolvableSchema(full, reference) {
1193
+ var child = resolveSchema(full, reference);
1194
+ var allRefs = findAllRefs(child);
1195
+ var innerSelfReference = allRefs[reference];
1196
+ if (innerSelfReference !== undefined) {
1197
+ innerSelfReference.$ref = '#';
1198
+ }
1199
+ return child;
1200
+ }
1201
+
1202
+ var compose = function (path1, path2) {
1203
+ var p1 = path1;
1204
+ if (!isEmpty__default["default"](path1) && !isEmpty__default["default"](path2) && !path2.startsWith('[')) {
1205
+ p1 = path1 + '.';
1206
+ }
1207
+ if (isEmpty__default["default"](p1)) {
1208
+ return path2;
1209
+ }
1210
+ else if (isEmpty__default["default"](path2)) {
1211
+ return p1;
1212
+ }
1213
+ else {
1214
+ return "" + p1 + path2;
1215
+ }
1216
+ };
1217
+ var toDataPathSegments = function (schemaPath) {
1218
+ var s = schemaPath
1219
+ .replace(/anyOf\/[\d]\//g, '')
1220
+ .replace(/allOf\/[\d]\//g, '')
1221
+ .replace(/oneOf\/[\d]\//g, '');
1222
+ var segments = s.split('/');
1223
+ var startFromRoot = segments[0] === '#' || segments[0] === '';
1224
+ var startIndex = startFromRoot ? 2 : 1;
1225
+ return range__default["default"](startIndex, segments.length, 2).map(function (idx) { return segments[idx]; });
1226
+ };
1227
+ var toDataPath = function (schemaPath) {
1228
+ return toDataPathSegments(schemaPath).join('.');
1229
+ };
1230
+ var composeWithUi = function (scopableUi, path) {
1231
+ var segments = toDataPathSegments(scopableUi.scope);
1232
+ if (isEmpty__default["default"](segments) && path === undefined) {
1233
+ return '';
1234
+ }
1235
+ return isEmpty__default["default"](segments) ? path : compose(path, segments.join('.'));
1236
+ };
1237
+
1238
+ var isOrCondition = function (condition) {
1239
+ return condition.type === 'OR';
1240
+ };
1241
+ var isAndCondition = function (condition) {
1242
+ return condition.type === 'AND';
1243
+ };
1244
+ var isLeafCondition = function (condition) {
1245
+ return condition.type === 'LEAF';
1246
+ };
1247
+ var isSchemaCondition = function (condition) { return has__default["default"](condition, 'schema'); };
1248
+ var getConditionScope = function (condition, path) {
1249
+ return composeWithUi(condition, path);
1250
+ };
1251
+ var evaluateCondition = function (data, condition, path, ajv) {
1252
+ if (isAndCondition(condition)) {
1253
+ return condition.conditions.reduce(function (acc, cur) { return acc && evaluateCondition(data, cur, path, ajv); }, true);
1254
+ }
1255
+ else if (isOrCondition(condition)) {
1256
+ return condition.conditions.reduce(function (acc, cur) { return acc || evaluateCondition(data, cur, path, ajv); }, false);
1257
+ }
1258
+ else if (isLeafCondition(condition)) {
1259
+ var value = resolveData(data, getConditionScope(condition, path));
1260
+ return value === condition.expectedValue;
1261
+ }
1262
+ else if (isSchemaCondition(condition)) {
1263
+ var value = resolveData(data, getConditionScope(condition, path));
1264
+ return ajv.validate(condition.schema, value);
1265
+ }
1266
+ else {
1267
+ return true;
1268
+ }
1269
+ };
1270
+ var isRuleFulfilled = function (uischema, data, path, ajv) {
1271
+ var condition = uischema.rule.condition;
1272
+ return evaluateCondition(data, condition, path, ajv);
1273
+ };
1274
+ var evalVisibility = function (uischema, data, path, ajv) {
1275
+ if (path === void 0) { path = undefined; }
1276
+ var fulfilled = isRuleFulfilled(uischema, data, path, ajv);
1277
+ switch (uischema.rule.effect) {
1278
+ case exports.RuleEffect.HIDE:
1279
+ return !fulfilled;
1280
+ case exports.RuleEffect.SHOW:
1281
+ return fulfilled;
1282
+ default:
1283
+ return true;
1284
+ }
1285
+ };
1286
+ var evalEnablement = function (uischema, data, path, ajv) {
1287
+ if (path === void 0) { path = undefined; }
1288
+ var fulfilled = isRuleFulfilled(uischema, data, path, ajv);
1289
+ switch (uischema.rule.effect) {
1290
+ case exports.RuleEffect.DISABLE:
1291
+ return !fulfilled;
1292
+ case exports.RuleEffect.ENABLE:
1293
+ return fulfilled;
1294
+ default:
1295
+ return true;
1296
+ }
1297
+ };
1298
+ var hasShowRule = function (uischema) {
1299
+ if (uischema.rule &&
1300
+ (uischema.rule.effect === exports.RuleEffect.SHOW ||
1301
+ uischema.rule.effect === exports.RuleEffect.HIDE)) {
1302
+ return true;
1303
+ }
1304
+ return false;
1305
+ };
1306
+ var hasEnableRule = function (uischema) {
1307
+ if (uischema.rule &&
1308
+ (uischema.rule.effect === exports.RuleEffect.ENABLE ||
1309
+ uischema.rule.effect === exports.RuleEffect.DISABLE)) {
1310
+ return true;
1311
+ }
1312
+ return false;
1313
+ };
1314
+ var isVisible = function (uischema, data, path, ajv) {
1315
+ if (path === void 0) { path = undefined; }
1316
+ if (uischema.rule) {
1317
+ return evalVisibility(uischema, data, path, ajv);
1318
+ }
1319
+ return true;
1320
+ };
1321
+ var isEnabled = function (uischema, data, path, ajv) {
1322
+ if (path === void 0) { path = undefined; }
1323
+ if (uischema.rule) {
1324
+ return evalEnablement(uischema, data, path, ajv);
1325
+ }
1326
+ return true;
1327
+ };
1328
+ var isInherentlyEnabled = function (state, ownProps, uischema, schema, rootData, config) {
1329
+ var _a, _b, _c;
1330
+ if ((_a = state === null || state === void 0 ? void 0 : state.jsonforms) === null || _a === void 0 ? void 0 : _a.readonly) {
1331
+ return false;
1332
+ }
1333
+ if (uischema && hasEnableRule(uischema)) {
1334
+ return isEnabled(uischema, rootData, ownProps === null || ownProps === void 0 ? void 0 : ownProps.path, getAjv(state));
1335
+ }
1336
+ if (typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.readonly) === 'boolean') {
1337
+ return !uischema.options.readonly;
1338
+ }
1339
+ if (typeof ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.readOnly) === 'boolean') {
1340
+ return !uischema.options.readOnly;
1341
+ }
1342
+ if (typeof (config === null || config === void 0 ? void 0 : config.readonly) === 'boolean') {
1343
+ return !config.readonly;
1344
+ }
1345
+ if (typeof (config === null || config === void 0 ? void 0 : config.readOnly) === 'boolean') {
1346
+ return !config.readOnly;
1347
+ }
1348
+ if ((schema === null || schema === void 0 ? void 0 : schema.readOnly) === true) {
1349
+ return false;
1350
+ }
1351
+ if (typeof (ownProps === null || ownProps === void 0 ? void 0 : ownProps.enabled) === 'boolean') {
1352
+ return ownProps.enabled;
1353
+ }
1354
+ return true;
1355
+ };
1356
+
1357
+ var convertToValidClassName = function (s) {
1358
+ return s.replace('#', 'root').replace(new RegExp('/', 'g'), '_');
1359
+ };
1360
+ var formatErrorMessage = function (errors) {
1361
+ if (errors === undefined || errors === null) {
1362
+ return '';
1363
+ }
1364
+ return errors.join('\n');
1365
+ };
1366
+ var hasType = function (jsonSchema, expected) {
1367
+ return includes__default["default"](deriveTypes(jsonSchema), expected);
1368
+ };
1369
+ var deriveTypes = function (jsonSchema) {
1370
+ if (isEmpty__default["default"](jsonSchema)) {
1371
+ return [];
1372
+ }
1373
+ if (!isEmpty__default["default"](jsonSchema.type) && typeof jsonSchema.type === 'string') {
1374
+ return [jsonSchema.type];
1375
+ }
1376
+ if (isArray__default["default"](jsonSchema.type)) {
1377
+ return jsonSchema.type;
1378
+ }
1379
+ if (!isEmpty__default["default"](jsonSchema.properties) ||
1380
+ !isEmpty__default["default"](jsonSchema.additionalProperties)) {
1381
+ return ['object'];
1382
+ }
1383
+ if (!isEmpty__default["default"](jsonSchema.items)) {
1384
+ return ['array'];
1385
+ }
1386
+ if (!isEmpty__default["default"](jsonSchema.allOf)) {
1387
+ var allOfType = find__default["default"](jsonSchema.allOf, function (schema) { return deriveTypes(schema).length !== 0; });
1388
+ if (allOfType) {
1389
+ return deriveTypes(allOfType);
1390
+ }
1391
+ }
1392
+ return [];
1393
+ };
1394
+ var Resolve = {
1395
+ schema: resolveSchema,
1396
+ data: resolveData
1397
+ };
1398
+ var fromScopable = function (scopable) {
1399
+ return toDataPathSegments(scopable.scope).join('.');
1400
+ };
1401
+ var Paths = {
1402
+ compose: compose,
1403
+ fromScopable: fromScopable
1404
+ };
1405
+ var Runtime = {
1406
+ isEnabled: function (uischema, data, ajv) {
1407
+ return isEnabled(uischema, data, undefined, ajv);
1408
+ },
1409
+ isVisible: function (uischema, data, ajv) {
1410
+ return isVisible(uischema, data, undefined, ajv);
1411
+ }
1412
+ };
1413
+
1414
+ var deriveLabel = function (controlElement, schemaElement) {
1415
+ if (schemaElement && typeof schemaElement.title === 'string') {
1416
+ return schemaElement.title;
1417
+ }
1418
+ if (typeof controlElement.scope === 'string') {
1419
+ var ref = controlElement.scope;
1420
+ var label = ref.substr(ref.lastIndexOf('/') + 1);
1421
+ return startCase__default["default"](label);
1422
+ }
1423
+ return '';
1424
+ };
1425
+ var createCleanLabel = function (label) {
1426
+ return startCase__default["default"](label.replace('_', ' '));
1427
+ };
1428
+ var createLabelDescriptionFrom = function (withLabel, schema) {
1429
+ var labelProperty = withLabel.label;
1430
+ if (typeof labelProperty === 'boolean') {
1431
+ return labelDescription(deriveLabel(withLabel, schema), labelProperty);
1432
+ }
1433
+ if (typeof labelProperty === 'string') {
1434
+ return labelDescription(labelProperty, true);
1435
+ }
1436
+ if (typeof labelProperty === 'object') {
1437
+ var label = typeof labelProperty.text === 'string'
1438
+ ? labelProperty.text
1439
+ : deriveLabel(withLabel, schema);
1440
+ var show = typeof labelProperty.show === 'boolean' ? labelProperty.show : true;
1441
+ return labelDescription(label, show);
1442
+ }
1443
+ return labelDescription(deriveLabel(withLabel, schema), true);
1444
+ };
1445
+ var labelDescription = function (text, show) { return ({
1446
+ text: text,
1447
+ show: show
1448
+ }); };
1449
+
1450
+ var createLabel = function (subSchema, subSchemaIndex, keyword) {
1451
+ if (subSchema.title) {
1452
+ return subSchema.title;
1453
+ }
1454
+ else {
1455
+ return keyword + '-' + subSchemaIndex;
1456
+ }
1457
+ };
1458
+ var resolveSubSchemas = function (schema, rootSchema, keyword) {
1459
+ var _a;
1460
+ var schemas = schema[keyword];
1461
+ if (schemas.findIndex(function (e) { return e.$ref !== undefined; }) !== -1) {
1462
+ return __assign(__assign({}, schema), (_a = {}, _a[keyword] = schema[keyword].map(function (e) {
1463
+ return e.$ref ? resolveSchema(rootSchema, e.$ref) : e;
1464
+ }), _a));
1465
+ }
1466
+ return schema;
1467
+ };
1468
+ var createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
1469
+ return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) { return ({
1470
+ schema: subSchema,
1471
+ uischema: findUISchema(uischemas, subSchema, control.scope, path, undefined, control, rootSchema),
1472
+ label: createLabel(subSchema, subSchemaIndex, keyword)
1473
+ }); });
1474
+ };
1475
+
1476
+ var isRequired = function (schema, schemaPath, rootSchema) {
1477
+ var pathSegments = schemaPath.split('/');
1478
+ var lastSegment = pathSegments[pathSegments.length - 1];
1479
+ var nextHigherSchemaSegments = pathSegments.slice(0, pathSegments.length - 2);
1480
+ var nextHigherSchemaPath = nextHigherSchemaSegments.join('/');
1481
+ var nextHigherSchema = Resolve.schema(schema, nextHigherSchemaPath, rootSchema);
1482
+ return (nextHigherSchema !== undefined &&
1483
+ nextHigherSchema.required !== undefined &&
1484
+ nextHigherSchema.required.indexOf(lastSegment) !== -1);
1485
+ };
1486
+ var computeLabel = function (label, required, hideRequiredAsterisk) {
1487
+ return "" + (label !== null && label !== void 0 ? label : '') + (required && !hideRequiredAsterisk ? '*' : '');
1488
+ };
1489
+ var showAsRequired = function (required, hideRequiredAsterisk) {
1490
+ return required && !hideRequiredAsterisk;
1491
+ };
1492
+ var createDefaultValue = function (schema) {
1493
+ switch (schema.type) {
1494
+ case 'string':
1495
+ if (schema.format === 'date-time' ||
1496
+ schema.format === 'date' ||
1497
+ schema.format === 'time') {
1498
+ return new Date();
1499
+ }
1500
+ return '';
1501
+ case 'integer':
1502
+ case 'number':
1503
+ return 0;
1504
+ case 'boolean':
1505
+ return false;
1506
+ case 'array':
1507
+ return [];
1508
+ case 'null':
1509
+ return null;
1510
+ default:
1511
+ return {};
1512
+ }
1513
+ };
1514
+ var isDescriptionHidden = function (visible, description, isFocused, showUnfocusedDescription) {
1515
+ return (description === undefined ||
1516
+ (description !== undefined && !visible) ||
1517
+ (!showUnfocusedDescription && !isFocused));
1518
+ };
1519
+ var enumToEnumOptionMapper = function (e, t, i18nKey) {
1520
+ var label = typeof e === 'string' ? e : JSON.stringify(e);
1521
+ if (t) {
1522
+ if (i18nKey) {
1523
+ label = t(i18nKey + "." + label, label);
1524
+ }
1525
+ else {
1526
+ label = t(label, label);
1527
+ }
1528
+ }
1529
+ return { label: label, value: e };
1530
+ };
1531
+ var oneOfToEnumOptionMapper = function (e, t, fallbackI18nKey) {
1532
+ var _a;
1533
+ var label = (_a = e.title) !== null && _a !== void 0 ? _a : (typeof e.const === 'string' ? e.const : JSON.stringify(e.const));
1534
+ if (t) {
1535
+ if (e.i18n) {
1536
+ label = t(e.i18n, label);
1537
+ }
1538
+ else if (fallbackI18nKey) {
1539
+ label = t(fallbackI18nKey + "." + label, label);
1540
+ }
1541
+ else {
1542
+ label = t(label, label);
1543
+ }
1544
+ }
1545
+ return {
1546
+ label: label,
1547
+ value: e.const,
1548
+ };
1549
+ };
1550
+ var mapStateToControlProps = function (state, ownProps) {
1551
+ var uischema = ownProps.uischema;
1552
+ var rootData = getData(state);
1553
+ var path = composeWithUi(uischema, ownProps.path);
1554
+ var visible = ownProps.visible === undefined || hasShowRule(uischema)
1555
+ ? isVisible(uischema, rootData, ownProps.path, getAjv(state))
1556
+ : ownProps.visible;
1557
+ var controlElement = uischema;
1558
+ var id = ownProps.id;
1559
+ var rootSchema = getSchema(state);
1560
+ var required = controlElement.scope !== undefined &&
1561
+ isRequired(ownProps.schema, controlElement.scope, rootSchema);
1562
+ var resolvedSchema = Resolve.schema(ownProps.schema || rootSchema, controlElement.scope, rootSchema);
1563
+ var errors = getErrorAt(path, resolvedSchema)(state);
1564
+ var description = resolvedSchema !== undefined ? resolvedSchema.description : '';
1565
+ var data = Resolve.data(rootData, path);
1566
+ var labelDesc = createLabelDescriptionFrom(uischema, resolvedSchema);
1567
+ var label = labelDesc.show ? labelDesc.text : '';
1568
+ var config = getConfig(state);
1569
+ var enabled = isInherentlyEnabled(state, ownProps, uischema, resolvedSchema || rootSchema, rootData, config);
1570
+ var schema = resolvedSchema !== null && resolvedSchema !== void 0 ? resolvedSchema : rootSchema;
1571
+ var t = getTranslator()(state);
1572
+ var te = getErrorTranslator()(state);
1573
+ var i18nLabel = t(getI18nKey(schema, uischema, path, 'label'), label);
1574
+ var i18nDescription = t(getI18nKey(schema, uischema, path, 'description'), description);
1575
+ var i18nErrorMessage = getCombinedErrorMessage(errors, te, t, schema, uischema, path);
1576
+ return {
1577
+ data: data,
1578
+ description: i18nDescription,
1579
+ errors: i18nErrorMessage,
1580
+ label: i18nLabel,
1581
+ visible: visible,
1582
+ enabled: enabled,
1583
+ id: id,
1584
+ path: path,
1585
+ required: required,
1586
+ uischema: uischema,
1587
+ schema: schema,
1588
+ config: getConfig(state),
1589
+ cells: ownProps.cells || state.jsonforms.cells,
1590
+ rootSchema: rootSchema
1591
+ };
1592
+ };
1593
+ var mapDispatchToControlProps = function (dispatch) { return ({
1594
+ handleChange: function (path, value) {
1595
+ dispatch(update(path, function () { return value; }));
1596
+ }
1597
+ }); };
1598
+ var mapStateToEnumControlProps = function (state, ownProps) {
1599
+ var _a;
1600
+ var props = mapStateToControlProps(state, ownProps);
1601
+ var options = ownProps.options ||
1602
+ ((_a = props.schema.enum) === null || _a === void 0 ? void 0 : _a.map(function (e) {
1603
+ return enumToEnumOptionMapper(e, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
1604
+ })) ||
1605
+ (props.schema.const && [
1606
+ enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path))
1607
+ ]);
1608
+ return __assign(__assign({}, props), { options: options });
1609
+ };
1610
+ var mapStateToOneOfEnumControlProps = function (state, ownProps) {
1611
+ var _a;
1612
+ var props = mapStateToControlProps(state, ownProps);
1613
+ var options = ownProps.options ||
1614
+ ((_a = props.schema.oneOf) === null || _a === void 0 ? void 0 : _a.map(function (oneOfSubSchema) {
1615
+ return oneOfToEnumOptionMapper(oneOfSubSchema, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
1616
+ }));
1617
+ return __assign(__assign({}, props), { options: options });
1618
+ };
1619
+ var mapStateToMultiEnumControlProps = function (state, ownProps) {
1620
+ var _a;
1621
+ var props = mapStateToControlProps(state, ownProps);
1622
+ var items = props.schema.items;
1623
+ var options = ownProps.options ||
1624
+ ((items === null || items === void 0 ? void 0 : items.oneOf) &&
1625
+ items.oneOf.map(function (oneOfSubSchema) {
1626
+ var _a;
1627
+ return oneOfToEnumOptionMapper(oneOfSubSchema, (_a = state.jsonforms.i18n) === null || _a === void 0 ? void 0 : _a.translate, getI18nKeyPrefix(props.schema, props.uischema, props.path));
1628
+ })) ||
1629
+ ((_a = items === null || items === void 0 ? void 0 : items.enum) === null || _a === void 0 ? void 0 : _a.map(function (e) {
1630
+ var _a;
1631
+ return enumToEnumOptionMapper(e, (_a = state.jsonforms.i18n) === null || _a === void 0 ? void 0 : _a.translate, getI18nKeyPrefix(props.schema, props.uischema, props.path));
1632
+ }));
1633
+ return __assign(__assign({}, props), { options: options });
1634
+ };
1635
+ var mapStateToMasterListItemProps = function (state, ownProps) {
1636
+ var schema = ownProps.schema, path = ownProps.path, index = ownProps.index;
1637
+ var firstPrimitiveProp = schema.properties
1638
+ ? find__default["default"](Object.keys(schema.properties), function (propName) {
1639
+ var prop = schema.properties[propName];
1640
+ return (prop.type === 'string' ||
1641
+ prop.type === 'number' ||
1642
+ prop.type === 'integer');
1643
+ })
1644
+ : undefined;
1645
+ var childPath = compose(path, "" + index);
1646
+ var childData = Resolve.data(getData(state), childPath);
1647
+ var childLabel = firstPrimitiveProp ? childData[firstPrimitiveProp] : '';
1648
+ return __assign(__assign({}, ownProps), { childLabel: childLabel });
1649
+ };
1650
+ var mapStateToControlWithDetailProps = function (state, ownProps) {
1651
+ var props = __rest(mapStateToControlProps(state, ownProps), []);
1652
+ return __assign(__assign({}, props), { uischemas: state.jsonforms.uischemas });
1653
+ };
1654
+ var mapStateToArrayControlProps = function (state, ownProps) {
1655
+ var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, props = __rest(_a, ["path", "schema", "uischema"]);
1656
+ var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
1657
+ var childErrors = getSubErrorsAt(path, resolvedSchema)(state);
1658
+ return __assign(__assign({}, props), { path: path,
1659
+ uischema: uischema, schema: resolvedSchema, childErrors: childErrors, renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state) });
1660
+ };
1661
+ var mapDispatchToArrayControlProps = function (dispatch) { return ({
1662
+ addItem: function (path, value) { return function () {
1663
+ dispatch(update(path, function (array) {
1664
+ if (array === undefined || array === null) {
1665
+ return [value];
1666
+ }
1667
+ array.push(value);
1668
+ return array;
1669
+ }));
1670
+ }; },
1671
+ removeItems: function (path, toDelete) { return function () {
1672
+ dispatch(update(path, function (array) {
1673
+ toDelete
1674
+ .sort()
1675
+ .reverse()
1676
+ .forEach(function (s) { return array.splice(s, 1); });
1677
+ return array;
1678
+ }));
1679
+ }; },
1680
+ moveUp: function (path, toMove) { return function () {
1681
+ dispatch(update(path, function (array) {
1682
+ moveUp(array, toMove);
1683
+ return array;
1684
+ }));
1685
+ }; },
1686
+ moveDown: function (path, toMove) { return function () {
1687
+ dispatch(update(path, function (array) {
1688
+ moveDown(array, toMove);
1689
+ return array;
1690
+ }));
1691
+ }; }
1692
+ }); };
1693
+ var mapDispatchToMultiEnumProps = function (dispatch) { return ({
1694
+ addItem: function (path, value) {
1695
+ dispatch(update(path, function (data) {
1696
+ if (data === undefined || data === null) {
1697
+ return [value];
1698
+ }
1699
+ data.push(value);
1700
+ return data;
1701
+ }));
1702
+ },
1703
+ removeItem: function (path, toDelete) {
1704
+ dispatch(update(path, function (data) {
1705
+ var indexInData = data.indexOf(toDelete);
1706
+ data.splice(indexInData, 1);
1707
+ return data;
1708
+ }));
1709
+ }
1710
+ }); };
1711
+ var layoutDefaultProps = {
1712
+ visible: true,
1713
+ enabled: true,
1714
+ path: '',
1715
+ direction: 'column'
1716
+ };
1717
+ var getDirection = function (uischema) {
1718
+ if (uischema.type === 'HorizontalLayout') {
1719
+ return 'row';
1720
+ }
1721
+ if (uischema.type === 'VerticalLayout') {
1722
+ return 'column';
1723
+ }
1724
+ return layoutDefaultProps.direction;
1725
+ };
1726
+ var mapStateToLayoutProps = function (state, ownProps) {
1727
+ var _a;
1728
+ var rootData = getData(state);
1729
+ var uischema = ownProps.uischema;
1730
+ var visible = ownProps.visible === undefined || hasShowRule(uischema)
1731
+ ? isVisible(ownProps.uischema, rootData, ownProps.path, getAjv(state))
1732
+ : ownProps.visible;
1733
+ var data = Resolve.data(rootData, ownProps.path);
1734
+ var config = getConfig(state);
1735
+ var enabled = isInherentlyEnabled(state, ownProps, uischema, undefined,
1736
+ rootData, config);
1737
+ return __assign(__assign({}, layoutDefaultProps), { renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), visible: visible,
1738
+ enabled: enabled, path: ownProps.path, data: data, uischema: ownProps.uischema, schema: ownProps.schema, direction: (_a = ownProps.direction) !== null && _a !== void 0 ? _a : getDirection(uischema) });
1739
+ };
1740
+ var mapStateToJsonFormsRendererProps = function (state, ownProps) {
1741
+ var uischema = ownProps.uischema;
1742
+ if (uischema === undefined) {
1743
+ if (ownProps.schema) {
1744
+ uischema = findUISchema(state.jsonforms.uischemas, ownProps.schema, undefined, ownProps.path);
1745
+ }
1746
+ else {
1747
+ uischema = getUiSchema(state);
1748
+ }
1749
+ }
1750
+ return {
1751
+ renderers: ownProps.renderers || get__default["default"](state.jsonforms, 'renderers') || [],
1752
+ cells: ownProps.cells || get__default["default"](state.jsonforms, 'cells') || [],
1753
+ schema: ownProps.schema || getSchema(state),
1754
+ rootSchema: getSchema(state),
1755
+ uischema: uischema,
1756
+ path: ownProps.path
1757
+ };
1758
+ };
1759
+ var controlDefaultProps = __assign(__assign({}, layoutDefaultProps), { errors: [] });
1760
+ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
1761
+ var uischema = ownProps.uischema;
1762
+ var path = composeWithUi(uischema, ownProps.path);
1763
+ var rootSchema = getSchema(state);
1764
+ var resolvedSchema = Resolve.schema(ownProps.schema || rootSchema, uischema.scope, rootSchema);
1765
+ var visible = ownProps.visible === undefined || hasShowRule(uischema)
1766
+ ? isVisible(uischema, getData(state), ownProps.path, getAjv(state))
1767
+ : ownProps.visible;
1768
+ var id = ownProps.id;
1769
+ var data = Resolve.data(getData(state), path);
1770
+ var ajv = state.jsonforms.core.ajv;
1771
+ var schema = resolvedSchema || rootSchema;
1772
+ var _schema = resolveSubSchemas(schema, rootSchema, keyword);
1773
+ var structuralKeywords = [
1774
+ 'required',
1775
+ 'additionalProperties',
1776
+ 'type',
1777
+ 'enum',
1778
+ 'const'
1779
+ ];
1780
+ var dataIsValid = function (errors) {
1781
+ return (!errors ||
1782
+ errors.length === 0 ||
1783
+ !errors.find(function (e) { return structuralKeywords.indexOf(e.keyword) !== -1; }));
1784
+ };
1785
+ var indexOfFittingSchema;
1786
+ for (var i = 0; i < _schema[keyword].length; i++) {
1787
+ try {
1788
+ var valFn = ajv.compile(_schema[keyword][i]);
1789
+ valFn(data);
1790
+ if (dataIsValid(valFn.errors)) {
1791
+ indexOfFittingSchema = i;
1792
+ break;
1793
+ }
1794
+ }
1795
+ catch (error) {
1796
+ console.debug("Combinator subschema is not self contained, can't hand it over to AJV");
1797
+ }
1798
+ }
1799
+ return {
1800
+ data: data,
1801
+ path: path,
1802
+ schema: schema,
1803
+ rootSchema: rootSchema,
1804
+ visible: visible,
1805
+ id: id,
1806
+ indexOfFittingSchema: indexOfFittingSchema,
1807
+ uischemas: state.jsonforms.uischemas,
1808
+ uischema: uischema
1809
+ };
1810
+ };
1811
+ var mapStateToAllOfProps = function (state, ownProps) {
1812
+ return mapStateToCombinatorRendererProps(state, ownProps, 'allOf');
1813
+ };
1814
+ var mapStateToAnyOfProps = function (state, ownProps) {
1815
+ return mapStateToCombinatorRendererProps(state, ownProps, 'anyOf');
1816
+ };
1817
+ var mapStateToOneOfProps = function (state, ownProps) {
1818
+ return mapStateToCombinatorRendererProps(state, ownProps, 'oneOf');
1819
+ };
1820
+ var mapStateToArrayLayoutProps = function (state, ownProps) {
1821
+ var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, errors = _a.errors, props = __rest(_a, ["path", "schema", "uischema", "errors"]);
1822
+ var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
1823
+ var childErrors = getCombinedErrorMessage(getSubErrorsAt(path, resolvedSchema)(state), getErrorTranslator()(state), getTranslator()(state), undefined, undefined, undefined);
1824
+ var allErrors = errors +
1825
+ (errors.length > 0 && childErrors.length > 0 ? '\n' : '') +
1826
+ childErrors;
1827
+ return __assign(__assign({}, props), { path: path,
1828
+ uischema: uischema, schema: resolvedSchema, data: props.data ? props.data.length : 0, errors: allErrors, minItems: schema.minItems });
1829
+ };
1830
+
1831
+ var mapStateToCellProps = function (state, ownProps) {
1832
+ var id = ownProps.id, schema = ownProps.schema, path = ownProps.path, uischema = ownProps.uischema, renderers = ownProps.renderers, cells = ownProps.cells;
1833
+ var rootData = getData(state);
1834
+ var visible = ownProps.visible !== undefined
1835
+ ? ownProps.visible
1836
+ : isVisible(uischema, rootData, undefined, getAjv(state));
1837
+ var rootSchema = getSchema(state);
1838
+ var config = getConfig(state);
1839
+ var enabled;
1840
+ if (state.jsonforms.readonly === true) {
1841
+ enabled = false;
1842
+ }
1843
+ else if (typeof ownProps.enabled === 'boolean') {
1844
+ enabled = ownProps.enabled;
1845
+ }
1846
+ else {
1847
+ enabled = isInherentlyEnabled(state, ownProps, uischema, schema || rootSchema, rootData, config);
1848
+ }
1849
+ var errors = formatErrorMessage(union__default["default"](getErrorAt(path, schema)(state).map(function (error) { return error.message; })));
1850
+ var isValid = isEmpty__default["default"](errors);
1851
+ return {
1852
+ data: Resolve.data(rootData, path),
1853
+ visible: visible,
1854
+ enabled: enabled,
1855
+ id: id,
1856
+ path: path,
1857
+ errors: errors,
1858
+ isValid: isValid,
1859
+ schema: schema,
1860
+ uischema: uischema,
1861
+ config: getConfig(state),
1862
+ rootSchema: rootSchema,
1863
+ renderers: renderers,
1864
+ cells: cells
1865
+ };
1866
+ };
1867
+ var mapStateToDispatchCellProps = function (state, ownProps) {
1868
+ var props = mapStateToCellProps(state, ownProps);
1869
+ ownProps.renderers; var cells = ownProps.cells, otherOwnProps = __rest(ownProps, ["renderers", "cells"]);
1870
+ return __assign(__assign(__assign({}, props), otherOwnProps), { cells: cells || state.jsonforms.cells || [] });
1871
+ };
1872
+ var defaultMapStateToEnumCellProps = function (state, ownProps) {
1873
+ var _a;
1874
+ var props = mapStateToCellProps(state, ownProps);
1875
+ var options = ownProps.options ||
1876
+ ((_a = props.schema.enum) === null || _a === void 0 ? void 0 : _a.map(function (e) {
1877
+ return enumToEnumOptionMapper(e, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
1878
+ })) ||
1879
+ (props.schema.const && [
1880
+ enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path))
1881
+ ]);
1882
+ return __assign(__assign({}, props), { options: options });
1883
+ };
1884
+ var mapStateToOneOfEnumCellProps = function (state, ownProps) {
1885
+ var _a;
1886
+ var props = mapStateToCellProps(state, ownProps);
1887
+ var options = ownProps.options ||
1888
+ ((_a = props.schema.oneOf) === null || _a === void 0 ? void 0 : _a.map(function (oneOfSubSchema) {
1889
+ return oneOfToEnumOptionMapper(oneOfSubSchema, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
1890
+ }));
1891
+ return __assign(__assign({}, props), { options: options });
1892
+ };
1893
+ var mapDispatchToCellProps = mapDispatchToControlProps;
1894
+ var defaultMapDispatchToControlProps =
1895
+ function (dispatch, ownProps) {
1896
+ var handleChange = mapDispatchToCellProps(dispatch).handleChange;
1897
+ return {
1898
+ handleChange: ownProps.handleChange || handleChange
1899
+ };
1900
+ };
1901
+
1902
+ var usedIds = new Set();
1903
+ var makeId = function (idBase, iteration) {
1904
+ return iteration <= 1 ? idBase : idBase + iteration.toString();
1905
+ };
1906
+ var isUniqueId = function (idBase, iteration) {
1907
+ var newID = makeId(idBase, iteration);
1908
+ return !usedIds.has(newID);
1909
+ };
1910
+ var createId = function (proposedId) {
1911
+ if (proposedId === undefined) {
1912
+ proposedId = 'undefined';
1913
+ }
1914
+ var tries = 0;
1915
+ while (!isUniqueId(proposedId, tries)) {
1916
+ tries++;
1917
+ }
1918
+ var newID = makeId(proposedId, tries);
1919
+ usedIds.add(newID);
1920
+ return newID;
1921
+ };
1922
+ var removeId = function (id) { return usedIds.delete(id); };
1923
+ var clearAllIds = function () { return usedIds.clear(); };
1924
+
1925
+ var getFirstPrimitiveProp = function (schema) {
1926
+ if (schema.properties) {
1927
+ return find__default["default"](Object.keys(schema.properties), function (propName) {
1928
+ var prop = schema.properties[propName];
1929
+ return (prop.type === 'string' ||
1930
+ prop.type === 'number' ||
1931
+ prop.type === 'integer');
1932
+ });
1933
+ }
1934
+ return undefined;
1935
+ };
1936
+
1937
+ var setReadonlyPropertyValue = function (value) { return function (child) {
1938
+ if (!child.options) {
1939
+ child.options = {};
1940
+ }
1941
+ child.options.readonly = value;
1942
+ }; };
1943
+ var setReadonly = function (uischema) {
1944
+ iterateSchema(uischema, setReadonlyPropertyValue(true));
1945
+ };
1946
+ var unsetReadonly = function (uischema) {
1947
+ iterateSchema(uischema, setReadonlyPropertyValue(false));
1948
+ };
1949
+ var iterateSchema = function (uischema, toApply) {
1950
+ if (isEmpty__default["default"](uischema)) {
1951
+ return;
1952
+ }
1953
+ if (isLayout(uischema)) {
1954
+ uischema.elements.forEach(function (child) { return iterateSchema(child, toApply); });
1955
+ return;
1956
+ }
1957
+ toApply(uischema);
1958
+ };
1959
+
1960
+ var createAjv = function (options) {
1961
+ var ajv = new Ajv__default["default"](__assign({ allErrors: true, verbose: true, strict: false }, options));
1962
+ addFormats__default["default"](ajv);
1963
+ return ajv;
1964
+ };
1965
+
1966
+ var createLayout = function (layoutType) { return ({
1967
+ type: layoutType,
1968
+ elements: []
1969
+ }); };
1970
+ var createControlElement = function (ref) { return ({
1971
+ type: 'Control',
1972
+ scope: ref
1973
+ }); };
1974
+ var wrapInLayoutIfNecessary = function (uischema, layoutType) {
1975
+ if (!isEmpty__default["default"](uischema) && !isLayout(uischema)) {
1976
+ var verticalLayout = createLayout(layoutType);
1977
+ verticalLayout.elements.push(uischema);
1978
+ return verticalLayout;
1979
+ }
1980
+ return uischema;
1981
+ };
1982
+ var addLabel = function (layout, labelName) {
1983
+ if (!isEmpty__default["default"](labelName)) {
1984
+ var fixedLabel = startCase__default["default"](labelName);
1985
+ if (isGroup(layout)) {
1986
+ layout.label = fixedLabel;
1987
+ }
1988
+ else {
1989
+ var label = {
1990
+ type: 'Label',
1991
+ text: fixedLabel
1992
+ };
1993
+ layout.elements.push(label);
1994
+ }
1995
+ }
1996
+ };
1997
+ var isCombinator = function (jsonSchema) {
1998
+ return (!isEmpty__default["default"](jsonSchema) &&
1999
+ (!isEmpty__default["default"](jsonSchema.oneOf) ||
2000
+ !isEmpty__default["default"](jsonSchema.anyOf) ||
2001
+ !isEmpty__default["default"](jsonSchema.allOf)));
2002
+ };
2003
+ var generateUISchema = function (jsonSchema, schemaElements, currentRef, schemaName, layoutType, rootSchema) {
2004
+ if (!isEmpty__default["default"](jsonSchema) && jsonSchema.$ref !== undefined) {
2005
+ return generateUISchema(resolveSchema(rootSchema, jsonSchema.$ref), schemaElements, currentRef, schemaName, layoutType, rootSchema);
2006
+ }
2007
+ if (isCombinator(jsonSchema)) {
2008
+ var controlObject = createControlElement(currentRef);
2009
+ schemaElements.push(controlObject);
2010
+ return controlObject;
2011
+ }
2012
+ var types = deriveTypes(jsonSchema);
2013
+ if (types.length === 0) {
2014
+ return null;
2015
+ }
2016
+ if (types.length > 1) {
2017
+ var controlObject = createControlElement(currentRef);
2018
+ schemaElements.push(controlObject);
2019
+ return controlObject;
2020
+ }
2021
+ if (currentRef === '#' && types[0] === 'object') {
2022
+ var layout_1 = createLayout(layoutType);
2023
+ schemaElements.push(layout_1);
2024
+ if (jsonSchema.properties && keys__default["default"](jsonSchema.properties).length > 1) {
2025
+ addLabel(layout_1, schemaName);
2026
+ }
2027
+ if (!isEmpty__default["default"](jsonSchema.properties)) {
2028
+ var nextRef_1 = currentRef + '/properties';
2029
+ Object.keys(jsonSchema.properties).map(function (propName) {
2030
+ var value = jsonSchema.properties[propName];
2031
+ var ref = nextRef_1 + "/" + propName;
2032
+ if (value.$ref !== undefined) {
2033
+ value = resolveSchema(rootSchema, value.$ref);
2034
+ }
2035
+ generateUISchema(value, layout_1.elements, ref, propName, layoutType, rootSchema);
2036
+ });
2037
+ }
2038
+ return layout_1;
2039
+ }
2040
+ switch (types[0]) {
2041
+ case 'object':
2042
+ case 'array':
2043
+ case 'string':
2044
+ case 'number':
2045
+ case 'integer':
2046
+ case 'boolean':
2047
+ var controlObject = createControlElement(currentRef);
2048
+ schemaElements.push(controlObject);
2049
+ return controlObject;
2050
+ default:
2051
+ throw new Error('Unknown type: ' + JSON.stringify(jsonSchema));
2052
+ }
2053
+ };
2054
+ var generateDefaultUISchema = function (jsonSchema, layoutType, prefix, rootSchema) {
2055
+ if (layoutType === void 0) { layoutType = 'VerticalLayout'; }
2056
+ if (prefix === void 0) { prefix = '#'; }
2057
+ if (rootSchema === void 0) { rootSchema = jsonSchema; }
2058
+ return wrapInLayoutIfNecessary(generateUISchema(jsonSchema, [], prefix, '', layoutType, rootSchema), layoutType);
2059
+ };
2060
+
2061
+ var Generate = {
2062
+ jsonSchema: generateJsonSchema,
2063
+ uiSchema: generateDefaultUISchema,
2064
+ controlElement: createControlElement
2065
+ };
2066
+
2067
+ var INIT = 'jsonforms/INIT';
2068
+ var UPDATE_CORE = "jsonforms/UPDATE_CORE";
2069
+ var SET_AJV = 'jsonforms/SET_AJV';
2070
+ var UPDATE_DATA = 'jsonforms/UPDATE';
2071
+ var UPDATE_ERRORS = 'jsonforms/UPDATE_ERRORS';
2072
+ var VALIDATE = 'jsonforms/VALIDATE';
2073
+ var ADD_RENDERER = 'jsonforms/ADD_RENDERER';
2074
+ var REMOVE_RENDERER = 'jsonforms/REMOVE_RENDERER';
2075
+ var ADD_CELL = 'jsonforms/ADD_CELL';
2076
+ var REMOVE_CELL = 'jsonforms/REMOVE_CELL';
2077
+ var SET_CONFIG = 'jsonforms/SET_CONFIG';
2078
+ var ADD_UI_SCHEMA = "jsonforms/ADD_UI_SCHEMA";
2079
+ var REMOVE_UI_SCHEMA = "jsonforms/REMOVE_UI_SCHEMA";
2080
+ var SET_SCHEMA = "jsonforms/SET_SCHEMA";
2081
+ var SET_UISCHEMA = "jsonforms/SET_UISCHEMA";
2082
+ var SET_VALIDATION_MODE = 'jsonforms/SET_VALIDATION_MODE';
2083
+ var SET_LOCALE = "jsonforms/SET_LOCALE";
2084
+ var SET_TRANSLATOR = 'jsonforms/SET_TRANSLATOR';
2085
+ var UPDATE_I18N = 'jsonforms/UPDATE_I18N';
2086
+ var ADD_DEFAULT_DATA = "jsonforms/ADD_DEFAULT_DATA";
2087
+ var REMOVE_DEFAULT_DATA = "jsonforms/REMOVE_DEFAULT_DATA";
2088
+ var init = function (data, schema, uischema, options) {
2089
+ if (schema === void 0) { schema = generateJsonSchema(data); }
2090
+ return ({
2091
+ type: INIT,
2092
+ data: data,
2093
+ schema: schema,
2094
+ uischema: typeof uischema === 'object' ? uischema : generateDefaultUISchema(schema),
2095
+ options: options
2096
+ });
2097
+ };
2098
+ var updateCore = function (data, schema, uischema, options) { return ({
2099
+ type: UPDATE_CORE,
2100
+ data: data,
2101
+ schema: schema,
2102
+ uischema: uischema,
2103
+ options: options
2104
+ }); };
2105
+ var registerDefaultData = function (schemaPath, data) { return ({
2106
+ type: ADD_DEFAULT_DATA,
2107
+ schemaPath: schemaPath,
2108
+ data: data
2109
+ }); };
2110
+ var unregisterDefaultData = function (schemaPath) { return ({
2111
+ type: REMOVE_DEFAULT_DATA,
2112
+ schemaPath: schemaPath
2113
+ }); };
2114
+ var setAjv = function (ajv) { return ({
2115
+ type: SET_AJV,
2116
+ ajv: ajv
2117
+ }); };
2118
+ var update = function (path, updater) { return ({
2119
+ type: UPDATE_DATA,
2120
+ path: path,
2121
+ updater: updater
2122
+ }); };
2123
+ var updateErrors = function (errors) { return ({
2124
+ type: UPDATE_ERRORS,
2125
+ errors: errors
2126
+ }); };
2127
+ var registerRenderer = function (tester, renderer) { return ({
2128
+ type: ADD_RENDERER,
2129
+ tester: tester,
2130
+ renderer: renderer
2131
+ }); };
2132
+ var registerCell = function (tester, cell) { return ({
2133
+ type: ADD_CELL,
2134
+ tester: tester,
2135
+ cell: cell
2136
+ }); };
2137
+ var unregisterCell = function (tester, cell) { return ({
2138
+ type: REMOVE_CELL,
2139
+ tester: tester,
2140
+ cell: cell
2141
+ }); };
2142
+ var unregisterRenderer = function (tester, renderer) { return ({
2143
+ type: REMOVE_RENDERER,
2144
+ tester: tester,
2145
+ renderer: renderer
2146
+ }); };
2147
+ var setConfig = function (config) { return ({
2148
+ type: SET_CONFIG,
2149
+ config: config
2150
+ }); };
2151
+ var setValidationMode = function (validationMode) { return ({
2152
+ type: SET_VALIDATION_MODE,
2153
+ validationMode: validationMode
2154
+ }); };
2155
+ var registerUISchema = function (tester, uischema) {
2156
+ return {
2157
+ type: ADD_UI_SCHEMA,
2158
+ tester: tester,
2159
+ uischema: uischema
2160
+ };
2161
+ };
2162
+ var unregisterUISchema = function (tester) {
2163
+ return {
2164
+ type: REMOVE_UI_SCHEMA,
2165
+ tester: tester
2166
+ };
2167
+ };
2168
+ var setLocale = function (locale) { return ({
2169
+ type: SET_LOCALE,
2170
+ locale: locale
2171
+ }); };
2172
+ var setSchema = function (schema) { return ({
2173
+ type: SET_SCHEMA,
2174
+ schema: schema
2175
+ }); };
2176
+ var setTranslator = function (translator, errorTranslator) { return ({
2177
+ type: SET_TRANSLATOR,
2178
+ translator: translator,
2179
+ errorTranslator: errorTranslator
2180
+ }); };
2181
+ var updateI18n = function (locale, translator, errorTranslator) { return ({
2182
+ type: UPDATE_I18N,
2183
+ locale: locale,
2184
+ translator: translator,
2185
+ errorTranslator: errorTranslator
2186
+ }); };
2187
+ var setUISchema = function (uischema) { return ({
2188
+ type: SET_UISCHEMA,
2189
+ uischema: uischema
2190
+ }); };
2191
+
2192
+ var index = /*#__PURE__*/Object.freeze({
2193
+ __proto__: null,
2194
+ INIT: INIT,
2195
+ UPDATE_CORE: UPDATE_CORE,
2196
+ SET_AJV: SET_AJV,
2197
+ UPDATE_DATA: UPDATE_DATA,
2198
+ UPDATE_ERRORS: UPDATE_ERRORS,
2199
+ VALIDATE: VALIDATE,
2200
+ ADD_RENDERER: ADD_RENDERER,
2201
+ REMOVE_RENDERER: REMOVE_RENDERER,
2202
+ ADD_CELL: ADD_CELL,
2203
+ REMOVE_CELL: REMOVE_CELL,
2204
+ SET_CONFIG: SET_CONFIG,
2205
+ ADD_UI_SCHEMA: ADD_UI_SCHEMA,
2206
+ REMOVE_UI_SCHEMA: REMOVE_UI_SCHEMA,
2207
+ SET_SCHEMA: SET_SCHEMA,
2208
+ SET_UISCHEMA: SET_UISCHEMA,
2209
+ SET_VALIDATION_MODE: SET_VALIDATION_MODE,
2210
+ SET_LOCALE: SET_LOCALE,
2211
+ SET_TRANSLATOR: SET_TRANSLATOR,
2212
+ UPDATE_I18N: UPDATE_I18N,
2213
+ ADD_DEFAULT_DATA: ADD_DEFAULT_DATA,
2214
+ REMOVE_DEFAULT_DATA: REMOVE_DEFAULT_DATA,
2215
+ init: init,
2216
+ updateCore: updateCore,
2217
+ registerDefaultData: registerDefaultData,
2218
+ unregisterDefaultData: unregisterDefaultData,
2219
+ setAjv: setAjv,
2220
+ update: update,
2221
+ updateErrors: updateErrors,
2222
+ registerRenderer: registerRenderer,
2223
+ registerCell: registerCell,
2224
+ unregisterCell: unregisterCell,
2225
+ unregisterRenderer: unregisterRenderer,
2226
+ setConfig: setConfig,
2227
+ setValidationMode: setValidationMode,
2228
+ registerUISchema: registerUISchema,
2229
+ unregisterUISchema: unregisterUISchema,
2230
+ setLocale: setLocale,
2231
+ setSchema: setSchema,
2232
+ setTranslator: setTranslator,
2233
+ updateI18n: updateI18n,
2234
+ setUISchema: setUISchema
2235
+ });
2236
+
2237
+ var Helpers = {
2238
+ createLabelDescriptionFrom: createLabelDescriptionFrom,
2239
+ convertToValidClassName: convertToValidClassName
2240
+ };
2241
+
2242
+ exports.ADD_CELL = ADD_CELL;
2243
+ exports.ADD_DEFAULT_DATA = ADD_DEFAULT_DATA;
2244
+ exports.ADD_RENDERER = ADD_RENDERER;
2245
+ exports.ADD_UI_SCHEMA = ADD_UI_SCHEMA;
2246
+ exports.Actions = index;
2247
+ exports.Draft4 = Draft4;
2248
+ exports.Generate = Generate;
2249
+ exports.Helpers = Helpers;
2250
+ exports.INIT = INIT;
2251
+ exports.NOT_APPLICABLE = NOT_APPLICABLE;
2252
+ exports.Paths = Paths;
2253
+ exports.REMOVE_CELL = REMOVE_CELL;
2254
+ exports.REMOVE_DEFAULT_DATA = REMOVE_DEFAULT_DATA;
2255
+ exports.REMOVE_RENDERER = REMOVE_RENDERER;
2256
+ exports.REMOVE_UI_SCHEMA = REMOVE_UI_SCHEMA;
2257
+ exports.Resolve = Resolve;
2258
+ exports.Runtime = Runtime;
2259
+ exports.SET_AJV = SET_AJV;
2260
+ exports.SET_CONFIG = SET_CONFIG;
2261
+ exports.SET_LOCALE = SET_LOCALE;
2262
+ exports.SET_SCHEMA = SET_SCHEMA;
2263
+ exports.SET_TRANSLATOR = SET_TRANSLATOR;
2264
+ exports.SET_UISCHEMA = SET_UISCHEMA;
2265
+ exports.SET_VALIDATION_MODE = SET_VALIDATION_MODE;
2266
+ exports.Test = index$1;
2267
+ exports.UPDATE_CORE = UPDATE_CORE;
2268
+ exports.UPDATE_DATA = UPDATE_DATA;
2269
+ exports.UPDATE_ERRORS = UPDATE_ERRORS;
2270
+ exports.UPDATE_I18N = UPDATE_I18N;
2271
+ exports.VALIDATE = VALIDATE;
2272
+ exports.and = and;
2273
+ exports.categorizationHasCategory = categorizationHasCategory;
2274
+ exports.cellReducer = cellReducer;
2275
+ exports.clearAllIds = clearAllIds;
2276
+ exports.compose = compose;
2277
+ exports.composePaths = compose;
2278
+ exports.composeWithUi = composeWithUi;
2279
+ exports.computeLabel = computeLabel;
2280
+ exports.configReducer = configReducer;
2281
+ exports.controlDefaultProps = controlDefaultProps;
2282
+ exports.convertToValidClassName = convertToValidClassName;
2283
+ exports.coreReducer = coreReducer;
2284
+ exports.createAjv = createAjv;
2285
+ exports.createCleanLabel = createCleanLabel;
2286
+ exports.createCombinatorRenderInfos = createCombinatorRenderInfos;
2287
+ exports.createControlElement = createControlElement;
2288
+ exports.createDefaultValue = createDefaultValue;
2289
+ exports.createId = createId;
2290
+ exports.createLabelDescriptionFrom = createLabelDescriptionFrom;
2291
+ exports.defaultDataReducer = defaultDataReducer;
2292
+ exports.defaultErrorTranslator = defaultErrorTranslator;
2293
+ exports.defaultJsonFormsI18nState = defaultJsonFormsI18nState;
2294
+ exports.defaultMapDispatchToControlProps = defaultMapDispatchToControlProps;
2295
+ exports.defaultMapStateToEnumCellProps = defaultMapStateToEnumCellProps;
2296
+ exports.defaultTranslator = defaultTranslator;
2297
+ exports.deriveTypes = deriveTypes;
2298
+ exports.enumToEnumOptionMapper = enumToEnumOptionMapper;
2299
+ exports.errorAt = errorAt;
2300
+ exports.errorsAt = errorsAt;
2301
+ exports.evalEnablement = evalEnablement;
2302
+ exports.evalVisibility = evalVisibility;
2303
+ exports.extractAjv = extractAjv;
2304
+ exports.extractData = extractData;
2305
+ exports.extractDefaultData = extractDefaultData;
2306
+ exports.extractSchema = extractSchema;
2307
+ exports.extractUiSchema = extractUiSchema;
2308
+ exports.fetchErrorTranslator = fetchErrorTranslator;
2309
+ exports.fetchLocale = fetchLocale;
2310
+ exports.fetchTranslator = fetchTranslator;
2311
+ exports.findAllRefs = findAllRefs;
2312
+ exports.findMatchingUISchema = findMatchingUISchema;
2313
+ exports.findUISchema = findUISchema;
2314
+ exports.formatErrorMessage = formatErrorMessage;
2315
+ exports.formatIs = formatIs;
2316
+ exports.generateDefaultUISchema = generateDefaultUISchema;
2317
+ exports.generateJsonSchema = generateJsonSchema;
2318
+ exports.getAjv = getAjv;
2319
+ exports.getCells = getCells;
2320
+ exports.getCombinedErrorMessage = getCombinedErrorMessage;
2321
+ exports.getConfig = getConfig;
2322
+ exports.getControlPath = getControlPath;
2323
+ exports.getData = getData;
2324
+ exports.getDefaultData = getDefaultData;
2325
+ exports.getErrorAt = getErrorAt;
2326
+ exports.getErrorTranslator = getErrorTranslator;
2327
+ exports.getFirstPrimitiveProp = getFirstPrimitiveProp;
2328
+ exports.getI18nKey = getI18nKey;
2329
+ exports.getI18nKeyPrefix = getI18nKeyPrefix;
2330
+ exports.getI18nKeyPrefixBySchema = getI18nKeyPrefixBySchema;
2331
+ exports.getLocale = getLocale;
2332
+ exports.getRenderers = getRenderers;
2333
+ exports.getSchema = getSchema;
2334
+ exports.getSubErrorsAt = getSubErrorsAt;
2335
+ exports.getTranslator = getTranslator;
2336
+ exports.getUISchemas = getUISchemas;
2337
+ exports.getUiSchema = getUiSchema;
2338
+ exports.hasCategory = hasCategory;
2339
+ exports.hasEnableRule = hasEnableRule;
2340
+ exports.hasShowRule = hasShowRule;
2341
+ exports.hasType = hasType;
2342
+ exports.i18nReducer = i18nReducer;
2343
+ exports.init = init;
2344
+ exports.isAllOfControl = isAllOfControl;
2345
+ exports.isAnyOfControl = isAnyOfControl;
2346
+ exports.isArrayObjectControl = isArrayObjectControl;
2347
+ exports.isBooleanControl = isBooleanControl;
2348
+ exports.isCategorization = isCategorization;
2349
+ exports.isCategory = isCategory;
2350
+ exports.isControl = isControl;
2351
+ exports.isDateControl = isDateControl;
2352
+ exports.isDateTimeControl = isDateTimeControl;
2353
+ exports.isDescriptionHidden = isDescriptionHidden;
2354
+ exports.isEnabled = isEnabled;
2355
+ exports.isEnumControl = isEnumControl;
2356
+ exports.isGroup = isGroup;
2357
+ exports.isInherentlyEnabled = isInherentlyEnabled;
2358
+ exports.isIntegerControl = isIntegerControl;
2359
+ exports.isLayout = isLayout;
2360
+ exports.isMultiLineControl = isMultiLineControl;
2361
+ exports.isNumberControl = isNumberControl;
2362
+ exports.isNumberFormatControl = isNumberFormatControl;
2363
+ exports.isObjectArray = isObjectArray;
2364
+ exports.isObjectArrayControl = isObjectArrayControl;
2365
+ exports.isObjectArrayWithNesting = isObjectArrayWithNesting;
2366
+ exports.isObjectControl = isObjectControl;
2367
+ exports.isOneOfControl = isOneOfControl;
2368
+ exports.isOneOfEnumControl = isOneOfEnumControl;
2369
+ exports.isPrimitiveArrayControl = isPrimitiveArrayControl;
2370
+ exports.isRangeControl = isRangeControl;
2371
+ exports.isStringControl = isStringControl;
2372
+ exports.isTimeControl = isTimeControl;
2373
+ exports.isVisible = isVisible;
2374
+ exports.iterateSchema = iterateSchema;
2375
+ exports.jsonFormsReducerConfig = jsonFormsReducerConfig;
2376
+ exports.layoutDefaultProps = layoutDefaultProps;
2377
+ exports.mapDispatchToArrayControlProps = mapDispatchToArrayControlProps;
2378
+ exports.mapDispatchToCellProps = mapDispatchToCellProps;
2379
+ exports.mapDispatchToControlProps = mapDispatchToControlProps;
2380
+ exports.mapDispatchToMultiEnumProps = mapDispatchToMultiEnumProps;
2381
+ exports.mapStateToAllOfProps = mapStateToAllOfProps;
2382
+ exports.mapStateToAnyOfProps = mapStateToAnyOfProps;
2383
+ exports.mapStateToArrayControlProps = mapStateToArrayControlProps;
2384
+ exports.mapStateToArrayLayoutProps = mapStateToArrayLayoutProps;
2385
+ exports.mapStateToCellProps = mapStateToCellProps;
2386
+ exports.mapStateToCombinatorRendererProps = mapStateToCombinatorRendererProps;
2387
+ exports.mapStateToControlProps = mapStateToControlProps;
2388
+ exports.mapStateToControlWithDetailProps = mapStateToControlWithDetailProps;
2389
+ exports.mapStateToDispatchCellProps = mapStateToDispatchCellProps;
2390
+ exports.mapStateToEnumControlProps = mapStateToEnumControlProps;
2391
+ exports.mapStateToJsonFormsRendererProps = mapStateToJsonFormsRendererProps;
2392
+ exports.mapStateToLayoutProps = mapStateToLayoutProps;
2393
+ exports.mapStateToMasterListItemProps = mapStateToMasterListItemProps;
2394
+ exports.mapStateToMultiEnumControlProps = mapStateToMultiEnumControlProps;
2395
+ exports.mapStateToOneOfEnumCellProps = mapStateToOneOfEnumCellProps;
2396
+ exports.mapStateToOneOfEnumControlProps = mapStateToOneOfEnumControlProps;
2397
+ exports.mapStateToOneOfProps = mapStateToOneOfProps;
2398
+ exports.moveDown = moveDown;
2399
+ exports.moveUp = moveUp;
2400
+ exports.not = not;
2401
+ exports.oneOfToEnumOptionMapper = oneOfToEnumOptionMapper;
2402
+ exports.optionIs = optionIs;
2403
+ exports.or = or;
2404
+ exports.rankWith = rankWith;
2405
+ exports.registerCell = registerCell;
2406
+ exports.registerDefaultData = registerDefaultData;
2407
+ exports.registerRenderer = registerRenderer;
2408
+ exports.registerUISchema = registerUISchema;
2409
+ exports.removeId = removeId;
2410
+ exports.rendererReducer = rendererReducer;
2411
+ exports.resolveData = resolveData;
2412
+ exports.resolveSchema = resolveSchema;
2413
+ exports.resolveSubSchemas = resolveSubSchemas;
2414
+ exports.schemaMatches = schemaMatches;
2415
+ exports.schemaSubPathMatches = schemaSubPathMatches;
2416
+ exports.schemaTypeIs = schemaTypeIs;
2417
+ exports.scopeEndIs = scopeEndIs;
2418
+ exports.scopeEndsWith = scopeEndsWith;
2419
+ exports.setAjv = setAjv;
2420
+ exports.setConfig = setConfig;
2421
+ exports.setLocale = setLocale;
2422
+ exports.setReadonly = setReadonly;
2423
+ exports.setSchema = setSchema;
2424
+ exports.setTranslator = setTranslator;
2425
+ exports.setUISchema = setUISchema;
2426
+ exports.setValidationMode = setValidationMode;
2427
+ exports.showAsRequired = showAsRequired;
2428
+ exports.subErrorsAt = subErrorsAt;
2429
+ exports.toDataPath = toDataPath;
2430
+ exports.toDataPathSegments = toDataPathSegments;
2431
+ exports.transformPathToI18nPrefix = transformPathToI18nPrefix;
2432
+ exports.uiTypeIs = uiTypeIs;
2433
+ exports.uischemaRegistryReducer = uischemaRegistryReducer;
2434
+ exports.unregisterCell = unregisterCell;
2435
+ exports.unregisterDefaultData = unregisterDefaultData;
2436
+ exports.unregisterRenderer = unregisterRenderer;
2437
+ exports.unregisterUISchema = unregisterUISchema;
2438
+ exports.unsetReadonly = unsetReadonly;
2439
+ exports.update = update;
2440
+ exports.updateCore = updateCore;
2441
+ exports.updateErrors = updateErrors;
2442
+ exports.updateI18n = updateI18n;
2443
+ exports.validate = validate;
2444
+ exports.withIncreasedRank = withIncreasedRank;
2445
+ //# sourceMappingURL=jsonforms-core.cjs.js.map