@jsonforms/core 2.5.2-alpha.0 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +1 -1
  2. package/docs/assets/js/search.json +1 -1
  3. package/docs/enums/ruleeffect.html +4 -4
  4. package/docs/globals.html +1061 -1120
  5. package/docs/index.html +64 -91
  6. package/docs/interfaces/addcellrendereraction.html +3 -3
  7. package/docs/interfaces/addrendereraction.html +3 -3
  8. package/docs/interfaces/adduischemaaction.html +3 -3
  9. package/docs/interfaces/andcondition.html +2 -2
  10. package/docs/interfaces/arraycontrolprops.html +22 -22
  11. package/docs/interfaces/arraylayoutprops.html +22 -22
  12. package/docs/interfaces/categorization.html +5 -5
  13. package/docs/interfaces/category.html +5 -5
  14. package/docs/interfaces/cellprops.html +14 -14
  15. package/docs/interfaces/combinatorrendererprops.html +13 -13
  16. package/docs/interfaces/combinatorsubschemarenderinfo.html +3 -3
  17. package/docs/interfaces/composablecondition.html +2 -2
  18. package/docs/interfaces/condition.html +1 -1
  19. package/docs/interfaces/controlelement.html +5 -5
  20. package/docs/interfaces/controlprops.html +17 -17
  21. package/docs/interfaces/controlstate.html +2 -2
  22. package/docs/interfaces/controlwithdetailprops.html +18 -18
  23. package/docs/interfaces/dispatchcellprops.html +13 -13
  24. package/docs/interfaces/dispatchcellstateprops.html +13 -13
  25. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  26. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  27. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  28. package/docs/interfaces/enumcellprops.html +15 -15
  29. package/docs/interfaces/enumoption.html +2 -2
  30. package/docs/interfaces/formatted.html +2 -2
  31. package/docs/interfaces/grouplayout.html +5 -5
  32. package/docs/interfaces/horizontallayout.html +4 -4
  33. package/docs/interfaces/initaction.html +6 -6
  34. package/docs/interfaces/initactionoptions.html +3 -17
  35. package/docs/interfaces/jsonformscellrendererregistryentry.html +2 -2
  36. package/docs/interfaces/jsonformscore.html +7 -21
  37. package/docs/interfaces/jsonformsdefaultdataregistryentry.html +2 -2
  38. package/docs/interfaces/jsonformsextendedstate.html +1 -1
  39. package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
  40. package/docs/interfaces/jsonformsprops.html +9 -24
  41. package/docs/interfaces/jsonformsrendererregistryentry.html +2 -2
  42. package/docs/interfaces/jsonformsstate.html +1 -1
  43. package/docs/interfaces/jsonformsstore.html +5 -5
  44. package/docs/interfaces/jsonformssubstates.html +18 -8
  45. package/docs/interfaces/jsonformsuischemaregistryentry.html +2 -2
  46. package/docs/interfaces/labeldescription.html +2 -2
  47. package/docs/interfaces/labelelement.html +4 -4
  48. package/docs/interfaces/layout.html +4 -4
  49. package/docs/interfaces/layoutprops.html +10 -10
  50. package/docs/interfaces/leafcondition.html +3 -3
  51. package/docs/interfaces/orcondition.html +2 -2
  52. package/docs/interfaces/ownpropsofcell.html +10 -10
  53. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  54. package/docs/interfaces/ownpropsofenum.html +1 -1
  55. package/docs/interfaces/ownpropsofenumcell.html +11 -11
  56. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  57. package/docs/interfaces/ownpropsoflayout.html +9 -9
  58. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  59. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  60. package/docs/interfaces/registerdefaultdataaction.html +3 -3
  61. package/docs/interfaces/removecellrendereraction.html +3 -3
  62. package/docs/interfaces/removerendereraction.html +3 -3
  63. package/docs/interfaces/removeuischemaaction.html +2 -2
  64. package/docs/interfaces/rendererprops.html +9 -9
  65. package/docs/interfaces/rule.html +2 -2
  66. package/docs/interfaces/schemabasedcondition.html +3 -3
  67. package/docs/interfaces/scopable.html +1 -1
  68. package/docs/interfaces/setajvaction.html +3 -3
  69. package/docs/interfaces/setconfigaction.html +2 -2
  70. package/docs/interfaces/setlocaleaction.html +3 -3
  71. package/docs/interfaces/setschemaaction.html +2 -2
  72. package/docs/interfaces/{setlocalizeduischemasaction.html → settranslatoraction.html} +29 -15
  73. package/docs/interfaces/setuischemaaction.html +2 -2
  74. package/docs/interfaces/setvalidationmodeaction.html +2 -2
  75. package/docs/interfaces/statepropsofarraycontrol.html +18 -18
  76. package/docs/interfaces/statepropsofarraylayout.html +18 -18
  77. package/docs/interfaces/statepropsofcell.html +13 -13
  78. package/docs/interfaces/statepropsofcombinator.html +12 -12
  79. package/docs/interfaces/statepropsofcontrol.html +16 -16
  80. package/docs/interfaces/statepropsofcontrolwithdetail.html +17 -17
  81. package/docs/interfaces/statepropsofenumcell.html +14 -14
  82. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -23
  83. package/docs/interfaces/statepropsoflayout.html +10 -10
  84. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  85. package/docs/interfaces/statepropsofrenderer.html +9 -9
  86. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  87. package/docs/interfaces/uischemaelement.html +3 -3
  88. package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
  89. package/docs/interfaces/updateaction.html +3 -3
  90. package/docs/interfaces/updatecoreaction.html +6 -6
  91. package/docs/interfaces/updateerrorsaction.html +2 -2
  92. package/docs/interfaces/{setlocalizedschemasaction.html → updatei18naction.html} +43 -15
  93. package/docs/interfaces/verticallayout.html +4 -4
  94. package/docs/interfaces/withclassname.html +1 -1
  95. package/lib/Helpers.d.ts +5 -0
  96. package/lib/Helpers.js +33 -0
  97. package/lib/Helpers.js.map +1 -0
  98. package/lib/actions/actions.d.ts +181 -0
  99. package/lib/actions/actions.js +173 -0
  100. package/lib/actions/actions.js.map +1 -0
  101. package/lib/actions/index.d.ts +1 -180
  102. package/lib/actions/index.js +26 -122
  103. package/lib/actions/index.js.map +1 -1
  104. package/lib/configDefault.js +2 -1
  105. package/lib/configDefault.js.map +1 -1
  106. package/lib/generators/Generate.d.ts +6 -0
  107. package/lib/generators/Generate.js +35 -0
  108. package/lib/generators/Generate.js.map +1 -0
  109. package/lib/generators/index.d.ts +3 -10
  110. package/lib/generators/index.js +28 -9
  111. package/lib/generators/index.js.map +1 -1
  112. package/lib/generators/schema.d.ts +1 -1
  113. package/lib/generators/schema.js +3 -1
  114. package/lib/generators/schema.js.map +1 -1
  115. package/lib/generators/uischema.d.ts +1 -2
  116. package/lib/generators/uischema.js +12 -10
  117. package/lib/generators/uischema.js.map +1 -1
  118. package/lib/i18n/i18nTypes.d.ts +15 -0
  119. package/lib/i18n/i18nTypes.js +3 -0
  120. package/lib/i18n/i18nTypes.js.map +1 -0
  121. package/lib/i18n/i18nUtil.d.ts +11 -0
  122. package/lib/i18n/i18nUtil.js +58 -0
  123. package/lib/i18n/i18nUtil.js.map +1 -0
  124. package/lib/i18n/index.d.ts +2 -0
  125. package/lib/i18n/index.js +6 -0
  126. package/lib/i18n/index.js.map +1 -0
  127. package/lib/index.d.ts +6 -18
  128. package/lib/index.js +10 -15
  129. package/lib/index.js.map +1 -1
  130. package/lib/jsonforms-core.js +9 -12
  131. package/lib/jsonforms-core.js.map +1 -1
  132. package/lib/models/draft4.js +2 -1
  133. package/lib/models/draft4.js.map +1 -1
  134. package/lib/models/index.d.ts +5 -0
  135. package/lib/models/index.js +33 -0
  136. package/lib/models/index.js.map +1 -0
  137. package/lib/models/jsonSchema.js +24 -0
  138. package/lib/models/jsonSchema.js.map +1 -1
  139. package/lib/models/uischema.js +29 -2
  140. package/lib/models/uischema.js.map +1 -1
  141. package/lib/reducers/cells.d.ts +1 -1
  142. package/lib/reducers/cells.js +27 -1
  143. package/lib/reducers/cells.js.map +1 -1
  144. package/lib/reducers/config.d.ts +1 -1
  145. package/lib/reducers/config.js +5 -3
  146. package/lib/reducers/config.js.map +1 -1
  147. package/lib/reducers/core.d.ts +5 -7
  148. package/lib/reducers/core.js +78 -63
  149. package/lib/reducers/core.js.map +1 -1
  150. package/lib/reducers/default-data.d.ts +1 -1
  151. package/lib/reducers/default-data.js +6 -3
  152. package/lib/reducers/default-data.js.map +1 -1
  153. package/lib/reducers/i18n.d.ts +8 -11
  154. package/lib/reducers/i18n.js +40 -23
  155. package/lib/reducers/i18n.js.map +1 -1
  156. package/lib/reducers/index.d.ts +9 -49
  157. package/lib/reducers/index.js +33 -91
  158. package/lib/reducers/index.js.map +1 -1
  159. package/lib/reducers/reducers.d.ts +37 -0
  160. package/lib/reducers/reducers.js +107 -0
  161. package/lib/reducers/reducers.js.map +1 -0
  162. package/lib/reducers/renderers.d.ts +1 -1
  163. package/lib/reducers/renderers.js +27 -1
  164. package/lib/reducers/renderers.js.map +1 -1
  165. package/lib/reducers/selectors.d.ts +15 -0
  166. package/lib/reducers/selectors.js +56 -0
  167. package/lib/reducers/selectors.js.map +1 -0
  168. package/lib/reducers/uischemas.d.ts +2 -2
  169. package/lib/reducers/uischemas.js +9 -6
  170. package/lib/reducers/uischemas.js.map +1 -1
  171. package/lib/store.d.ts +5 -8
  172. package/lib/store.js +24 -0
  173. package/lib/store.js.map +1 -1
  174. package/lib/testers/index.d.ts +1 -204
  175. package/lib/testers/index.js +3 -376
  176. package/lib/testers/index.js.map +1 -1
  177. package/lib/testers/testers.d.ts +203 -0
  178. package/lib/testers/testers.js +421 -0
  179. package/lib/testers/testers.js.map +1 -0
  180. package/lib/util/Formatted.js +24 -0
  181. package/lib/util/Formatted.js.map +1 -1
  182. package/lib/util/array.js +25 -0
  183. package/lib/util/array.js.map +1 -1
  184. package/lib/util/cell.d.ts +11 -4
  185. package/lib/util/cell.js +61 -17
  186. package/lib/util/cell.js.map +1 -1
  187. package/lib/util/combinators.d.ts +2 -3
  188. package/lib/util/combinators.js +5 -2
  189. package/lib/util/combinators.js.map +1 -1
  190. package/lib/util/ids.js +8 -4
  191. package/lib/util/ids.js.map +1 -1
  192. package/lib/util/index.d.ts +11 -45
  193. package/lib/util/index.js +14 -104
  194. package/lib/util/index.js.map +1 -1
  195. package/lib/util/label.d.ts +1 -2
  196. package/lib/util/label.js +7 -4
  197. package/lib/util/label.js.map +1 -1
  198. package/lib/util/path.d.ts +2 -1
  199. package/lib/util/path.js +12 -6
  200. package/lib/util/path.js.map +1 -1
  201. package/lib/util/renderer.d.ts +17 -17
  202. package/lib/util/renderer.js +163 -76
  203. package/lib/util/renderer.js.map +1 -1
  204. package/lib/util/resolvers.d.ts +1 -14
  205. package/lib/util/resolvers.js +9 -215
  206. package/lib/util/resolvers.js.map +1 -1
  207. package/lib/util/runtime.d.ts +12 -2
  208. package/lib/util/runtime.js +59 -17
  209. package/lib/util/runtime.js.map +1 -1
  210. package/lib/util/schema.js +27 -1
  211. package/lib/util/schema.js.map +1 -1
  212. package/lib/util/uischema.d.ts +1 -1
  213. package/lib/util/uischema.js +11 -7
  214. package/lib/util/uischema.js.map +1 -1
  215. package/lib/util/util.d.ts +31 -0
  216. package/lib/util/util.js +112 -0
  217. package/lib/util/util.js.map +1 -0
  218. package/lib/util/validator.d.ts +3 -2
  219. package/lib/util/validator.js +6 -5
  220. package/lib/util/validator.js.map +1 -1
  221. package/package.json +7 -9
  222. package/src/Helpers.ts +38 -0
  223. package/src/actions/actions.ts +345 -0
  224. package/src/actions/index.ts +1 -312
  225. package/src/configDefault.ts +1 -0
  226. package/src/generators/Generate.ts +43 -0
  227. package/src/generators/index.ts +3 -21
  228. package/src/generators/schema.ts +1 -1
  229. package/src/generators/uischema.ts +4 -4
  230. package/src/i18n/i18nTypes.ts +17 -0
  231. package/src/i18n/i18nUtil.ts +76 -0
  232. package/src/i18n/index.ts +2 -0
  233. package/src/index.ts +7 -31
  234. package/src/models/draft4.ts +1 -0
  235. package/src/models/index.ts +30 -0
  236. package/src/models/jsonSchema.ts +1 -0
  237. package/src/models/uischema.ts +1 -0
  238. package/src/reducers/cells.ts +2 -1
  239. package/src/reducers/config.ts +2 -1
  240. package/src/reducers/core.ts +74 -81
  241. package/src/reducers/default-data.ts +2 -1
  242. package/src/reducers/i18n.ts +42 -35
  243. package/src/reducers/index.ts +9 -158
  244. package/src/reducers/reducers.ts +148 -0
  245. package/src/reducers/renderers.ts +2 -1
  246. package/src/reducers/selectors.ts +65 -0
  247. package/src/reducers/uischemas.ts +4 -2
  248. package/src/store.ts +11 -8
  249. package/src/testers/index.ts +1 -516
  250. package/src/testers/testers.ts +547 -0
  251. package/src/util/Formatted.ts +1 -0
  252. package/src/util/array.ts +25 -0
  253. package/src/util/cell.ts +91 -19
  254. package/src/util/combinators.ts +2 -4
  255. package/src/util/ids.ts +1 -0
  256. package/src/util/index.ts +11 -126
  257. package/src/util/label.ts +2 -2
  258. package/src/util/path.ts +4 -1
  259. package/src/util/renderer.ts +168 -85
  260. package/src/util/resolvers.ts +2 -261
  261. package/src/util/runtime.ts +46 -2
  262. package/src/util/schema.ts +26 -1
  263. package/src/util/uischema.ts +2 -1
  264. package/src/util/util.ts +127 -0
  265. package/src/util/validator.ts +5 -8
  266. package/test/reducers/core.test.ts +31 -223
  267. package/test/util/cell.test.ts +33 -2
  268. package/test/util/renderer.test.ts +483 -3
  269. package/test/util/resolvers.test.ts +1 -59
  270. package/test/util/runtime.test.ts +264 -4
  271. package/docs/interfaces/labels.html +0 -157
  272. package/docs/interfaces/schemaref.html +0 -160
  273. package/docs/interfaces/schemarefs.html +0 -138
