@jsonforms/core 2.5.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/enums/ruleeffect.html +4 -4
- package/docs/globals.html +1124 -1081
- package/docs/index.html +70 -88
- package/docs/interfaces/addcellrendereraction.html +3 -3
- package/docs/interfaces/addrendereraction.html +3 -3
- package/docs/interfaces/adduischemaaction.html +3 -3
- package/docs/interfaces/andcondition.html +2 -2
- package/docs/interfaces/arraycontrolprops.html +22 -22
- package/docs/interfaces/arraylayoutprops.html +22 -22
- package/docs/interfaces/categorization.html +5 -5
- package/docs/interfaces/category.html +5 -5
- package/docs/interfaces/cellprops.html +14 -14
- package/docs/interfaces/combinatorrendererprops.html +13 -13
- package/docs/interfaces/combinatorsubschemarenderinfo.html +3 -3
- package/docs/interfaces/composablecondition.html +2 -2
- package/docs/interfaces/condition.html +1 -1
- package/docs/interfaces/controlelement.html +5 -5
- package/docs/interfaces/controlprops.html +17 -17
- package/docs/interfaces/controlstate.html +2 -2
- package/docs/interfaces/controlwithdetailprops.html +18 -18
- package/docs/interfaces/dispatchcellprops.html +13 -13
- package/docs/interfaces/dispatchcellstateprops.html +13 -13
- package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
- package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
- package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
- package/docs/interfaces/enumcellprops.html +15 -15
- package/docs/interfaces/enumoption.html +2 -2
- package/docs/interfaces/formatted.html +2 -2
- package/docs/interfaces/grouplayout.html +5 -5
- package/docs/interfaces/horizontallayout.html +4 -4
- package/docs/interfaces/initaction.html +6 -6
- package/docs/interfaces/initactionoptions.html +3 -17
- package/docs/interfaces/jsonformscellrendererregistryentry.html +2 -2
- package/docs/interfaces/jsonformscore.html +7 -21
- package/docs/interfaces/jsonformsdefaultdataregistryentry.html +2 -2
- package/docs/interfaces/jsonformsextendedstate.html +1 -1
- package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
- package/docs/interfaces/jsonformsprops.html +9 -24
- package/docs/interfaces/jsonformsrendererregistryentry.html +2 -2
- package/docs/interfaces/jsonformsstate.html +1 -1
- package/docs/interfaces/jsonformsstore.html +5 -5
- package/docs/interfaces/jsonformssubstates.html +18 -8
- package/docs/interfaces/jsonformsuischemaregistryentry.html +2 -2
- package/docs/interfaces/labeldescription.html +2 -2
- package/docs/interfaces/labelelement.html +4 -4
- package/docs/interfaces/layout.html +4 -4
- package/docs/interfaces/layoutprops.html +10 -10
- package/docs/interfaces/leafcondition.html +3 -3
- package/docs/interfaces/orcondition.html +2 -2
- package/docs/interfaces/ownpropsofcell.html +10 -10
- package/docs/interfaces/ownpropsofcontrol.html +9 -9
- package/docs/interfaces/ownpropsofenum.html +1 -1
- package/docs/interfaces/ownpropsofenumcell.html +11 -11
- package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
- package/docs/interfaces/ownpropsoflayout.html +9 -9
- package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
- package/docs/interfaces/ownpropsofrenderer.html +8 -8
- package/docs/interfaces/registerdefaultdataaction.html +3 -3
- package/docs/interfaces/removecellrendereraction.html +3 -3
- package/docs/interfaces/removerendereraction.html +3 -3
- package/docs/interfaces/removeuischemaaction.html +2 -2
- package/docs/interfaces/rendererprops.html +9 -9
- package/docs/interfaces/rule.html +2 -2
- package/docs/interfaces/schemabasedcondition.html +3 -3
- package/docs/interfaces/scopable.html +1 -1
- package/docs/interfaces/setajvaction.html +3 -3
- package/docs/interfaces/setconfigaction.html +2 -2
- package/docs/interfaces/setlocaleaction.html +3 -3
- package/docs/interfaces/setschemaaction.html +2 -2
- package/docs/interfaces/{setlocalizeduischemasaction.html → settranslatoraction.html} +29 -15
- package/docs/interfaces/setuischemaaction.html +2 -2
- package/docs/interfaces/setvalidationmodeaction.html +2 -2
- package/docs/interfaces/statepropsofarraycontrol.html +18 -18
- package/docs/interfaces/statepropsofarraylayout.html +18 -18
- package/docs/interfaces/statepropsofcell.html +13 -13
- package/docs/interfaces/statepropsofcombinator.html +12 -12
- package/docs/interfaces/statepropsofcontrol.html +16 -16
- package/docs/interfaces/statepropsofcontrolwithdetail.html +17 -17
- package/docs/interfaces/statepropsofenumcell.html +14 -14
- package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -23
- package/docs/interfaces/statepropsoflayout.html +10 -10
- package/docs/interfaces/statepropsofmasteritem.html +7 -7
- package/docs/interfaces/statepropsofrenderer.html +9 -9
- package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
- package/docs/interfaces/uischemaelement.html +3 -3
- package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
- package/docs/interfaces/updateaction.html +3 -3
- package/docs/interfaces/updatecoreaction.html +6 -6
- package/docs/interfaces/updateerrorsaction.html +2 -2
- package/docs/interfaces/{setlocalizedschemasaction.html → updatei18naction.html} +43 -15
- package/docs/interfaces/verticallayout.html +4 -4
- package/docs/interfaces/withclassname.html +1 -1
- package/lib/Helpers.d.ts +5 -0
- package/lib/Helpers.js +33 -0
- package/lib/Helpers.js.map +1 -0
- package/lib/actions/actions.d.ts +181 -0
- package/lib/actions/actions.js +173 -0
- package/lib/actions/actions.js.map +1 -0
- package/lib/actions/index.d.ts +1 -180
- package/lib/actions/index.js +26 -122
- package/lib/actions/index.js.map +1 -1
- package/lib/configDefault.js +2 -1
- package/lib/configDefault.js.map +1 -1
- package/lib/generators/Generate.d.ts +6 -0
- package/lib/generators/Generate.js +35 -0
- package/lib/generators/Generate.js.map +1 -0
- package/lib/generators/index.d.ts +3 -10
- package/lib/generators/index.js +28 -9
- package/lib/generators/index.js.map +1 -1
- package/lib/generators/schema.d.ts +1 -1
- package/lib/generators/schema.js +3 -1
- package/lib/generators/schema.js.map +1 -1
- package/lib/generators/uischema.d.ts +1 -2
- package/lib/generators/uischema.js +12 -10
- package/lib/generators/uischema.js.map +1 -1
- package/lib/i18n/i18nTypes.d.ts +15 -0
- package/lib/i18n/i18nTypes.js +3 -0
- package/lib/i18n/i18nTypes.js.map +1 -0
- package/lib/i18n/i18nUtil.d.ts +18 -0
- package/lib/i18n/i18nUtil.js +71 -0
- package/lib/i18n/i18nUtil.js.map +1 -0
- package/lib/i18n/index.d.ts +2 -0
- package/lib/i18n/index.js +6 -0
- package/lib/i18n/index.js.map +1 -0
- package/lib/index.d.ts +6 -18
- package/lib/index.js +10 -15
- package/lib/index.js.map +1 -1
- package/lib/jsonforms-core.js +9 -12
- package/lib/jsonforms-core.js.map +1 -1
- package/lib/models/draft4.js +2 -1
- package/lib/models/draft4.js.map +1 -1
- package/lib/models/index.d.ts +5 -0
- package/lib/models/index.js +33 -0
- package/lib/models/index.js.map +1 -0
- package/lib/models/jsonSchema.js +24 -0
- package/lib/models/jsonSchema.js.map +1 -1
- package/lib/models/uischema.js +29 -2
- package/lib/models/uischema.js.map +1 -1
- package/lib/reducers/cells.d.ts +1 -1
- package/lib/reducers/cells.js +27 -1
- package/lib/reducers/cells.js.map +1 -1
- package/lib/reducers/config.d.ts +1 -1
- package/lib/reducers/config.js +5 -3
- package/lib/reducers/config.js.map +1 -1
- package/lib/reducers/core.d.ts +5 -7
- package/lib/reducers/core.js +78 -63
- package/lib/reducers/core.js.map +1 -1
- package/lib/reducers/default-data.d.ts +1 -1
- package/lib/reducers/default-data.js +6 -3
- package/lib/reducers/default-data.js.map +1 -1
- package/lib/reducers/i18n.d.ts +8 -11
- package/lib/reducers/i18n.js +40 -23
- package/lib/reducers/i18n.js.map +1 -1
- package/lib/reducers/index.d.ts +9 -49
- package/lib/reducers/index.js +33 -91
- package/lib/reducers/index.js.map +1 -1
- package/lib/reducers/reducers.d.ts +29 -0
- package/lib/reducers/reducers.js +98 -0
- package/lib/reducers/reducers.js.map +1 -0
- package/lib/reducers/renderers.d.ts +1 -1
- package/lib/reducers/renderers.js +27 -1
- package/lib/reducers/renderers.js.map +1 -1
- package/lib/reducers/selectors.d.ts +15 -0
- package/lib/reducers/selectors.js +56 -0
- package/lib/reducers/selectors.js.map +1 -0
- package/lib/reducers/uischemas.d.ts +2 -2
- package/lib/reducers/uischemas.js +9 -6
- package/lib/reducers/uischemas.js.map +1 -1
- package/lib/store.d.ts +5 -8
- package/lib/store.js +24 -0
- package/lib/store.js.map +1 -1
- package/lib/testers/index.d.ts +1 -204
- package/lib/testers/index.js +3 -376
- package/lib/testers/index.js.map +1 -1
- package/lib/testers/testers.d.ts +203 -0
- package/lib/testers/testers.js +421 -0
- package/lib/testers/testers.js.map +1 -0
- package/lib/util/Formatted.js +24 -0
- package/lib/util/Formatted.js.map +1 -1
- package/lib/util/array.js +25 -0
- package/lib/util/array.js.map +1 -1
- package/lib/util/cell.d.ts +11 -4
- package/lib/util/cell.js +60 -17
- package/lib/util/cell.js.map +1 -1
- package/lib/util/combinators.d.ts +2 -3
- package/lib/util/combinators.js +5 -2
- package/lib/util/combinators.js.map +1 -1
- package/lib/util/ids.js +8 -4
- package/lib/util/ids.js.map +1 -1
- package/lib/util/index.d.ts +11 -45
- package/lib/util/index.js +14 -104
- package/lib/util/index.js.map +1 -1
- package/lib/util/label.d.ts +1 -2
- package/lib/util/label.js +7 -4
- package/lib/util/label.js.map +1 -1
- package/lib/util/path.d.ts +2 -1
- package/lib/util/path.js +12 -6
- package/lib/util/path.js.map +1 -1
- package/lib/util/renderer.d.ts +19 -18
- package/lib/util/renderer.js +163 -78
- package/lib/util/renderer.js.map +1 -1
- package/lib/util/resolvers.d.ts +1 -14
- package/lib/util/resolvers.js +9 -215
- package/lib/util/resolvers.js.map +1 -1
- package/lib/util/runtime.d.ts +12 -2
- package/lib/util/runtime.js +59 -17
- package/lib/util/runtime.js.map +1 -1
- package/lib/util/schema.js +27 -1
- package/lib/util/schema.js.map +1 -1
- package/lib/util/uischema.d.ts +1 -1
- package/lib/util/uischema.js +11 -7
- package/lib/util/uischema.js.map +1 -1
- package/lib/util/util.d.ts +31 -0
- package/lib/util/util.js +112 -0
- package/lib/util/util.js.map +1 -0
- package/lib/util/validator.d.ts +3 -2
- package/lib/util/validator.js +6 -5
- package/lib/util/validator.js.map +1 -1
- package/package.json +6 -8
- package/src/Helpers.ts +38 -0
- package/src/actions/actions.ts +345 -0
- package/src/actions/index.ts +1 -312
- package/src/configDefault.ts +1 -0
- package/src/generators/Generate.ts +43 -0
- package/src/generators/index.ts +3 -21
- package/src/generators/schema.ts +1 -1
- package/src/generators/uischema.ts +4 -4
- package/src/i18n/i18nTypes.ts +17 -0
- package/src/i18n/i18nUtil.ts +105 -0
- package/src/i18n/index.ts +2 -0
- package/src/index.ts +7 -31
- package/src/models/draft4.ts +1 -0
- package/src/models/index.ts +30 -0
- package/src/models/jsonSchema.ts +1 -0
- package/src/models/uischema.ts +1 -0
- package/src/reducers/cells.ts +2 -1
- package/src/reducers/config.ts +2 -1
- package/src/reducers/core.ts +74 -81
- package/src/reducers/default-data.ts +2 -1
- package/src/reducers/i18n.ts +42 -35
- package/src/reducers/index.ts +9 -158
- package/src/reducers/reducers.ts +128 -0
- package/src/reducers/renderers.ts +2 -1
- package/src/reducers/selectors.ts +65 -0
- package/src/reducers/uischemas.ts +4 -2
- package/src/store.ts +11 -8
- package/src/testers/index.ts +1 -516
- package/src/testers/testers.ts +547 -0
- package/src/util/Formatted.ts +1 -0
- package/src/util/array.ts +25 -0
- package/src/util/cell.ts +91 -19
- package/src/util/combinators.ts +2 -4
- package/src/util/ids.ts +1 -0
- package/src/util/index.ts +11 -126
- package/src/util/label.ts +2 -2
- package/src/util/path.ts +4 -1
- package/src/util/renderer.ts +170 -88
- package/src/util/resolvers.ts +2 -261
- package/src/util/runtime.ts +46 -2
- package/src/util/schema.ts +26 -1
- package/src/util/uischema.ts +2 -1
- package/src/util/util.ts +127 -0
- package/src/util/validator.ts +5 -8
- package/test/i18n/i18nUtil.test.ts +48 -0
- package/test/reducers/core.test.ts +33 -226
- package/test/util/cell.test.ts +33 -2
- package/test/util/renderer.test.ts +543 -31
- package/test/util/resolvers.test.ts +1 -59
- package/test/util/runtime.test.ts +264 -4
- package/docs/interfaces/labels.html +0 -157
- package/docs/interfaces/schemaref.html +0 -160
- package/docs/interfaces/schemarefs.html +0 -138
package/lib/util/cell.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
2
|
/*
|
|
5
3
|
The MIT License
|
|
6
4
|
|
|
@@ -25,11 +23,16 @@ var tslib_1 = require("tslib");
|
|
|
25
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
24
|
THE SOFTWARE.
|
|
27
25
|
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.defaultMapDispatchToControlProps = exports.mapDispatchToCellProps = exports.mapStateToOneOfEnumCellProps = exports.defaultMapStateToEnumCellProps = exports.mapStateToDispatchCellProps = exports.mapStateToCellProps = void 0;
|
|
28
|
+
var tslib_1 = require("tslib");
|
|
28
29
|
var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
29
30
|
var union_1 = tslib_1.__importDefault(require("lodash/union"));
|
|
30
31
|
var reducers_1 = require("../reducers");
|
|
31
|
-
var
|
|
32
|
+
var util_1 = require("./util");
|
|
33
|
+
var runtime_1 = require("./runtime");
|
|
32
34
|
var renderer_1 = require("./renderer");
|
|
35
|
+
var i18n_1 = require("../i18n");
|
|
33
36
|
/**
|
|
34
37
|
* Map state to cell props.
|
|
35
38
|
*
|
|
@@ -37,21 +40,36 @@ var renderer_1 = require("./renderer");
|
|
|
37
40
|
* @param ownProps any own props
|
|
38
41
|
* @returns {StatePropsOfCell} state props of a cell
|
|
39
42
|
*/
|
|
40
|
-
|
|
43
|
+
var mapStateToCellProps = function (state, ownProps) {
|
|
41
44
|
var id = ownProps.id, schema = ownProps.schema, path = ownProps.path, uischema = ownProps.uischema, renderers = ownProps.renderers, cells = ownProps.cells;
|
|
42
45
|
var rootData = reducers_1.getData(state);
|
|
43
46
|
var visible = ownProps.visible !== undefined
|
|
44
47
|
? ownProps.visible
|
|
45
|
-
:
|
|
46
|
-
var readonly = state.jsonforms.readonly;
|
|
47
|
-
var enabled = !readonly && (ownProps.enabled !== undefined
|
|
48
|
-
? ownProps.enabled
|
|
49
|
-
: _1.isEnabled(uischema, rootData, undefined, reducers_1.getAjv(state)));
|
|
50
|
-
var errors = _1.formatErrorMessage(union_1.default(reducers_1.getErrorAt(path, schema)(state).map(function (error) { return error.message; })));
|
|
51
|
-
var isValid = isEmpty_1.default(errors);
|
|
48
|
+
: runtime_1.isVisible(uischema, rootData, undefined, reducers_1.getAjv(state));
|
|
52
49
|
var rootSchema = reducers_1.getSchema(state);
|
|
50
|
+
var config = reducers_1.getConfig(state);
|
|
51
|
+
/* When determining the enabled state of cells we take a shortcut: At the
|
|
52
|
+
* moment it's only possible to configure enablement and disablement at the
|
|
53
|
+
* control level. Therefore the renderer using the cell, for example a
|
|
54
|
+
* table renderer, determines whether a cell is enabled and should hand
|
|
55
|
+
* over the prop themselves. If that prop was given, we prefer it over
|
|
56
|
+
* anything else to save evaluation effort (except for the global readonly
|
|
57
|
+
* flag). For example it would be quite expensive to evaluate the same ui schema
|
|
58
|
+
* rule again and again for each cell of a table. */
|
|
59
|
+
var enabled;
|
|
60
|
+
if (state.jsonforms.readonly === true) {
|
|
61
|
+
enabled = false;
|
|
62
|
+
}
|
|
63
|
+
else if (typeof ownProps.enabled === 'boolean') {
|
|
64
|
+
enabled = ownProps.enabled;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
enabled = runtime_1.isInherentlyEnabled(state, ownProps, uischema, schema || rootSchema, rootData, config);
|
|
68
|
+
}
|
|
69
|
+
var errors = util_1.formatErrorMessage(union_1.default(reducers_1.getErrorAt(path, schema)(state).map(function (error) { return error.message; })));
|
|
70
|
+
var isValid = isEmpty_1.default(errors);
|
|
53
71
|
return {
|
|
54
|
-
data:
|
|
72
|
+
data: util_1.Resolve.data(rootData, path),
|
|
55
73
|
visible: visible,
|
|
56
74
|
enabled: enabled,
|
|
57
75
|
id: id,
|
|
@@ -66,24 +84,48 @@ exports.mapStateToCellProps = function (state, ownProps) {
|
|
|
66
84
|
cells: cells
|
|
67
85
|
};
|
|
68
86
|
};
|
|
69
|
-
exports.
|
|
87
|
+
exports.mapStateToCellProps = mapStateToCellProps;
|
|
88
|
+
var mapStateToDispatchCellProps = function (state, ownProps) {
|
|
70
89
|
var props = exports.mapStateToCellProps(state, ownProps);
|
|
71
90
|
var renderers = ownProps.renderers, cells = ownProps.cells, otherOwnProps = tslib_1.__rest(ownProps, ["renderers", "cells"]);
|
|
72
91
|
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, props), otherOwnProps), { cells: cells || state.jsonforms.cells || [] });
|
|
73
92
|
};
|
|
93
|
+
exports.mapStateToDispatchCellProps = mapStateToDispatchCellProps;
|
|
74
94
|
/**
|
|
75
95
|
* Default mapStateToCellProps for enum cell. Options is used for populating dropdown list
|
|
76
96
|
* @param state
|
|
77
97
|
* @param ownProps
|
|
78
98
|
* @returns {StatePropsOfEnumCell}
|
|
79
99
|
*/
|
|
80
|
-
|
|
100
|
+
var defaultMapStateToEnumCellProps = function (state, ownProps) {
|
|
101
|
+
var _a;
|
|
102
|
+
var props = exports.mapStateToCellProps(state, ownProps);
|
|
103
|
+
var options = ownProps.options ||
|
|
104
|
+
((_a = props.schema.enum) === null || _a === void 0 ? void 0 : _a.map(function (e) {
|
|
105
|
+
return renderer_1.enumToEnumOptionMapper(e, reducers_1.getTranslator()(state), i18n_1.getI18nKeyPrefix(props.schema, props.uischema, props.path));
|
|
106
|
+
})) ||
|
|
107
|
+
(props.schema.const && [
|
|
108
|
+
renderer_1.enumToEnumOptionMapper(props.schema.const, reducers_1.getTranslator()(state), i18n_1.getI18nKeyPrefix(props.schema, props.uischema, props.path))
|
|
109
|
+
]);
|
|
110
|
+
return tslib_1.__assign(tslib_1.__assign({}, props), { options: options });
|
|
111
|
+
};
|
|
112
|
+
exports.defaultMapStateToEnumCellProps = defaultMapStateToEnumCellProps;
|
|
113
|
+
/**
|
|
114
|
+
* mapStateToOneOfEnumCellProps for one of enum cell. Options is used for populating dropdown list from oneOf
|
|
115
|
+
* @param state
|
|
116
|
+
* @param ownProps
|
|
117
|
+
* @returns {StatePropsOfEnumCell}
|
|
118
|
+
*/
|
|
119
|
+
var mapStateToOneOfEnumCellProps = function (state, ownProps) {
|
|
81
120
|
var _a;
|
|
82
121
|
var props = exports.mapStateToCellProps(state, ownProps);
|
|
83
|
-
var options = ownProps.options ||
|
|
84
|
-
props.schema.
|
|
122
|
+
var options = ownProps.options ||
|
|
123
|
+
((_a = props.schema.oneOf) === null || _a === void 0 ? void 0 : _a.map(function (oneOfSubSchema) {
|
|
124
|
+
return renderer_1.oneOfToEnumOptionMapper(oneOfSubSchema, reducers_1.getTranslator()(state), i18n_1.getI18nKeyPrefix(props.schema, props.uischema, props.path));
|
|
125
|
+
}));
|
|
85
126
|
return tslib_1.__assign(tslib_1.__assign({}, props), { options: options });
|
|
86
127
|
};
|
|
128
|
+
exports.mapStateToOneOfEnumCellProps = mapStateToOneOfEnumCellProps;
|
|
87
129
|
/**
|
|
88
130
|
* Synonym for mapDispatchToControlProps.
|
|
89
131
|
*
|
|
@@ -94,7 +136,7 @@ exports.mapDispatchToCellProps = renderer_1.mapDispatchToControlProps;
|
|
|
94
136
|
* Default dispatch to control props which can be customized to set handleChange action
|
|
95
137
|
*
|
|
96
138
|
*/
|
|
97
|
-
|
|
139
|
+
var defaultMapDispatchToControlProps =
|
|
98
140
|
// TODO: ownProps types
|
|
99
141
|
function (dispatch, ownProps) {
|
|
100
142
|
var handleChange = exports.mapDispatchToCellProps(dispatch).handleChange;
|
|
@@ -102,4 +144,5 @@ function (dispatch, ownProps) {
|
|
|
102
144
|
handleChange: ownProps.handleChange || handleChange
|
|
103
145
|
};
|
|
104
146
|
};
|
|
147
|
+
exports.defaultMapDispatchToControlProps = defaultMapDispatchToControlProps;
|
|
105
148
|
//# sourceMappingURL=cell.js.map
|
package/lib/util/cell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/util/cell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/util/cell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,mEAAqC;AACrC,+DAAiC;AACjC,wCAQqB;AAErB,+BAGgB;AAChB,qCAGmB;AACnB,uCASoB;AAGpB,gCAA2C;AAgD3C;;;;;;GAMG;AACI,IAAM,mBAAmB,GAAG,UACjC,KAAqB,EACrB,QAAwB;IAEhB,IAAA,EAAE,GAA+C,QAAQ,GAAvD,EAAE,MAAM,GAAuC,QAAQ,OAA/C,EAAE,IAAI,GAAiC,QAAQ,KAAzC,EAAE,QAAQ,GAAuB,QAAQ,SAA/B,EAAE,SAAS,GAAY,QAAQ,UAApB,EAAE,KAAK,GAAK,QAAQ,MAAb,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;;;;;;;wDAOoD;IACpD,IAAI,OAAO,CAAC;IACZ,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,EAAE;QACrC,OAAO,GAAG,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AC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAC3D;QAJD,CAIC,CACF,CAAA,CAAC;IACJ,6CACK,KAAK,KACR,OAAO,SAAA,IACP;AACJ,CAAC,CAAC;AAlBW,QAAA,4BAA4B,gCAkBvC;AAGF;;;;GAIG;AACU,QAAA,sBAAsB,GAEL,oCAAyB,CAAC;AAExD;;;GAGG;AACI,IAAM,gCAAgC;AAC3C,uBAAuB;AACvB,UAAC,QAA6B,EAAE,QAAa;IACnC,IAAA,YAAY,GAAK,8BAAsB,CAAC,QAAQ,CAAC,aAArC,CAAsC;IAE1D,OAAO;QACL,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,YAAY;KACpD,CAAC;AACJ,CAAC,CAAC;AARS,QAAA,gCAAgC,oCAQzC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { JsonSchema } from '../models
|
|
2
|
-
import {
|
|
3
|
-
import { JsonFormsUISchemaRegistryEntry } from '../reducers/uischemas';
|
|
1
|
+
import { ControlElement, JsonSchema, UISchemaElement } from '../models';
|
|
2
|
+
import { JsonFormsUISchemaRegistryEntry } from '../reducers';
|
|
4
3
|
export interface CombinatorSubSchemaRenderInfo {
|
|
5
4
|
schema: JsonSchema;
|
|
6
5
|
uischema: UISchemaElement;
|
package/lib/util/combinators.js
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
THE SOFTWARE.
|
|
25
25
|
*/
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.createCombinatorRenderInfos = exports.resolveSubSchemas = void 0;
|
|
27
28
|
var tslib_1 = require("tslib");
|
|
28
29
|
var resolvers_1 = require("./resolvers");
|
|
29
30
|
var reducers_1 = require("../reducers");
|
|
@@ -35,7 +36,7 @@ var createLabel = function (subSchema, subSchemaIndex, keyword) {
|
|
|
35
36
|
return keyword + '-' + subSchemaIndex;
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
|
|
39
|
+
var resolveSubSchemas = function (schema, rootSchema, keyword) {
|
|
39
40
|
var _a;
|
|
40
41
|
// resolve any $refs, otherwise the generated UI schema can't match the schema???
|
|
41
42
|
var schemas = schema[keyword];
|
|
@@ -46,11 +47,13 @@ exports.resolveSubSchemas = function (schema, rootSchema, keyword) {
|
|
|
46
47
|
}
|
|
47
48
|
return schema;
|
|
48
49
|
};
|
|
49
|
-
exports.
|
|
50
|
+
exports.resolveSubSchemas = resolveSubSchemas;
|
|
51
|
+
var createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
|
|
50
52
|
return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) { return ({
|
|
51
53
|
schema: subSchema,
|
|
52
54
|
uischema: reducers_1.findUISchema(uischemas, subSchema, control.scope, path, undefined, control, rootSchema),
|
|
53
55
|
label: createLabel(subSchema, subSchemaIndex, keyword)
|
|
54
56
|
}); });
|
|
55
57
|
};
|
|
58
|
+
exports.createCombinatorRenderInfos = createCombinatorRenderInfos;
|
|
56
59
|
//# sourceMappingURL=combinators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinators.js","sourceRoot":"","sources":["../../src/util/combinators.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE
|
|
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;AAEK,IAAM,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;AAhBW,QAAA,iBAAiB,qBAgB5B;AAEK,IAAM,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;AApBO,QAAA,2BAA2B,+BAoBlC"}
|
package/lib/util/ids.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
/*
|
|
4
3
|
The MIT License
|
|
5
4
|
|
|
@@ -24,6 +23,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
24
|
THE SOFTWARE.
|
|
26
25
|
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.clearAllIds = exports.removeId = exports.createId = void 0;
|
|
27
28
|
var usedIds = new Set();
|
|
28
29
|
var makeId = function (idBase, iteration) {
|
|
29
30
|
return iteration <= 1 ? idBase : idBase + iteration.toString();
|
|
@@ -32,7 +33,7 @@ var isUniqueId = function (idBase, iteration) {
|
|
|
32
33
|
var newID = makeId(idBase, iteration);
|
|
33
34
|
return !usedIds.has(newID);
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
var createId = function (proposedId) {
|
|
36
37
|
if (proposedId === undefined) {
|
|
37
38
|
// failsafe to avoid endless loops in error cases
|
|
38
39
|
proposedId = 'undefined';
|
|
@@ -45,6 +46,9 @@ exports.createId = function (proposedId) {
|
|
|
45
46
|
usedIds.add(newID);
|
|
46
47
|
return newID;
|
|
47
48
|
};
|
|
48
|
-
exports.
|
|
49
|
-
|
|
49
|
+
exports.createId = createId;
|
|
50
|
+
var removeId = function (id) { return usedIds.delete(id); };
|
|
51
|
+
exports.removeId = removeId;
|
|
52
|
+
var clearAllIds = function () { return usedIds.clear(); };
|
|
53
|
+
exports.clearAllIds = clearAllIds;
|
|
50
54
|
//# sourceMappingURL=ids.js.map
|
package/lib/util/ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/util/ids.ts"],"names":[],"mappings":"
|
|
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;AAEK,IAAM,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;AAZW,QAAA,QAAQ,YAYnB;AAEK,IAAM,QAAQ,GAAG,UAAC,EAAU,IAAK,OAAA,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAlB,CAAkB,CAAC;AAA9C,QAAA,QAAQ,YAAsC;AAEpD,IAAM,WAAW,GAAG,cAAM,OAAA,OAAO,CAAC,KAAK,EAAE,EAAf,CAAe,CAAC;AAApC,QAAA,WAAW,eAAyB"}
|
package/lib/util/index.d.ts
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { compose as composePaths, composeWithUi, toDataPath } from './path';
|
|
3
|
-
import { isEnabled, isVisible } from './runtime';
|
|
4
|
-
import { Ajv } from 'ajv';
|
|
5
|
-
export { createCleanLabel, createLabelDescriptionFrom } from './label';
|
|
6
|
-
/**
|
|
7
|
-
* Escape the given string such that it can be used as a class name,
|
|
8
|
-
* i.e. hashes and slashes will be replaced.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} s the string that should be converted to a valid class name
|
|
11
|
-
* @returns {string} the escaped string
|
|
12
|
-
*/
|
|
13
|
-
export declare const convertToValidClassName: (s: string) => string;
|
|
14
|
-
export declare const formatErrorMessage: (errors: string[]) => string;
|
|
15
|
-
declare const hasType: (jsonSchema: JsonSchema, expected: string) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Derives the type of the jsonSchema element
|
|
18
|
-
*/
|
|
19
|
-
declare const deriveTypes: (jsonSchema: JsonSchema) => string[];
|
|
20
|
-
/**
|
|
21
|
-
* Convenience wrapper around resolveData and resolveSchema.
|
|
22
|
-
*/
|
|
23
|
-
declare const Resolve: {
|
|
24
|
-
schema(schema: JsonSchema, schemaPath: string, rootSchema?: JsonSchema): JsonSchema;
|
|
25
|
-
data(data: any, path: string): any;
|
|
26
|
-
};
|
|
27
|
-
export { resolveData, resolveSchema, findRefs, SchemaRef, SchemaRefs } from './resolvers';
|
|
28
|
-
export { Resolve };
|
|
29
|
-
declare const Paths: {
|
|
30
|
-
compose: (path1: string, path2: string) => string;
|
|
31
|
-
fromScopable: (scopable: Scopable) => string;
|
|
32
|
-
};
|
|
33
|
-
export { composePaths, composeWithUi, Paths, toDataPath };
|
|
34
|
-
declare const Runtime: {
|
|
35
|
-
isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
|
|
36
|
-
isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
|
|
37
|
-
};
|
|
38
|
-
export { isEnabled, isVisible, Runtime, deriveTypes, hasType };
|
|
39
|
-
export * from './renderer';
|
|
1
|
+
export * from './array';
|
|
40
2
|
export * from './cell';
|
|
41
|
-
export * from './
|
|
3
|
+
export * from './combinators';
|
|
42
4
|
export * from './Formatted';
|
|
43
5
|
export * from './ids';
|
|
44
|
-
export * from './
|
|
45
|
-
export * from './
|
|
46
|
-
export * from './
|
|
47
|
-
export * from './
|
|
48
|
-
export * from './
|
|
6
|
+
export * from './label';
|
|
7
|
+
export * from './path';
|
|
8
|
+
export * from './renderer';
|
|
9
|
+
export * from './resolvers';
|
|
10
|
+
export * from './runtime';
|
|
49
11
|
export * from './schema';
|
|
12
|
+
export * from './type';
|
|
13
|
+
export * from './uischema';
|
|
14
|
+
export * from './util';
|
|
15
|
+
export * from './validator';
|
package/lib/util/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
2
|
/*
|
|
5
3
|
The MIT License
|
|
6
4
|
|
|
@@ -25,109 +23,21 @@ var tslib_1 = require("tslib");
|
|
|
25
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
24
|
THE SOFTWARE.
|
|
27
25
|
*/
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
var find_1 = tslib_1.__importDefault(require("lodash/find"));
|
|
32
|
-
var resolvers_1 = require("./resolvers");
|
|
33
|
-
var path_1 = require("./path");
|
|
34
|
-
exports.composePaths = path_1.compose;
|
|
35
|
-
exports.composeWithUi = path_1.composeWithUi;
|
|
36
|
-
exports.toDataPath = path_1.toDataPath;
|
|
37
|
-
var runtime_1 = require("./runtime");
|
|
38
|
-
exports.isEnabled = runtime_1.isEnabled;
|
|
39
|
-
exports.isVisible = runtime_1.isVisible;
|
|
40
|
-
var label_1 = require("./label");
|
|
41
|
-
exports.createCleanLabel = label_1.createCleanLabel;
|
|
42
|
-
exports.createLabelDescriptionFrom = label_1.createLabelDescriptionFrom;
|
|
43
|
-
/**
|
|
44
|
-
* Escape the given string such that it can be used as a class name,
|
|
45
|
-
* i.e. hashes and slashes will be replaced.
|
|
46
|
-
*
|
|
47
|
-
* @param {string} s the string that should be converted to a valid class name
|
|
48
|
-
* @returns {string} the escaped string
|
|
49
|
-
*/
|
|
50
|
-
exports.convertToValidClassName = function (s) {
|
|
51
|
-
return s.replace('#', 'root').replace(new RegExp('/', 'g'), '_');
|
|
52
|
-
};
|
|
53
|
-
exports.formatErrorMessage = function (errors) {
|
|
54
|
-
if (errors === undefined || errors === null) {
|
|
55
|
-
return '';
|
|
56
|
-
}
|
|
57
|
-
return errors.join('\n');
|
|
58
|
-
};
|
|
59
|
-
var hasType = function (jsonSchema, expected) {
|
|
60
|
-
return includes_1.default(deriveTypes(jsonSchema), expected);
|
|
61
|
-
};
|
|
62
|
-
exports.hasType = hasType;
|
|
63
|
-
/**
|
|
64
|
-
* Derives the type of the jsonSchema element
|
|
65
|
-
*/
|
|
66
|
-
var deriveTypes = function (jsonSchema) {
|
|
67
|
-
if (isEmpty_1.default(jsonSchema)) {
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
if (!isEmpty_1.default(jsonSchema.type) && typeof jsonSchema.type === 'string') {
|
|
71
|
-
return [jsonSchema.type];
|
|
72
|
-
}
|
|
73
|
-
if (isArray_1.default(jsonSchema.type)) {
|
|
74
|
-
return jsonSchema.type;
|
|
75
|
-
}
|
|
76
|
-
if (!isEmpty_1.default(jsonSchema.properties) ||
|
|
77
|
-
!isEmpty_1.default(jsonSchema.additionalProperties)) {
|
|
78
|
-
return ['object'];
|
|
79
|
-
}
|
|
80
|
-
if (!isEmpty_1.default(jsonSchema.items)) {
|
|
81
|
-
return ['array'];
|
|
82
|
-
}
|
|
83
|
-
if (!isEmpty_1.default(jsonSchema.allOf)) {
|
|
84
|
-
var allOfType = find_1.default(jsonSchema.allOf, function (schema) { return deriveTypes(schema).length !== 0; });
|
|
85
|
-
if (allOfType) {
|
|
86
|
-
return deriveTypes(allOfType);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// ignore all remaining cases
|
|
90
|
-
return [];
|
|
91
|
-
};
|
|
92
|
-
exports.deriveTypes = deriveTypes;
|
|
93
|
-
/**
|
|
94
|
-
* Convenience wrapper around resolveData and resolveSchema.
|
|
95
|
-
*/
|
|
96
|
-
var Resolve = {
|
|
97
|
-
schema: resolvers_1.resolveSchema,
|
|
98
|
-
data: resolvers_1.resolveData
|
|
99
|
-
};
|
|
100
|
-
exports.Resolve = Resolve;
|
|
101
|
-
var resolvers_2 = require("./resolvers");
|
|
102
|
-
exports.resolveData = resolvers_2.resolveData;
|
|
103
|
-
exports.resolveSchema = resolvers_2.resolveSchema;
|
|
104
|
-
exports.findRefs = resolvers_2.findRefs;
|
|
105
|
-
// Paths --
|
|
106
|
-
var fromScopable = function (scopable) {
|
|
107
|
-
return path_1.toDataPathSegments(scopable.scope).join('.');
|
|
108
|
-
};
|
|
109
|
-
var Paths = {
|
|
110
|
-
compose: path_1.compose,
|
|
111
|
-
fromScopable: fromScopable
|
|
112
|
-
};
|
|
113
|
-
exports.Paths = Paths;
|
|
114
|
-
// Runtime --
|
|
115
|
-
var Runtime = {
|
|
116
|
-
isEnabled: function (uischema, data, ajv) {
|
|
117
|
-
return runtime_1.isEnabled(uischema, data, undefined, ajv);
|
|
118
|
-
},
|
|
119
|
-
isVisible: function (uischema, data, ajv) {
|
|
120
|
-
return runtime_1.isVisible(uischema, data, undefined, ajv);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
exports.Runtime = Runtime;
|
|
124
|
-
tslib_1.__exportStar(require("./renderer"), exports);
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
var tslib_1 = require("tslib");
|
|
28
|
+
tslib_1.__exportStar(require("./array"), exports);
|
|
125
29
|
tslib_1.__exportStar(require("./cell"), exports);
|
|
126
|
-
tslib_1.__exportStar(require("./runtime"), exports);
|
|
127
|
-
tslib_1.__exportStar(require("./ids"), exports);
|
|
128
|
-
tslib_1.__exportStar(require("./validator"), exports);
|
|
129
30
|
tslib_1.__exportStar(require("./combinators"), exports);
|
|
130
|
-
tslib_1.__exportStar(require("./
|
|
131
|
-
tslib_1.__exportStar(require("./
|
|
31
|
+
tslib_1.__exportStar(require("./Formatted"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./ids"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./label"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./path"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./renderer"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./resolvers"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./runtime"), exports);
|
|
132
38
|
tslib_1.__exportStar(require("./schema"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./type"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./uischema"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./util"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./validator"), exports);
|
|
133
43
|
//# sourceMappingURL=index.js.map
|
package/lib/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,kDAAwB;AACxB,iDAAuB;AACvB,wDAA8B;AAC9B,sDAA4B;AAC5B,gDAAsB;AACtB,kDAAwB;AACxB,iDAAuB;AACvB,qDAA2B;AAC3B,sDAA4B;AAC5B,oDAA0B;AAC1B,mDAAyB;AACzB,iDAAuB;AACvB,qDAA2B;AAC3B,iDAAuB;AACvB,sDAA4B"}
|
package/lib/util/label.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ControlElement, LabelDescription } from '../models
|
|
2
|
-
import { JsonSchema } from '../models/jsonSchema';
|
|
1
|
+
import { ControlElement, JsonSchema, LabelDescription } from '../models';
|
|
3
2
|
export declare const createCleanLabel: (label: string) => string;
|
|
4
3
|
/**
|
|
5
4
|
* Return a label object based on the given control and schema element.
|
package/lib/util/label.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
2
|
/*
|
|
5
3
|
The MIT License
|
|
6
4
|
|
|
@@ -25,6 +23,9 @@ var tslib_1 = require("tslib");
|
|
|
25
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
24
|
THE SOFTWARE.
|
|
27
25
|
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.createLabelDescriptionFrom = exports.createCleanLabel = void 0;
|
|
28
|
+
var tslib_1 = require("tslib");
|
|
28
29
|
var startCase_1 = tslib_1.__importDefault(require("lodash/startCase"));
|
|
29
30
|
var deriveLabel = function (controlElement, schemaElement) {
|
|
30
31
|
if (schemaElement && typeof schemaElement.title === 'string') {
|
|
@@ -37,16 +38,17 @@ var deriveLabel = function (controlElement, schemaElement) {
|
|
|
37
38
|
}
|
|
38
39
|
return '';
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
+
var createCleanLabel = function (label) {
|
|
41
42
|
return startCase_1.default(label.replace('_', ' '));
|
|
42
43
|
};
|
|
44
|
+
exports.createCleanLabel = createCleanLabel;
|
|
43
45
|
/**
|
|
44
46
|
* Return a label object based on the given control and schema element.
|
|
45
47
|
* @param {ControlElement} withLabel the UI schema to obtain a label object for
|
|
46
48
|
* @param {JsonSchema} schema optional: the corresponding schema element
|
|
47
49
|
* @returns {LabelDescription}
|
|
48
50
|
*/
|
|
49
|
-
|
|
51
|
+
var createLabelDescriptionFrom = function (withLabel, schema) {
|
|
50
52
|
var labelProperty = withLabel.label;
|
|
51
53
|
if (typeof labelProperty === 'boolean') {
|
|
52
54
|
return labelDescription(deriveLabel(withLabel, schema), labelProperty);
|
|
@@ -63,6 +65,7 @@ exports.createLabelDescriptionFrom = function (withLabel, schema) {
|
|
|
63
65
|
}
|
|
64
66
|
return labelDescription(deriveLabel(withLabel, schema), true);
|
|
65
67
|
};
|
|
68
|
+
exports.createLabelDescriptionFrom = createLabelDescriptionFrom;
|
|
66
69
|
var labelDescription = function (text, show) { return ({
|
|
67
70
|
text: text,
|
|
68
71
|
show: show
|
package/lib/util/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/util/label.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/util/label.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,uEAAyC;AAIzC,IAAM,WAAW,GAAG,UAClB,cAA8B,EAC9B,aAA0B;IAE1B,IAAI,aAAa,IAAI,OAAO,aAAa,CAAC,KAAK,KAAK,QAAQ,EAAE;QAC5D,OAAO,aAAa,CAAC,KAAK,CAAC;KAC5B;IACD,IAAI,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,EAAE;QAC5C,IAAM,GAAG,GAAG,cAAc,CAAC,KAAK,CAAC;QACjC,IAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAEnD,OAAO,mBAAS,CAAC,KAAK,CAAC,CAAC;KACzB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEK,IAAM,gBAAgB,GAAG,UAAC,KAAa;IAC5C,OAAO,mBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEF;;;;;GAKG;AACI,IAAM,0BAA0B,GAAG,UACxC,SAAyB,EACzB,MAAmB;IAEnB,IAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC;IACtC,IAAI,OAAO,aAAa,KAAK,SAAS,EAAE;QACtC,OAAO,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC;KACxE;IACD,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QACrC,OAAO,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;KAC9C;IACD,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QACrC,IAAM,KAAK,GACT,OAAO,aAAa,CAAC,IAAI,KAAK,QAAQ;YACpC,CAAC,CAAC,aAAa,CAAC,IAAI;YACpB,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACrC,IAAM,IAAI,GACR,OAAO,aAAa,CAAC,IAAI,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;AArBW,QAAA,0BAA0B,8BAqBrC;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.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Scopable } from '../';
|
|
1
|
+
import { Scopable } from '../models';
|
|
2
2
|
export declare const compose: (path1: string, path2: string) => string;
|
|
3
|
+
export { compose as composePaths };
|
|
3
4
|
/**
|
|
4
5
|
* Convert a schema path (i.e. JSON pointer) to an array by splitting
|
|
5
6
|
* at the '/' character and removing all schema-specific keywords.
|
package/lib/util/path.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
2
|
/*
|
|
5
3
|
The MIT License
|
|
6
4
|
|
|
@@ -25,9 +23,12 @@ var tslib_1 = require("tslib");
|
|
|
25
23
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
24
|
THE SOFTWARE.
|
|
27
25
|
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.composeWithUi = exports.toDataPath = exports.toDataPathSegments = exports.composePaths = exports.compose = void 0;
|
|
28
|
+
var tslib_1 = require("tslib");
|
|
28
29
|
var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
29
30
|
var range_1 = tslib_1.__importDefault(require("lodash/range"));
|
|
30
|
-
|
|
31
|
+
var compose = function (path1, path2) {
|
|
31
32
|
var p1 = path1;
|
|
32
33
|
if (!isEmpty_1.default(path1) && !isEmpty_1.default(path2) && !path2.startsWith('[')) {
|
|
33
34
|
p1 = path1 + '.';
|
|
@@ -42,6 +43,8 @@ exports.compose = function (path1, path2) {
|
|
|
42
43
|
return "" + p1 + path2;
|
|
43
44
|
}
|
|
44
45
|
};
|
|
46
|
+
exports.compose = compose;
|
|
47
|
+
exports.composePaths = exports.compose;
|
|
45
48
|
/**
|
|
46
49
|
* Convert a schema path (i.e. JSON pointer) to an array by splitting
|
|
47
50
|
* at the '/' character and removing all schema-specific keywords.
|
|
@@ -53,7 +56,7 @@ exports.compose = function (path1, path2) {
|
|
|
53
56
|
* @param {string} schemaPath the schema path to be converted
|
|
54
57
|
* @returns {string[]} an array containing only non-schema-specific segments
|
|
55
58
|
*/
|
|
56
|
-
|
|
59
|
+
var toDataPathSegments = function (schemaPath) {
|
|
57
60
|
var s = schemaPath
|
|
58
61
|
.replace(/anyOf\/[\d]\//g, '')
|
|
59
62
|
.replace(/allOf\/[\d]\//g, '')
|
|
@@ -63,6 +66,7 @@ exports.toDataPathSegments = function (schemaPath) {
|
|
|
63
66
|
var startIndex = startFromRoot ? 2 : 1;
|
|
64
67
|
return range_1.default(startIndex, segments.length, 2).map(function (idx) { return segments[idx]; });
|
|
65
68
|
};
|
|
69
|
+
exports.toDataPathSegments = toDataPathSegments;
|
|
66
70
|
/**
|
|
67
71
|
* Remove all schema-specific keywords (e.g. 'properties') from a given path.
|
|
68
72
|
* @example
|
|
@@ -71,14 +75,16 @@ exports.toDataPathSegments = function (schemaPath) {
|
|
|
71
75
|
* @param {string} schemaPath the schema path to be converted
|
|
72
76
|
* @returns {string} the path without schema-specific keywords
|
|
73
77
|
*/
|
|
74
|
-
|
|
78
|
+
var toDataPath = function (schemaPath) {
|
|
75
79
|
return exports.toDataPathSegments(schemaPath).join('.');
|
|
76
80
|
};
|
|
77
|
-
exports.
|
|
81
|
+
exports.toDataPath = toDataPath;
|
|
82
|
+
var composeWithUi = function (scopableUi, path) {
|
|
78
83
|
var segments = exports.toDataPathSegments(scopableUi.scope);
|
|
79
84
|
if (isEmpty_1.default(segments) && path === undefined) {
|
|
80
85
|
return '';
|
|
81
86
|
}
|
|
82
87
|
return isEmpty_1.default(segments) ? path : exports.compose(path, segments.join('.'));
|
|
83
88
|
};
|
|
89
|
+
exports.composeWithUi = composeWithUi;
|
|
84
90
|
//# sourceMappingURL=path.js.map
|
package/lib/util/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/util/path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/util/path.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,mEAAqC;AACrC,+DAAiC;AAG1B,IAAM,OAAO,GAAG,UAAC,KAAa,EAAE,KAAa;IAClD,IAAI,EAAE,GAAG,KAAK,CAAC;IACf,IAAI,CAAC,iBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KA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