@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
|
@@ -616,12 +616,18 @@ const isEnabled = (uischema, data, path = undefined, ajv) => {
|
|
|
616
616
|
};
|
|
617
617
|
|
|
618
618
|
const getFirstPrimitiveProp = (schema) => {
|
|
619
|
-
if (schema
|
|
619
|
+
if (schema &&
|
|
620
|
+
typeof schema === 'object' &&
|
|
621
|
+
'properties' in schema &&
|
|
622
|
+
schema.properties) {
|
|
620
623
|
return find(Object.keys(schema.properties), (propName) => {
|
|
621
624
|
const prop = schema.properties[propName];
|
|
622
|
-
return (prop
|
|
623
|
-
prop
|
|
624
|
-
|
|
625
|
+
return (prop &&
|
|
626
|
+
typeof prop === 'object' &&
|
|
627
|
+
'type' in prop &&
|
|
628
|
+
(prop.type === 'string' ||
|
|
629
|
+
prop.type === 'number' ||
|
|
630
|
+
prop.type === 'integer'));
|
|
625
631
|
});
|
|
626
632
|
}
|
|
627
633
|
return undefined;
|
|
@@ -2177,10 +2183,9 @@ const mapStateToControlWithDetailProps = (state, ownProps) => {
|
|
|
2177
2183
|
};
|
|
2178
2184
|
};
|
|
2179
2185
|
const mapStateToArrayControlProps = (state, ownProps) => {
|
|
2180
|
-
const { path, schema, uischema,
|
|
2186
|
+
const { path, schema, uischema, label, ...props } = mapStateToControlWithDetailProps(state, ownProps);
|
|
2181
2187
|
const resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
2182
2188
|
const childErrors = getSubErrorsAt(path, resolvedSchema)(state);
|
|
2183
|
-
const t = getTranslator()(state);
|
|
2184
2189
|
return {
|
|
2185
2190
|
...props,
|
|
2186
2191
|
label,
|
|
@@ -2190,7 +2195,6 @@ const mapStateToArrayControlProps = (state, ownProps) => {
|
|
|
2190
2195
|
childErrors,
|
|
2191
2196
|
renderers: ownProps.renderers || getRenderers(state),
|
|
2192
2197
|
cells: ownProps.cells || getCells(state),
|
|
2193
|
-
translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label),
|
|
2194
2198
|
};
|
|
2195
2199
|
};
|
|
2196
2200
|
const mapDispatchToArrayControlProps = (dispatch) => ({
|
|
@@ -2312,8 +2316,6 @@ const controlDefaultProps = {
|
|
|
2312
2316
|
const mapStateToCombinatorRendererProps = (state, ownProps, keyword) => {
|
|
2313
2317
|
const { data, schema, rootSchema, i18nKeyPrefix, label, ...props } = mapStateToControlProps(state, ownProps);
|
|
2314
2318
|
const ajv = state.jsonforms.core.ajv;
|
|
2315
|
-
const t = getTranslator()(state);
|
|
2316
|
-
const translations = getCombinatorTranslations(t, combinatorDefaultTranslations, i18nKeyPrefix, label);
|
|
2317
2319
|
const structuralKeywords = [
|
|
2318
2320
|
'required',
|
|
2319
2321
|
'additionalProperties',
|
|
@@ -2353,7 +2355,6 @@ const mapStateToCombinatorRendererProps = (state, ownProps, keyword) => {
|
|
|
2353
2355
|
label,
|
|
2354
2356
|
indexOfFittingSchema,
|
|
2355
2357
|
uischemas: getUISchemas(state),
|
|
2356
|
-
translations,
|
|
2357
2358
|
};
|
|
2358
2359
|
};
|
|
2359
2360
|
const mapStateToAllOfProps = (state, ownProps) => mapStateToCombinatorRendererProps(state, ownProps, 'allOf');
|
|
@@ -2364,7 +2365,7 @@ const mapStateToOneOfProps = (state, ownProps) => {
|
|
|
2364
2365
|
return mapStateToCombinatorRendererProps(state, ownProps, 'oneOf');
|
|
2365
2366
|
};
|
|
2366
2367
|
const mapStateToArrayLayoutProps = (state, ownProps) => {
|
|
2367
|
-
const { path, schema, uischema, errors,
|
|
2368
|
+
const { path, schema, uischema, errors, label, ...props } = mapStateToControlWithDetailProps(state, ownProps);
|
|
2368
2369
|
const resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
2369
2370
|
const t = getTranslator()(state);
|
|
2370
2371
|
const childErrors = getCombinedErrorMessage(getSubErrorsAt(path, resolvedSchema)(state), getErrorTranslator()(state), t, undefined, undefined, undefined);
|
|
@@ -2380,7 +2381,6 @@ const mapStateToArrayLayoutProps = (state, ownProps) => {
|
|
|
2380
2381
|
data: props.data ? props.data.length : 0,
|
|
2381
2382
|
errors: allErrors,
|
|
2382
2383
|
minItems: schema.minItems,
|
|
2383
|
-
translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label),
|
|
2384
2384
|
};
|
|
2385
2385
|
};
|
|
2386
2386
|
const mapStateToLabelProps = (state, props) => {
|
|
@@ -2399,6 +2399,7 @@ const mapStateToLabelProps = (state, props) => {
|
|
|
2399
2399
|
config: getConfig(state),
|
|
2400
2400
|
renderers: props.renderers || getRenderers(state),
|
|
2401
2401
|
cells: props.cells || getCells(state),
|
|
2402
|
+
uischema,
|
|
2402
2403
|
};
|
|
2403
2404
|
};
|
|
2404
2405
|
const computeChildLabel = (data, childPath, childLabelProp, schema, rootSchema, translateFct, uiSchema) => {
|