@jsonforms/core 3.4.0-alpha.1 → 3.4.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.
@@ -429,6 +429,7 @@ export declare const mapStateToLabelProps: (state: JsonFormsState, props: OwnPro
429
429
  config: any;
430
430
  renderers: JsonFormsRendererRegistryEntry[];
431
431
  cells: JsonFormsCellRendererRegistryEntry[];
432
+ uischema: LabelElement;
432
433
  };
433
434
  /**
434
435
  * Compute the child label title for array based controls
@@ -1,5 +1,5 @@
1
1
  import type { JsonSchema } from '../models';
2
- export declare const getFirstPrimitiveProp: (schema: any) => string;
2
+ export declare const getFirstPrimitiveProp: (schema: unknown) => string;
3
3
  /**
4
4
  * Tests whether the schema has an enum based on oneOf.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/core",
3
- "version": "3.4.0-alpha.1",
3
+ "version": "3.4.0-alpha.3",
4
4
  "description": "Core module of JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -73,6 +73,7 @@ import {
73
73
  isVisible,
74
74
  Resolve,
75
75
  resolveSchema,
76
+ decode,
76
77
  } from '../util';
77
78
  import {
78
79
  Translator,
@@ -114,7 +115,7 @@ const isRequired = (
114
115
  rootSchema: JsonSchema
115
116
  ): boolean => {
116
117
  const pathSegments = schemaPath.split('/');
117
- const lastSegment = pathSegments[pathSegments.length - 1];
118
+ const lastSegment = decode(pathSegments[pathSegments.length - 1]);
118
119
  // Skip "properties", "items" etc. to resolve the parent
119
120
  const nextHigherSchemaSegments = pathSegments.slice(
120
121
  0,
@@ -1248,6 +1249,7 @@ export const mapStateToLabelProps = (
1248
1249
  config: getConfig(state),
1249
1250
  renderers: props.renderers || getRenderers(state),
1250
1251
  cells: props.cells || getCells(state),
1252
+ uischema,
1251
1253
  };
1252
1254
  };
1253
1255
 
@@ -26,16 +26,27 @@
26
26
  import find from 'lodash/find';
27
27
  import type { JsonSchema } from '../models';
28
28
 
29
- export const getFirstPrimitiveProp = (schema: any) => {
30
- if (schema.properties) {
31
- return find(Object.keys(schema.properties), (propName) => {
32
- const prop = schema.properties[propName];
33
- return (
34
- prop.type === 'string' ||
35
- prop.type === 'number' ||
36
- prop.type === 'integer'
37
- );
38
- });
29
+ export const getFirstPrimitiveProp = (schema: unknown) => {
30
+ if (
31
+ schema &&
32
+ typeof schema === 'object' &&
33
+ 'properties' in schema &&
34
+ schema.properties
35
+ ) {
36
+ return find(
37
+ Object.keys(schema.properties),
38
+ (propName: keyof typeof schema.properties) => {
39
+ const prop: unknown = schema.properties[propName];
40
+ return (
41
+ prop &&
42
+ typeof prop === 'object' &&
43
+ 'type' in prop &&
44
+ (prop.type === 'string' ||
45
+ prop.type === 'number' ||
46
+ prop.type === 'integer')
47
+ );
48
+ }
49
+ );
39
50
  }
40
51
  return undefined;
41
52
  };