@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.
- package/lib/jsonforms-core.cjs.js +12 -5
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +12 -5
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/lib/mappers/renderer.d.ts +1 -0
- package/lib/util/schema.d.ts +1 -1
- package/package.json +1 -1
- package/src/mappers/renderer.ts +3 -1
- package/src/util/schema.ts +21 -10
|
@@ -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
|
package/lib/util/schema.d.ts
CHANGED
package/package.json
CHANGED
package/src/mappers/renderer.ts
CHANGED
|
@@ -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
|
|
package/src/util/schema.ts
CHANGED
|
@@ -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:
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
};
|