@jsonforms/core 3.4.0-alpha.2 → 3.4.0-beta.0
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/lib/jsonforms-core.cjs.js +16 -12
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +13 -12
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/lib/mappers/renderer.d.ts +2 -4
- package/lib/util/schema.d.ts +1 -1
- package/package.json +1 -1
- package/src/mappers/renderer.ts +3 -31
- package/src/util/schema.ts +21 -10
|
@@ -749,12 +749,18 @@ var isEnabled = function (uischema, data, path, ajv) {
|
|
|
749
749
|
};
|
|
750
750
|
|
|
751
751
|
var getFirstPrimitiveProp = function (schema) {
|
|
752
|
-
if (schema
|
|
752
|
+
if (schema &&
|
|
753
|
+
typeof schema === 'object' &&
|
|
754
|
+
'properties' in schema &&
|
|
755
|
+
schema.properties) {
|
|
753
756
|
return find__default["default"](Object.keys(schema.properties), function (propName) {
|
|
754
757
|
var prop = schema.properties[propName];
|
|
755
|
-
return (prop
|
|
756
|
-
prop
|
|
757
|
-
|
|
758
|
+
return (prop &&
|
|
759
|
+
typeof prop === 'object' &&
|
|
760
|
+
'type' in prop &&
|
|
761
|
+
(prop.type === 'string' ||
|
|
762
|
+
prop.type === 'number' ||
|
|
763
|
+
prop.type === 'integer'));
|
|
758
764
|
});
|
|
759
765
|
}
|
|
760
766
|
return undefined;
|
|
@@ -2374,11 +2380,10 @@ var mapStateToControlWithDetailProps = function (state, ownProps) {
|
|
|
2374
2380
|
return __assign(__assign({}, props), { uischemas: state.jsonforms.uischemas });
|
|
2375
2381
|
};
|
|
2376
2382
|
var mapStateToArrayControlProps = function (state, ownProps) {
|
|
2377
|
-
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema,
|
|
2383
|
+
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, label = _a.label, props = __rest(_a, ["path", "schema", "uischema", "label"]);
|
|
2378
2384
|
var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
2379
2385
|
var childErrors = getSubErrorsAt(path, resolvedSchema)(state);
|
|
2380
|
-
|
|
2381
|
-
return __assign(__assign({}, props), { label: label, path: path, uischema: uischema, schema: resolvedSchema, childErrors: childErrors, renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label) });
|
|
2386
|
+
return __assign(__assign({}, props), { label: label, path: path, uischema: uischema, schema: resolvedSchema, childErrors: childErrors, renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state) });
|
|
2382
2387
|
};
|
|
2383
2388
|
var mapDispatchToArrayControlProps = function (dispatch) { return ({
|
|
2384
2389
|
addItem: function (path, value) { return function () {
|
|
@@ -2485,8 +2490,6 @@ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
|
2485
2490
|
var _a;
|
|
2486
2491
|
var _b = mapStateToControlProps(state, ownProps), data = _b.data, schema = _b.schema, rootSchema = _b.rootSchema, i18nKeyPrefix = _b.i18nKeyPrefix, label = _b.label, props = __rest(_b, ["data", "schema", "rootSchema", "i18nKeyPrefix", "label"]);
|
|
2487
2492
|
var ajv = state.jsonforms.core.ajv;
|
|
2488
|
-
var t = getTranslator()(state);
|
|
2489
|
-
var translations = getCombinatorTranslations(t, combinatorDefaultTranslations, i18nKeyPrefix, label);
|
|
2490
2493
|
var structuralKeywords = [
|
|
2491
2494
|
'required',
|
|
2492
2495
|
'additionalProperties',
|
|
@@ -2517,7 +2520,7 @@ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
|
2517
2520
|
console.debug("Combinator subschema is not self contained, can't hand it over to AJV");
|
|
2518
2521
|
}
|
|
2519
2522
|
}
|
|
2520
|
-
return __assign(__assign({ data: data, schema: schema, rootSchema: rootSchema }, props), { i18nKeyPrefix: i18nKeyPrefix, label: label, indexOfFittingSchema: indexOfFittingSchema, uischemas: getUISchemas(state)
|
|
2523
|
+
return __assign(__assign({ data: data, schema: schema, rootSchema: rootSchema }, props), { i18nKeyPrefix: i18nKeyPrefix, label: label, indexOfFittingSchema: indexOfFittingSchema, uischemas: getUISchemas(state) });
|
|
2521
2524
|
};
|
|
2522
2525
|
var mapStateToAllOfProps = function (state, ownProps) {
|
|
2523
2526
|
return mapStateToCombinatorRendererProps(state, ownProps, 'allOf');
|
|
@@ -2529,14 +2532,14 @@ var mapStateToOneOfProps = function (state, ownProps) {
|
|
|
2529
2532
|
return mapStateToCombinatorRendererProps(state, ownProps, 'oneOf');
|
|
2530
2533
|
};
|
|
2531
2534
|
var mapStateToArrayLayoutProps = function (state, ownProps) {
|
|
2532
|
-
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, errors = _a.errors,
|
|
2535
|
+
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, errors = _a.errors, label = _a.label, props = __rest(_a, ["path", "schema", "uischema", "errors", "label"]);
|
|
2533
2536
|
var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
2534
2537
|
var t = getTranslator()(state);
|
|
2535
2538
|
var childErrors = getCombinedErrorMessage(getSubErrorsAt(path, resolvedSchema)(state), getErrorTranslator()(state), t, undefined, undefined, undefined);
|
|
2536
2539
|
var allErrors = errors +
|
|
2537
2540
|
(errors.length > 0 && childErrors.length > 0 ? '\n' : '') +
|
|
2538
2541
|
childErrors;
|
|
2539
|
-
return __assign(__assign({}, props), { label: label, path: path, uischema: uischema, schema: resolvedSchema, data: props.data ? props.data.length : 0, errors: allErrors, minItems: schema.minItems
|
|
2542
|
+
return __assign(__assign({}, props), { label: label, path: path, uischema: uischema, schema: resolvedSchema, data: props.data ? props.data.length : 0, errors: allErrors, minItems: schema.minItems });
|
|
2540
2543
|
};
|
|
2541
2544
|
var mapStateToLabelProps = function (state, props) {
|
|
2542
2545
|
var uischema = props.uischema;
|
|
@@ -2554,6 +2557,7 @@ var mapStateToLabelProps = function (state, props) {
|
|
|
2554
2557
|
config: getConfig(state),
|
|
2555
2558
|
renderers: props.renderers || getRenderers(state),
|
|
2556
2559
|
cells: props.cells || getCells(state),
|
|
2560
|
+
uischema: uischema,
|
|
2557
2561
|
};
|
|
2558
2562
|
};
|
|
2559
2563
|
var computeChildLabel = function (data, childPath, childLabelProp, schema, rootSchema, translateFct, uiSchema) {
|