@jsonforms/core 3.4.0-alpha.2 → 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.2",
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",
@@ -1249,6 +1249,7 @@ export const mapStateToLabelProps = (
1249
1249
  config: getConfig(state),
1250
1250
  renderers: props.renderers || getRenderers(state),
1251
1251
  cells: props.cells || getCells(state),
1252
+ uischema,
1252
1253
  };
1253
1254
  };
1254
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
  };