@nolwenture/formik-jsonschema-form 1.3.9 → 1.4.1
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/dist/cjs/Form/fields/ObjectField/ObjectField.js +5 -8
- package/dist/cjs/FormView/templates/ObjectFieldTemplate/styledComponents.js +10 -0
- package/dist/cjs/utils/solveReferences.js +2 -3
- package/dist/esm/Form/fields/ObjectField/ObjectField.js +5 -8
- package/dist/esm/FormView/templates/ObjectFieldTemplate/styledComponents.js +10 -0
- package/dist/esm/utils/solveReferences.js +2 -3
- package/package.json +2 -2
|
@@ -105,14 +105,11 @@ const ObjectField = (props) => {
|
|
|
105
105
|
}, style: { display: "none" } }, child));
|
|
106
106
|
}), showAdditionalProperties &&
|
|
107
107
|
orderedAdditionalProperties.map((childName, index) => {
|
|
108
|
-
let correctUiSchema =
|
|
109
|
-
|
|
110
|
-
uiSchema?.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"ui:order": uiSchema.properties?.["ui:order"],
|
|
114
|
-
};
|
|
115
|
-
}
|
|
108
|
+
let correctUiSchema = {
|
|
109
|
+
...(uiSchema?.additionalProperties ?? {}),
|
|
110
|
+
...(uiSchema?.properties ?? {}),
|
|
111
|
+
...(uiSchema?.[childName] ?? {}),
|
|
112
|
+
};
|
|
116
113
|
return ((0, jsx_runtime_1.jsxs)(ObjectFieldItem, { children: [(0, jsx_runtime_1.jsx)(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema: prepareChildSchema(schema.additionalProperties, schema), uiSchema: correctUiSchema }, childName), (0, jsx_runtime_1.jsxs)(ObjectFieldItemButtons, { children: [onAdditionalPropertyOrderChange &&
|
|
117
114
|
index > 0 &&
|
|
118
115
|
getObjectFieldButton({
|
|
@@ -10,6 +10,16 @@ exports.ObjectFieldTemplateWrapper = styled_components_1.default.div `
|
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
gap: ${(props) => props.theme.spacing.l};
|
|
13
|
+
|
|
14
|
+
@media print {
|
|
15
|
+
display: block;
|
|
16
|
+
break-inside: auto;
|
|
17
|
+
page-break-inside: auto;
|
|
18
|
+
|
|
19
|
+
& > div {
|
|
20
|
+
margin-bottom: 1rem;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
13
23
|
`;
|
|
14
24
|
exports.ObjectFieldTemplateTitle = styled_components_1.default.div `
|
|
15
25
|
color: ${(props) => props.theme.color.text.default};
|
|
@@ -14,9 +14,8 @@ function solveReferences(schema, definitions, uiSchema, uiSchemaDefinitions) {
|
|
|
14
14
|
const path = pathParts.slice(2).join(".");
|
|
15
15
|
const uiPath = pathParts
|
|
16
16
|
.slice(2)
|
|
17
|
-
.join(".")
|
|
18
|
-
.replaceAll(/\.
|
|
19
|
-
.replaceAll(/\.additionalItems/g, ".items");
|
|
17
|
+
.join(".")
|
|
18
|
+
.replaceAll(/\.properties(\.\w+)?/g, "$1");
|
|
20
19
|
// TODO: Should we overwrite rather than merge? Maybe add a flag for choosing the behavior?
|
|
21
20
|
solvedSchema = (0, mergeSchemas_1.mergeSchemas)((0, formik_1.getIn)(definitions, path) ?? {}, schema ?? {});
|
|
22
21
|
delete solvedSchema.$ref;
|
|
@@ -102,14 +102,11 @@ export const ObjectField = (props) => {
|
|
|
102
102
|
}, style: { display: "none" } }, child));
|
|
103
103
|
}), showAdditionalProperties &&
|
|
104
104
|
orderedAdditionalProperties.map((childName, index) => {
|
|
105
|
-
let correctUiSchema =
|
|
106
|
-
|
|
107
|
-
uiSchema?.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"ui:order": uiSchema.properties?.["ui:order"],
|
|
111
|
-
};
|
|
112
|
-
}
|
|
105
|
+
let correctUiSchema = {
|
|
106
|
+
...(uiSchema?.additionalProperties ?? {}),
|
|
107
|
+
...(uiSchema?.properties ?? {}),
|
|
108
|
+
...(uiSchema?.[childName] ?? {}),
|
|
109
|
+
};
|
|
113
110
|
return (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema: prepareChildSchema(schema.additionalProperties, schema), uiSchema: correctUiSchema }, childName), _jsxs(ObjectFieldItemButtons, { children: [onAdditionalPropertyOrderChange &&
|
|
114
111
|
index > 0 &&
|
|
115
112
|
getObjectFieldButton({
|
|
@@ -3,6 +3,16 @@ export const ObjectFieldTemplateWrapper = styled.div `
|
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
gap: ${(props) => props.theme.spacing.l};
|
|
6
|
+
|
|
7
|
+
@media print {
|
|
8
|
+
display: block;
|
|
9
|
+
break-inside: auto;
|
|
10
|
+
page-break-inside: auto;
|
|
11
|
+
|
|
12
|
+
& > div {
|
|
13
|
+
margin-bottom: 1rem;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
6
16
|
`;
|
|
7
17
|
export const ObjectFieldTemplateTitle = styled.div `
|
|
8
18
|
color: ${(props) => props.theme.color.text.default};
|
|
@@ -11,9 +11,8 @@ export function solveReferences(schema, definitions, uiSchema, uiSchemaDefinitio
|
|
|
11
11
|
const path = pathParts.slice(2).join(".");
|
|
12
12
|
const uiPath = pathParts
|
|
13
13
|
.slice(2)
|
|
14
|
-
.join(".")
|
|
15
|
-
.replaceAll(/\.
|
|
16
|
-
.replaceAll(/\.additionalItems/g, ".items");
|
|
14
|
+
.join(".")
|
|
15
|
+
.replaceAll(/\.properties(\.\w+)?/g, "$1");
|
|
17
16
|
// TODO: Should we overwrite rather than merge? Maybe add a flag for choosing the behavior?
|
|
18
17
|
solvedSchema = mergeSchemas(getIn(definitions, path) ?? {}, schema ?? {});
|
|
19
18
|
delete solvedSchema.$ref;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nolwenture/formik-jsonschema-form",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Formik form generation from json schema",
|
|
5
5
|
"author": "anttivikman <antti.vikman@nolwenture.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -122,4 +122,4 @@
|
|
|
122
122
|
"last 1 safari version"
|
|
123
123
|
]
|
|
124
124
|
}
|
|
125
|
-
}
|
|
125
|
+
}
|