@@ -0,0 +1,421 @@
1
+ "use strict";
2
+ /*
3
+ The MIT License
4
+
5
+ Copyright (c) 2017-2019 EclipseSource Munich
6
+ https://github.com/eclipsesource/jsonforms
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.not = exports.categorizationHasCategory = exports.hasCategory = exports.isCategory = exports.isCategorization = exports.isNumberFormatControl = exports.isRangeControl = exports.isPrimitiveArrayControl = exports.isArrayObjectControl = exports.isObjectArrayWithNesting = exports.isObjectArrayControl = exports.isObjectArray = exports.isDateTimeControl = exports.isTimeControl = exports.isDateControl = exports.isMultiLineControl = exports.isStringControl = exports.isNumberControl = exports.isIntegerControl = exports.isOneOfEnumControl = exports.isEnumControl = exports.isOneOfControl = exports.isAnyOfControl = exports.isAllOfControl = exports.isObjectControl = exports.isBooleanControl = exports.withIncreasedRank = exports.rankWith = exports.or = exports.and = exports.scopeEndIs = exports.scopeEndsWith = exports.optionIs = exports.uiTypeIs = exports.formatIs = exports.schemaTypeIs = exports.schemaSubPathMatches = exports.schemaMatches = exports.isControl = exports.NOT_APPLICABLE = void 0;
28
+ var tslib_1 = require("tslib");
29
+ var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
30
+ var get_1 = tslib_1.__importDefault(require("lodash/get"));
31
+ var endsWith_1 = tslib_1.__importDefault(require("lodash/endsWith"));
32
+ var last_1 = tslib_1.__importDefault(require("lodash/last"));
33
+ var isArray_1 = tslib_1.__importDefault(require("lodash/isArray"));
34
+ var reduce_1 = tslib_1.__importDefault(require("lodash/reduce"));
35
+ var toPairs_1 = tslib_1.__importDefault(require("lodash/toPairs"));
36
+ var includes_1 = tslib_1.__importDefault(require("lodash/includes"));
37
+ var util_1 = require("../util");
38
+ /**
39
+ * Constant that indicates that a tester is not capable of handling
40
+ * a combination of schema/data.
41
+ * @type {number}
42
+ */
43
+ exports.NOT_APPLICABLE = -1;
44
+ var isControl = function (uischema) {
45
+ return !isEmpty_1.default(uischema) && uischema.scope !== undefined;
46
+ };
47
+ exports.isControl = isControl;
48
+ /**
49
+ * Only applicable for Controls.
50
+ *
51
+ * This function checks whether the given UI schema is of type Control
52
+ * and if so, resolves the sub-schema referenced by the control and applies
53
+ * the given predicate
54
+ *
55
+ * @param {(JsonSchema) => boolean} predicate the predicate that should be
56
+ * applied to the resolved sub-schema
57
+ */
58
+ var schemaMatches = function (predicate) { return function (uischema, schema) {
59
+ if (isEmpty_1.default(uischema) || !exports.isControl(uischema)) {
60
+ return false;
61
+ }
62
+ if (isEmpty_1.default(schema)) {
63
+ return false;
64
+ }
65
+ var schemaPath = uischema.scope;
66
+ if (isEmpty_1.default(schemaPath)) {
67
+ return false;
68
+ }
69
+ var currentDataSchema = schema;
70
+ if (util_1.hasType(schema, 'object')) {
71
+ currentDataSchema = util_1.resolveSchema(schema, schemaPath);
72
+ }
73
+ if (currentDataSchema === undefined) {
74
+ return false;
75
+ }
76
+ return predicate(currentDataSchema);
77
+ }; };
78
+ exports.schemaMatches = schemaMatches;
79
+ var schemaSubPathMatches = function (subPath, predicate) { return function (uischema, schema) {
80
+ if (isEmpty_1.default(uischema) || !exports.isControl(uischema)) {
81
+ return false;
82
+ }
83
+ var schemaPath = uischema.scope;
84
+ var currentDataSchema = schema;
85
+ if (util_1.hasType(schema, 'object')) {
86
+ currentDataSchema = util_1.resolveSchema(schema, schemaPath);
87
+ }
88
+ currentDataSchema = get_1.default(currentDataSchema, subPath);
89
+ if (currentDataSchema === undefined) {
90
+ return false;
91
+ }
92
+ return predicate(currentDataSchema);
93
+ }; };
94
+ exports.schemaSubPathMatches = schemaSubPathMatches;
95
+ /**
96
+ * Only applicable for Controls.
97
+ *
98
+ * This function checks whether the given UI schema is of type Control
99
+ * and if so, resolves the sub-schema referenced by the control and checks
100
+ * whether the type of the sub-schema matches the expected one.
101
+ *
102
+ * @param {string} expectedType the expected type of the resolved sub-schema
103
+ */
104
+ var schemaTypeIs = function (expectedType) {
105
+ return exports.schemaMatches(function (schema) { return !isEmpty_1.default(schema) && util_1.hasType(schema, expectedType); });
106
+ };
107
+ exports.schemaTypeIs = schemaTypeIs;
108
+ /**
109
+ * Only applicable for Controls.
110
+ *
111
+ * This function checks whether the given UI schema is of type Control
112
+ * and if so, resolves the sub-schema referenced by the control and checks
113
+ * whether the format of the sub-schema matches the expected one.
114
+ *
115
+ * @param {string} expectedFormat the expected format of the resolved sub-schema
116
+ */
117
+ var formatIs = function (expectedFormat) {
118
+ return exports.schemaMatches(function (schema) {
119
+ return !isEmpty_1.default(schema) &&
120
+ schema.format === expectedFormat &&
121
+ schema.type === 'string';
122
+ });
123
+ };
124
+ exports.formatIs = formatIs;
125
+ /**
126
+ * Checks whether the given UI schema has the expected type.
127
+ *
128
+ * @param {string} expected the expected UI schema type
129
+ */
130
+ var uiTypeIs = function (expected) { return function (uischema) { return !isEmpty_1.default(uischema) && uischema.type === expected; }; };
131
+ exports.uiTypeIs = uiTypeIs;
132
+ /**
133
+ * Checks whether the given UI schema has an option with the given
134
+ * name and whether it has the expected value. If no options property
135
+ * is set, returns false.
136
+ *
137
+ * @param {string} optionName the name of the option to check
138
+ * @param {any} optionValue the expected value of the option
139
+ */
140
+ var optionIs = function (optionName, optionValue) { return function (uischema) {
141
+ if (isEmpty_1.default(uischema)) {
142
+ return false;
143
+ }
144
+ var options = uischema.options;
145
+ return !isEmpty_1.default(options) && options[optionName] === optionValue;
146
+ }; };
147
+ exports.optionIs = optionIs;
148
+ /**
149
+ * Only applicable for Controls.
150
+ *
151
+ * Checks whether the scope of a control ends with the expected string.
152
+ *
153
+ * @param {string} expected the expected ending of the reference
154
+ */
155
+ var scopeEndsWith = function (expected) { return function (uischema) {
156
+ if (isEmpty_1.default(expected) || !exports.isControl(uischema)) {
157
+ return false;
158
+ }
159
+ return endsWith_1.default(uischema.scope, expected);
160
+ }; };
161
+ exports.scopeEndsWith = scopeEndsWith;
162
+ /**
163
+ * Only applicable for Controls.
164
+ *
165
+ * Checks whether the last segment of the scope matches the expected string.
166
+ *
167
+ * @param {string} expected the expected ending of the reference
168
+ */
169
+ var scopeEndIs = function (expected) { return function (uischema) {
170
+ if (isEmpty_1.default(expected) || !exports.isControl(uischema)) {
171
+ return false;
172
+ }
173
+ var schemaPath = uischema.scope;
174
+ return !isEmpty_1.default(schemaPath) && last_1.default(schemaPath.split('/')) === expected;
175
+ }; };
176
+ exports.scopeEndIs = scopeEndIs;
177
+ /**
178
+ * A tester that allow composing other testers by && them.
179
+ *
180
+ * @param {Array<Tester>} testers the testers to be composed
181
+ */
182
+ var and = function () {
183
+ var testers = [];
184
+ for (var _i = 0; _i < arguments.length; _i++) {
185
+ testers[_i] = arguments[_i];
186
+ }
187
+ return function (uischema, schema) { return testers.reduce(function (acc, tester) { return acc && tester(uischema, schema); }, true); };
188
+ };
189
+ exports.and = and;
190
+ /**
191
+ * A tester that allow composing other testers by || them.
192
+ *
193
+ * @param {Array<Tester>} testers the testers to be composed
194
+ */
195
+ var or = function () {
196
+ var testers = [];
197
+ for (var _i = 0; _i < arguments.length; _i++) {
198
+ testers[_i] = arguments[_i];
199
+ }
200
+ return function (uischema, schema) { return testers.reduce(function (acc, tester) { return acc || tester(uischema, schema); }, false); };
201
+ };
202
+ exports.or = or;
203
+ /**
204
+ * Create a ranked tester that will associate a number with a given tester, if the
205
+ * latter returns true.
206
+ *
207
+ * @param {number} rank the rank to be returned in case the tester returns true
208
+ * @param {Tester} tester a tester
209
+ */
210
+ var rankWith = function (rank, tester) { return function (uischema, schema) {
211
+ if (tester(uischema, schema)) {
212
+ return rank;
213
+ }
214
+ return exports.NOT_APPLICABLE;
215
+ }; };
216
+ exports.rankWith = rankWith;
217
+ var withIncreasedRank = function (by, rankedTester) { return function (uischema, schema) {
218
+ var rank = rankedTester(uischema, schema);
219
+ if (rank === exports.NOT_APPLICABLE) {
220
+ return exports.NOT_APPLICABLE;
221
+ }
222
+ return rank + by;
223
+ }; };
224
+ exports.withIncreasedRank = withIncreasedRank;
225
+ /**
226
+ * Default tester for boolean.
227
+ * @type {RankedTester}
228
+ */
229
+ exports.isBooleanControl = exports.and(exports.uiTypeIs('Control'), exports.schemaTypeIs('boolean'));
230
+ // TODO: rather check for properties property
231
+ exports.isObjectControl = exports.and(exports.uiTypeIs('Control'), exports.schemaTypeIs('object'));
232
+ exports.isAllOfControl = exports.and(exports.uiTypeIs('Control'), exports.schemaMatches(function (schema) { return schema.hasOwnProperty('allOf'); }));
233
+ exports.isAnyOfControl = exports.and(exports.uiTypeIs('Control'), exports.schemaMatches(function (schema) { return schema.hasOwnProperty('anyOf'); }));
234
+ exports.isOneOfControl = exports.and(exports.uiTypeIs('Control'), exports.schemaMatches(function (schema) { return schema.hasOwnProperty('oneOf'); }));
235
+ /**
236
+ * Tests whether the given UI schema is of type Control and if the schema
237
+ * has an enum.
238
+ * @type {Tester}
239
+ */
240
+ exports.isEnumControl = exports.and(exports.uiTypeIs('Control'), exports.or(exports.schemaMatches(function (schema) { return schema.hasOwnProperty('enum'); }), exports.schemaMatches(function (schema) { return schema.hasOwnProperty('const'); })));
241
+ /**
242
+ * Tests whether the given UI schema is of type Control and if the schema
243
+ * has an enum based on oneOf.
244
+ * @type {Tester}
245
+ */
246
+ exports.isOneOfEnumControl = exports.and(exports.uiTypeIs('Control'), exports.schemaMatches(function (schema) {
247
+ return schema.hasOwnProperty('oneOf') &&
248
+ schema.oneOf.every(function (s) { return s.const !== undefined; });
249
+ }));
250
+ /**
251
+ * Tests whether the given UI schema is of type Control and if the schema
252
+ * is of type integer
253
+ * @type {Tester}
254
+ */
255
+ exports.isIntegerControl = exports.and(exports.uiTypeIs('Control'), exports.schemaTypeIs('integer'));
256
+ /**
257
+ * Tests whether the given UI schema is of type Control and if the schema
258
+ * is of type number
259
+ * @type {Tester}
260
+ */
261
+ exports.isNumberControl = exports.and(exports.uiTypeIs('Control'), exports.schemaTypeIs('number'));
262
+ /**
263
+ * Tests whether the given UI schema is of type Control and if the schema
264
+ * is of type string
265
+ * @type {Tester}
266
+ */
267
+ exports.isStringControl = exports.and(exports.uiTypeIs('Control'), exports.schemaTypeIs('string'));
268
+ /**
269
+ * Tests whether the given UI schema is of type Control and if is has
270
+ * a 'multi' option.
271
+ * @type {Tester}
272
+ */
273
+ exports.isMultiLineControl = exports.and(exports.uiTypeIs('Control'), exports.optionIs('multi', true));
274
+ /**
275
+ * Tests whether the given UI schema is of type Control and whether the schema
276
+ * or uischema options has a 'date' format.
277
+ * @type {Tester}
278
+ */
279
+ exports.isDateControl = exports.and(exports.uiTypeIs('Control'), exports.or(exports.formatIs('date'), exports.optionIs('format', 'date')));
280
+ /**
281
+ * Tests whether the given UI schema is of type Control and whether the schema
282
+ * or the uischema options has a 'time' format.
283
+ * @type {Tester}
284
+ */
285
+ exports.isTimeControl = exports.and(exports.uiTypeIs('Control'), exports.or(exports.formatIs('time'), exports.optionIs('format', 'time')));
286
+ /**
287
+ * Tests whether the given UI schema is of type Control and whether the schema
288
+ * or the uischema options has a 'date-time' format.
289
+ * @type {Tester}
290
+ */
291
+ exports.isDateTimeControl = exports.and(exports.uiTypeIs('Control'), exports.or(exports.formatIs('date-time'), exports.optionIs('format', 'date-time')));
292
+ /**
293
+ * Tests whether the given schema is an array of objects.
294
+ * @type {Tester}
295
+ */
296
+ exports.isObjectArray = exports.and(exports.schemaMatches(function (schema) { return util_1.hasType(schema, 'array') && !Array.isArray(schema.items); } // we don't care about tuples
297
+ ), exports.schemaSubPathMatches('items', function (schema) { return util_1.hasType(schema, 'object'); }));
298
+ /**
299
+ * Tests whether the given UI schema is of type Control and if the schema
300
+ * is an array of objects.
301
+ * @type {Tester}
302
+ */
303
+ exports.isObjectArrayControl = exports.and(exports.uiTypeIs('Control'), exports.isObjectArray);
304
+ var traverse = function (any, pred) {
305
+ if (isArray_1.default(any)) {
306
+ return reduce_1.default(any, function (acc, el) { return acc || traverse(el, pred); }, false);
307
+ }
308
+ if (pred(any)) {
309
+ return true;
310
+ }
311
+ if (any.items) {
312
+ return traverse(any.items, pred);
313
+ }
314
+ if (any.properties) {
315
+ return reduce_1.default(toPairs_1.default(any.properties), function (acc, _a) {
316
+ var _key = _a[0], val = _a[1];
317
+ return acc || traverse(val, pred);
318
+ }, false);
319
+ }
320
+ return false;
321
+ };
322
+ var isObjectArrayWithNesting = function (uischema, schema) {
323
+ if (!exports.uiTypeIs('Control')(uischema, schema)) {
324
+ return false;
325
+ }
326
+ var schemaPath = uischema.scope;
327
+ var resolvedSchema = util_1.resolveSchema(schema, schemaPath);
328
+ var wantedNestingByType = {
329
+ object: 2,
330
+ array: 1
331
+ };
332
+ if (resolvedSchema !== undefined && resolvedSchema.items !== undefined) {
333
+ // check if nested arrays
334
+ if (traverse(resolvedSchema.items, function (val) {
335
+ if (val === schema) {
336
+ return false;
337
+ }
338
+ // we don't support multiple types
339
+ if (typeof val.type !== 'string') {
340
+ return true;
341
+ }
342
+ var typeCount = wantedNestingByType[val.type];
343
+ if (typeCount === undefined) {
344
+ return false;
345
+ }
346
+ wantedNestingByType[val.type] = typeCount - 1;
347
+ return wantedNestingByType[val.type] === 0;
348
+ })) {
349
+ return true;
350
+ }
351
+ // check if uischema options detail is set
352
+ if (uischema.options && uischema.options.detail) {
353
+ if (typeof uischema.options.detail === 'string') {
354
+ return uischema.options.detail.toUpperCase() !== 'DEFAULT';
355
+ }
356
+ else if (typeof uischema.options.detail === 'object' &&
357
+ uischema.options.detail.type) {
358
+ return true;
359
+ }
360
+ }
361
+ }
362
+ return false;
363
+ };
364
+ exports.isObjectArrayWithNesting = isObjectArrayWithNesting;
365
+ /**
366
+ * Synonym for isObjectArrayControl
367
+ */
368
+ exports.isArrayObjectControl = exports.isObjectArrayControl;
369
+ /**
370
+ * Tests whether the given UI schema is of type Control and if the schema
371
+ * is an array of a primitive type.
372
+ * @type {Tester}
373
+ */
374
+ exports.isPrimitiveArrayControl = exports.and(exports.uiTypeIs('Control'), exports.schemaMatches(function (schema) { return util_1.deriveTypes(schema).length !== 0 && !Array.isArray(schema.items); } // we don't care about tuples
375
+ ), exports.schemaSubPathMatches('items', function (schema) {
376
+ var types = util_1.deriveTypes(schema);
377
+ return (types.length === 1 &&
378
+ includes_1.default(['integer', 'number', 'boolean', 'string'], types[0]));
379
+ }));
380
+ /**
381
+ * Tests whether a given UI schema is of type Control,
382
+ * if the schema is of type number or integer and
383
+ * whether the schema defines a numerical range with a default value.
384
+ * @type {Tester}
385
+ */
386
+ exports.isRangeControl = exports.and(exports.uiTypeIs('Control'), exports.or(exports.schemaTypeIs('number'), exports.schemaTypeIs('integer')), exports.schemaMatches(function (schema) {
387
+ return schema.hasOwnProperty('maximum') &&
388
+ schema.hasOwnProperty('minimum') &&
389
+ schema.hasOwnProperty('default');
390
+ }), exports.optionIs('slider', true));
391
+ /**
392
+ * Tests whether the given UI schema is of type Control, if the schema
393
+ * is of type string and has option format
394
+ * @type {Tester}
395
+ */
396
+ exports.isNumberFormatControl = exports.and(exports.uiTypeIs('Control'), exports.schemaTypeIs('integer'), exports.optionIs('format', true));
397
+ var isCategorization = function (category) { return category.type === 'Categorization'; };
398
+ exports.isCategorization = isCategorization;
399
+ var isCategory = function (uischema) {
400
+ return uischema.type === 'Category';
401
+ };
402
+ exports.isCategory = isCategory;
403
+ var hasCategory = function (categorization) {
404
+ if (isEmpty_1.default(categorization.elements)) {
405
+ return false;
406
+ }
407
+ // all children of the categorization have to be categories
408
+ return categorization.elements
409
+ .map(function (elem) {
410
+ return exports.isCategorization(elem) ? exports.hasCategory(elem) : exports.isCategory(elem);
411
+ })
412
+ .reduce(function (prev, curr) { return prev && curr; }, true);
413
+ };
414
+ exports.hasCategory = hasCategory;
415
+ var categorizationHasCategory = function (uischema) {
416
+ return exports.hasCategory(uischema);
417
+ };
418
+ exports.categorizationHasCategory = categorizationHasCategory;
419
+ var not = function (tester) { return function (uischema, schema) { return !tester(uischema, schema); }; };
420
+ exports.not = not;
421
+ //# sourceMappingURL=testers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testers.js","sourceRoot":"","sources":["../../src/testers/testers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,mEAAqC;AACrC,2DAA6B;AAC7B,qEAAuC;AACvC,6DAA+B;AAC/B,mEAAqC;AACrC,iEAAmC;AACnC,mEAAqC;AACrC,qEAAuC;AAOvC,gCAA8D;AAE9D;;;;GAIG;AACU,QAAA,cAAc,GAAG,CAAC,CAAC,CAAC;AAc1B,IAAM,SAAS,GAAG,UAAC,QAAa;IACrC,OAAA,CAAC,iBAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS;AAAlD,CAAkD,CAAC;AADxC,QAAA,SAAS,aAC+B;AAErD;;;;;;;;;GASG;AACI,IAAM,aAAa,GAAG,UAC3B,SAA0C,IAC/B,OAAA,UAAC,QAAyB,EAAE,MAAkB;IACzD,IAAI,iBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAS,CAAC,QAAQ,CAAC,EAAE;QAC7C,OAAO,KAAK,CAAC;KACd;IACD,IAAI,iBAAO,CAAC,MAAM,CAAC,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IACD,IAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC;IAClC,IAAI,iBAAO,CAAC,UAAU,CAAC,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,iBAAiB,GAAG,MAAM,CAAC;IAC/B,IAAI,cAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;QAC7B,iBAAiB,GAAG,oBAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;KACvD;IACD,IAAI,iBAAiB,KAAK,SAAS,EAAE;QACnC,OAAO,KAA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C,QAA0B,CAAC;AAAvC,CAAuC,CAAC;AAD7B,QAAA,yBAAyB,6BACI;AAEnC,IAAM,GAAG,GAAG,UAAC,MAAc,IAAa,OAAA,UAC7C,QAAyB,EACzB,MAAkB,IACf,OAAA,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAzB,CAAyB,EAHiB,CAGjB,CAAC;AAHlB,QAAA,GAAG,OAGe"}
@@ -1,3 +1,27 @@
1
1
  "use strict";
