@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.
@@ -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 = uiSchema?.[childName];
109
- if (uiSchema?.properties?.["ui:order"] !== undefined &&
110
- uiSchema?.[childName]?.["ui:order"] === undefined) {
111
- correctUiSchema = {
112
- ...correctUiSchema,
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(".").replaceAll(/\.properties(\.\w+)?/g, "$1")
18
- .replaceAll(/\.additionalProperties/g, ".properties")
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 = uiSchema?.[childName];
106
- if (uiSchema?.properties?.["ui:order"] !== undefined &&
107
- uiSchema?.[childName]?.["ui:order"] === undefined) {
108
- correctUiSchema = {
109
- ...correctUiSchema,
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(".").replaceAll(/\.properties(\.\w+)?/g, "$1")
15
- .replaceAll(/\.additionalProperties/g, ".properties")
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.9",
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
+ }