@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
package/lib/util/cell.js DELETED
@@ -1,133 +0,0 @@
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
- var tslib_1 = require("tslib");
28
- var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
29
- var union_1 = tslib_1.__importDefault(require("lodash/union"));
30
- var reducers_1 = require("../reducers");
31
- var util_1 = require("./util");
32
- var runtime_1 = require("./runtime");
33
- var renderer_1 = require("./renderer");
34
- /**
35
- * Map state to cell props.
36
- *
37
- * @param state JSONForms state tree
38
- * @param ownProps any own props
39
- * @returns {StatePropsOfCell} state props of a cell
40
- */
41
- exports.mapStateToCellProps = function (state, ownProps) {
42
- var id = ownProps.id, schema = ownProps.schema, path = ownProps.path, uischema = ownProps.uischema, renderers = ownProps.renderers, cells = ownProps.cells;
43
- var rootData = reducers_1.getData(state);
44
- var visible = ownProps.visible !== undefined
45
- ? ownProps.visible
46
- : runtime_1.isVisible(uischema, rootData, undefined, reducers_1.getAjv(state));
47
- var rootSchema = reducers_1.getSchema(state);
48
- var config = reducers_1.getConfig(state);
49
- /* When determining the enabled state of cells we take a shortcut: At the
50
- * moment it's only possible to configure enablement and disablement at the
51
- * control level. Therefore the renderer using the cell, for example a
52
- * table renderer, determines whether a cell is enabled and should hand
53
- * over the prop themselves. If that prop was given, we prefer it over
54
- * anything else to save evaluation effort (except for the global readonly
55
- * flag). For example it would be quite expensive to evaluate the same ui schema
56
- * rule again and again for each cell of a table. */
57
- var enabled;
58
- if (state.jsonforms.readonly === true) {
59
- enabled = false;
60
- }
61
- else if (typeof ownProps.enabled === 'boolean') {
62
- enabled = ownProps.enabled;
63
- }
64
- else {
65
- enabled = runtime_1.isInherentlyEnabled(state, ownProps, uischema, schema || rootSchema, rootData, config);
66
- }
67
- var errors = util_1.formatErrorMessage(union_1.default(reducers_1.getErrorAt(path, schema)(state).map(function (error) { return error.message; })));
68
- var isValid = isEmpty_1.default(errors);
69
- return {
70
- data: util_1.Resolve.data(rootData, path),
71
- visible: visible,
72
- enabled: enabled,
73
- id: id,
74
- path: path,
75
- errors: errors,
76
- isValid: isValid,
77
- schema: schema,
78
- uischema: uischema,
79
- config: reducers_1.getConfig(state),
80
- rootSchema: rootSchema,
81
- renderers: renderers,
82
- cells: cells
83
- };
84
- };
85
- exports.mapStateToDispatchCellProps = function (state, ownProps) {
86
- var props = exports.mapStateToCellProps(state, ownProps);
87
- var renderers = ownProps.renderers, cells = ownProps.cells, otherOwnProps = tslib_1.__rest(ownProps, ["renderers", "cells"]);
88
- return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, props), otherOwnProps), { cells: cells || state.jsonforms.cells || [] });
89
- };
90
- /**
91
- * Default mapStateToCellProps for enum cell. Options is used for populating dropdown list
92
- * @param state
93
- * @param ownProps
94
- * @returns {StatePropsOfEnumCell}
95
- */
96
- exports.defaultMapStateToEnumCellProps = function (state, ownProps) {
97
- var _a;
98
- var props = exports.mapStateToCellProps(state, ownProps);
99
- var options = ownProps.options || ((_a = props.schema.enum) === null || _a === void 0 ? void 0 : _a.map(renderer_1.enumToEnumOptionMapper)) ||
100
- (props.schema.const && [renderer_1.enumToEnumOptionMapper(props.schema.const)]);
101
- return tslib_1.__assign(tslib_1.__assign({}, props), { options: options });
102
- };
103
- /**
104
- * mapStateToOneOfEnumCellProps for one of enum cell. Options is used for populating dropdown list from oneOf
105
- * @param state
106
- * @param ownProps
107
- * @returns {StatePropsOfEnumCell}
108
- */
109
- exports.mapStateToOneOfEnumCellProps = function (state, ownProps) {
110
- var _a;
111
- var props = exports.mapStateToCellProps(state, ownProps);
112
- var options = ownProps.options || ((_a = props.schema.oneOf) === null || _a === void 0 ? void 0 : _a.map(renderer_1.oneOfToEnumOptionMapper));
113
- return tslib_1.__assign(tslib_1.__assign({}, props), { options: options });
114
- };
115
- /**
116
- * Synonym for mapDispatchToControlProps.
117
- *
118
- * @type {(dispatch) => {handleChange(path, value): void}}
119
- */
120
- exports.mapDispatchToCellProps = renderer_1.mapDispatchToControlProps;
121
- /**
122
- * Default dispatch to control props which can be customized to set handleChange action
123
- *
124
- */
125
- exports.defaultMapDispatchToControlProps =
126
- // TODO: ownProps types
127
- function (dispatch, ownProps) {
128
- var handleChange = exports.mapDispatchToCellProps(dispatch).handleChange;
129
- return {
130
- handleChange: ownProps.handleChange || handleChange
131
- };
132
- };
133
- //# sourceMappingURL=cell.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/util/cell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,mEAAqC;AACrC,+DAAiC;AACjC,wCAOqB;AAErB,+BAGgB;AAChB,qCAGmB;AACnB,uCASoB;AAkDpB;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,UACjC,KAAqB,EACrB,QAAwB;IAEhB,IAAA,gBAAE,EAAE,wBAAM,EAAE,oBAAI,EAAE,4BAAQ,EAAE,8BAAS,EAAE,sBAAK,CAAc;IAClE,IAAM,QAAQ,GAAG,kBAAO,CAAC,KAAK,CAAC,CAAC;IAChC,IAAM,OAAO,GACX,QAAQ,CAAC,OAAO,KAAK,SAAS;QAC5B,CAAC,CAAC,QAAQ,CAAC,OAAO;QAClB,CAAC,CAAC,mBAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,IAAM,UAAU,GAAG,oBAAS,CAAC,KAAK,CAAC,CAAC;IACpC,IAAM,MAAM,GAAG,oBAAS,CAAC,KAAK,CAAC,CAAC;IAEhC;;;;;;;wDAO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EAAE,IAC3C;AACJ,CAAC,CAAC;AAIF;;;;;GAKG;AACU,QAAA,8BAA8B,GAAG,UAC5C,KAAqB,EACrB,QAA4B;;IAE5B,IAAM,KAAK,GAAqB,2BAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACrE,IAAM,OAAO,GACX,QAAQ,CAAC,OAAO,WAChB,KAAK,CAAC,MAAM,CAAC,IAAI,0CAAE,GAAG,CAAC,iCAAsB,EAAC;QAC9C,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,iCAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvE,6CACK,KAAK,KACR,OAAO,SAAA,IACP;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG,UAC1C,KAAqB,EACrB,QAA4B;;IAE5B,IAAM,KAAK,GAAqB,2BAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACrE,IAAM,OAAO,GACX,QAAQ,CAAC,OAAO,WACf,KAAK,CAAC,MAAM,CAAC,KAAsB,0CAAE,GAAG,CAAC,kCAAuB,EAAC,CAAC;IACrE,6CACK,KAAK,KACR,OAAO,SAAA,IACP;AACJ,CAAC,CAAC;AAGF;;;;GAIG;AACU,QAAA,sBAAsB,GAEL,oCAAyB,CAAC;AAExD;;;GAGG;AACU,QAAA,gCAAgC;AAC3C,uBAAuB;AACvB,UAAC,QAA6B,EAAE,QAAa;IACnC,IAAA,oEAAY,CAAsC;IAE1D,OAAO;QACL,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,YAAY;KACpD,CAAC;AACJ,CAAC,CAAC"}
@@ -1,56 +0,0 @@
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
- var tslib_1 = require("tslib");
28
- var resolvers_1 = require("./resolvers");
29
- var reducers_1 = require("../reducers");
30
- var createLabel = function (subSchema, subSchemaIndex, keyword) {
31
- if (subSchema.title) {
32
- return subSchema.title;
33
- }
34
- else {
35
- return keyword + '-' + subSchemaIndex;
36
- }
37
- };
38
- exports.resolveSubSchemas = function (schema, rootSchema, keyword) {
39
- var _a;
40
- // resolve any $refs, otherwise the generated UI schema can't match the schema???
41
- var schemas = schema[keyword];
42
- if (schemas.findIndex(function (e) { return e.$ref !== undefined; }) !== -1) {
43
- return tslib_1.__assign(tslib_1.__assign({}, schema), (_a = {}, _a[keyword] = schema[keyword].map(function (e) {
44
- return e.$ref ? resolvers_1.resolveSchema(rootSchema, e.$ref) : e;
45
- }), _a));
46
- }
47
- return schema;
48
- };
49
- exports.createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
50
- return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) { return ({
51
- schema: subSchema,
52
- uischema: reducers_1.findUISchema(uischemas, subSchema, control.scope, path, undefined, control, rootSchema),
53
- label: createLabel(subSchema, subSchemaIndex, keyword)
54
- }); });
55
- };
56
- //# sourceMappingURL=combinators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"combinators.js","sourceRoot":"","sources":["../../src/util/combinators.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAGF,yCAA4C;AAC5C,wCAA2E;AAU3E,IAAM,WAAW,GAAG,UAClB,SAAqB,EACrB,cAAsB,EACtB,OAA0B;IAE1B,IAAI,SAAS,CAAC,KAAK,EAAE;QACnB,OAAO,SAAS,CAAC,KAAK,CAAC;KACxB;SAAM;QACL,OAAO,OAAO,GAAG,GAAG,GAAG,cAAc,CAAC;KACvC;AACH,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG,UAC/B,MAAkB,EAClB,UAAsB,EACtB,OAA0B;;IAE1B,iFAAiF;IACjF,IAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAU,CAAC;IACzC,IAAI,OAAO,CAAC,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,SAAS,EAApB,CAAoB,CAAC,KAAK,CAAC,CAAC,EAAE;QACvD,6CACK,MAAM,gBACR,OAAO,IAAI,MAAM,CAAC,OAAO,CAAW,CAAC,GAAG,CAAC,UAAA,CAAC;YACzC,OAAA,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAa,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAA9C,CAA8C,CAC/C,OACD;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEW,QAAA,2BAA2B,GAAG,UACzC,oBAAkC,EAClC,UAAsB,EACtB,OAA0B,EAC1B,OAAuB,EACvB,IAAY,EACZ,SAA2C;IAE3C,OAAA,oBAAoB,CAAC,GAAG,CAAC,UAAC,SAAS,EAAE,cAAc,IAAK,OAAA,CAAC;QACvD,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,uBAAY,CACpB,SAAS,EACT,SAAS,EACT,OAAO,CAAC,KAAK,EACb,IAAI,EACJ,SAAS,EACT,OAAO,EACP,UAAU,CACX;QACD,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC;KACvD,CAAC,EAZsD,CAYtD,CAAC;AAZH,CAYG,CAAC"}
package/lib/util/ids.js DELETED
@@ -1,50 +0,0 @@
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
- var usedIds = new Set();
28
- var makeId = function (idBase, iteration) {
29
- return iteration <= 1 ? idBase : idBase + iteration.toString();
30
- };
31
- var isUniqueId = function (idBase, iteration) {
32
- var newID = makeId(idBase, iteration);
33
- return !usedIds.has(newID);
34
- };
35
- exports.createId = function (proposedId) {
36
- if (proposedId === undefined) {
37
- // failsafe to avoid endless loops in error cases
38
- proposedId = 'undefined';
39
- }
40
- var tries = 0;
41
- while (!isUniqueId(proposedId, tries)) {
42
- tries++;
43
- }
44
- var newID = makeId(proposedId, tries);
45
- usedIds.add(newID);
46
- return newID;
47
- };
48
- exports.removeId = function (id) { return usedIds.delete(id); };
49
- exports.clearAllIds = function () { return usedIds.clear(); };
50
- //# sourceMappingURL=ids.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/util/ids.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;AAEF,IAAM,OAAO,GAAgB,IAAI,GAAG,EAAU,CAAC;AAE/C,IAAM,MAAM,GAAG,UAAC,MAAc,EAAE,SAAiB;IAC/C,OAAA,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;AAAvD,CAAuD,CAAC;AAE1D,IAAM,UAAU,GAAG,UAAC,MAAc,EAAE,SAAiB;IACnD,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACxC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEW,QAAA,QAAQ,GAAG,UAAC,UAAkB;IACzC,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,iDAAiD;QACjD,UAAU,GAAG,WAAW,CAAC;KAC1B;IACD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;QACrC,KAAK,EAAE,CAAC;KACT;IACD,IAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEW,QAAA,QAAQ,GAAG,UAAC,EAAU,IAAK,OAAA,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAlB,CAAkB,CAAC;AAE9C,QAAA,WAAW,GAAG,cAAM,OAAA,OAAO,CAAC,KAAK,EAAE,EAAf,CAAe,CAAC"}
package/lib/util/index.js DELETED
@@ -1,41 +0,0 @@
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
- var tslib_1 = require("tslib");
28
- tslib_1.__exportStar(require("./array"), exports);
29
- tslib_1.__exportStar(require("./cell"), exports);
30
- tslib_1.__exportStar(require("./combinators"), exports);
31
- tslib_1.__exportStar(require("./ids"), exports);
32
- tslib_1.__exportStar(require("./label"), exports);
33
- tslib_1.__exportStar(require("./path"), exports);
34
- tslib_1.__exportStar(require("./renderer"), exports);
35
- tslib_1.__exportStar(require("./resolvers"), exports);
36
- tslib_1.__exportStar(require("./runtime"), exports);
37
- tslib_1.__exportStar(require("./schema"), exports);
38
- tslib_1.__exportStar(require("./uischema"), exports);
39
- tslib_1.__exportStar(require("./util"), exports);
40
- tslib_1.__exportStar(require("./validator"), exports);
41
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,kDAAwB;AACxB,iDAAuB;AACvB,wDAA8B;AAE9B,gDAAsB;AACtB,kDAAwB;AACxB,iDAAuB;AACvB,qDAA2B;AAC3B,sDAA4B;AAC5B,oDAA0B;AAC1B,mDAAyB;AAEzB,qDAA2B;AAC3B,iDAAuB;AACvB,sDAA4B"}
package/lib/util/label.js DELETED
@@ -1,70 +0,0 @@
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
- var tslib_1 = require("tslib");
28
- var startCase_1 = tslib_1.__importDefault(require("lodash/startCase"));
29
- var deriveLabel = function (controlElement, schemaElement) {
30
- if (schemaElement && typeof schemaElement.title === 'string') {
31
- return schemaElement.title;
32
- }
33
- if (typeof controlElement.scope === 'string') {
34
- var ref = controlElement.scope;
35
- var label = ref.substr(ref.lastIndexOf('/') + 1);
36
- return startCase_1.default(label);
37
- }
38
- return '';
39
- };
40
- exports.createCleanLabel = function (label) {
41
- return startCase_1.default(label.replace('_', ' '));
42
- };
43
- /**
44
- * Return a label object based on the given control and schema element.
45
- * @param {ControlElement} withLabel the UI schema to obtain a label object for
46
- * @param {JsonSchema} schema optional: the corresponding schema element
47
- * @returns {LabelDescription}
48
- */
49
- exports.createLabelDescriptionFrom = function (withLabel, schema) {
50
- var labelProperty = withLabel.label;
51
- if (typeof labelProperty === 'boolean') {
52
- return labelDescription(deriveLabel(withLabel, schema), labelProperty);
53
- }
54
- if (typeof labelProperty === 'string') {
55
- return labelDescription(labelProperty, true);
56
- }
57
- if (typeof labelProperty === 'object') {
58
- var label = typeof labelProperty.text === 'string'
59
- ? labelProperty.text
60
- : deriveLabel(withLabel, schema);
61
- var show = typeof labelProperty.show === 'boolean' ? labelProperty.show : true;
62
- return labelDescription(label, show);
63
- }
64
- return labelDescription(deriveLabel(withLabel, schema), true);
65
- };
66
- var labelDescription = function (text, show) { return ({
67
- text: text,
68
- show: show
69
- }); };
70
- //# sourceMappingURL=label.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/util/label.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;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KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACtE,OAAO,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KACtC;IACD,OAAO,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,IAAM,gBAAgB,GAAG,UAAC,IAAY,EAAE,IAAa,IAAuB,OAAA,CAAC;IAC3E,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;CACX,CAAC,EAH0E,CAG1E,CAAC"}
package/lib/util/path.js DELETED
@@ -1,85 +0,0 @@
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
- var tslib_1 = require("tslib");
28
- var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
29
- var range_1 = tslib_1.__importDefault(require("lodash/range"));
30
- exports.compose = function (path1, path2) {
31
- var p1 = path1;
32
- if (!isEmpty_1.default(path1) && !isEmpty_1.default(path2) && !path2.startsWith('[')) {
33
- p1 = path1 + '.';
34
- }
35
- if (isEmpty_1.default(p1)) {
36
- return path2;
37
- }
38
- else if (isEmpty_1.default(path2)) {
39
- return p1;
40
- }
41
- else {
42
- return "" + p1 + path2;
43
- }
44
- };
45
- exports.composePaths = exports.compose;
46
- /**
47
- * Convert a schema path (i.e. JSON pointer) to an array by splitting
48
- * at the '/' character and removing all schema-specific keywords.
49
- *
50
- * The returned value can be used to de-reference a root object by folding over it
51
- * and de-referencing the single segments to obtain a new object.
52
- *
53
- *
54
- * @param {string} schemaPath the schema path to be converted
55
- * @returns {string[]} an array containing only non-schema-specific segments
56
- */
57
- exports.toDataPathSegments = function (schemaPath) {
58
- var s = schemaPath
59
- .replace(/anyOf\/[\d]\//g, '')
60
- .replace(/allOf\/[\d]\//g, '')
61
- .replace(/oneOf\/[\d]\//g, '');
62
- var segments = s.split('/');
63
- var startFromRoot = segments[0] === '#' || segments[0] === '';
64
- var startIndex = startFromRoot ? 2 : 1;
65
- return range_1.default(startIndex, segments.length, 2).map(function (idx) { return segments[idx]; });
66
- };
67
- /**
68
- * Remove all schema-specific keywords (e.g. 'properties') from a given path.
69
- * @example
70
- * toDataPath('#/properties/foo/properties/bar') === '#/foo/bar')
71
- *
72
- * @param {string} schemaPath the schema path to be converted
73
- * @returns {string} the path without schema-specific keywords
74
- */
75
- exports.toDataPath = function (schemaPath) {
76
- return exports.toDataPathSegments(schemaPath).join('.');
77
- };
78
- exports.composeWithUi = function (scopableUi, path) {
79
- var segments = exports.toDataPathSegments(scopableUi.scope);
80
- if (isEmpty_1.default(segments) && path === undefined) {
81
- return '';
82
- }
83
- return isEmpty_1.default(segments) ? path : exports.compose(path, segments.join('.'));
84
- };
85
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