2
+ /*
3
+ The MIT License
4
+
5
+ Copyright (c) 2017-2019 EclipseSource Munich
6
+ https://github.com/eclipsesource/jsonforms
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
2
26
  Object.defineProperty(exports, "__esModule", { value: true });
3
27
  //# sourceMappingURL=Formatted.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Formatted.js","sourceRoot":"","sources":["../../src/util/Formatted.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Formatted.js","sourceRoot":"","sources":["../../src/util/Formatted.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE"}
package/lib/util/array.js CHANGED
@@ -1,5 +1,30 @@
1
1
  "use strict";
2
+ /*
3
+ The MIT License
4
+
5
+ Copyright (c) 2017-2019 EclipseSource Munich
6
+ https://github.com/eclipsesource/jsonforms
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
2
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.moveDown = exports.moveUp = void 0;
3
28
  var move = function (array, index, delta) {
4
29
  var newIndex = index + delta;
5
30
  if (newIndex < 0 || newIndex >= array.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/util/array.ts"],"names":[],"mappings":";;AAAA,IAAM,IAAI,GAAG,UAAC,KAAY,EAAE,KAAa,EAAE,KAAa;IACtD,IAAM,QAAQ,GAAW,KAAK,GAAG,KAAK,CAAC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AC,CAAC,mBAAmB;IACtF,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF,IAAM,MAAM,GAAG,UAAC,KAAY,EAAE,MAAc;IAC1C,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC,CAAC;AAMO,wBAAM;AAJf,IAAM,QAAQ,GAAG,UAAC,KAAY,EAAE,MAAc;IAC5C,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC,CAAC;AAEe,4BAAQ"}
@@ -1,8 +1,8 @@
1
- import { AnyAction, Dispatch, OwnPropsOfControl, OwnPropsOfEnum, StatePropsOfScopedRenderer } from '.';
2
- import { DispatchPropsOfControl } from './renderer';
1
+ import { JsonFormsCellRendererRegistryEntry } from '../reducers';
2
+ import { AnyAction, Dispatch } from './type';
3
+ import { DispatchPropsOfControl, OwnPropsOfControl, OwnPropsOfEnum, StatePropsOfScopedRenderer } from './renderer';
3
4
  import { JsonFormsState } from '../store';
4
- import { JsonFormsCellRendererRegistryEntry } from '../reducers/cells';
5
- import { JsonSchema } from '..';
5
+ import { JsonSchema } from '../models';
6
6
  export { JsonFormsCellRendererRegistryEntry };
7
7
  export interface OwnPropsOfCell extends OwnPropsOfControl {
8
8
  data?: any;
@@ -59,6 +59,13 @@ export interface DispatchCellProps extends DispatchCellStateProps {
59
59
  * @returns {StatePropsOfEnumCell}
60
60
  */
61
61
  export declare const defaultMapStateToEnumCellProps: (state: JsonFormsState, ownProps: OwnPropsOfEnumCell) => StatePropsOfEnumCell;
62
+ /**
63
+ * mapStateToOneOfEnumCellProps for one of enum cell. Options is used for populating dropdown list from oneOf
64
+ * @param state
65
+ * @param ownProps
66
+ * @returns {StatePropsOfEnumCell}
67
+ */
68
+ export declare const mapStateToOneOfEnumCellProps: (state: JsonFormsState, ownProps: OwnPropsOfEnumCell) => StatePropsOfEnumCell;
62
69
  /**
63
70
  * Synonym for mapDispatchToControlProps.
64
71
  *