swoop-common 2.2.91 → 2.2.92
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ComponentPool } from
|
|
3
|
-
import { MasterSchema, Stage } from
|
|
4
|
-
import { JsonSchema, Layout } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentPool } from "../registry/types";
|
|
3
|
+
import { MasterSchema, Stage } from "../schema/formSchemaTypes";
|
|
4
|
+
import { JsonSchema, Layout } from "@jsonforms/core";
|
|
5
5
|
interface BaseProps {
|
|
6
6
|
/**
|
|
7
7
|
* This should only be used for the initial values, as this is not truly a controlled component.
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { JsonForms } from
|
|
2
|
-
import React, { useEffect } from
|
|
3
|
-
import { materialCells, materialRenderers } from
|
|
4
|
-
import { getComponents } from
|
|
5
|
-
import { generateJsonSchema } from
|
|
6
|
-
import { generateUiSchema } from
|
|
7
|
-
import { initialisedCheck } from
|
|
8
|
-
import ComponentContext from
|
|
9
|
-
export const StyledFormView = ({ initialData, schema, onChange, stage, pool, readonly, hideReadonlyFields, hintComponentId, overrideJsonSchema, overrideUiSchema }) => {
|
|
1
|
+
import { JsonForms } from "@jsonforms/react";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
|
+
import { materialCells, materialRenderers, } from "@jsonforms/material-renderers";
|
|
4
|
+
import { getComponents } from "../registry/components";
|
|
5
|
+
import { generateJsonSchema } from "../schema/generate/jsonSchemaGenerate";
|
|
6
|
+
import { generateUiSchema } from "../schema/generate/uiSchemaGenerate";
|
|
7
|
+
import { initialisedCheck } from "../../api/init";
|
|
8
|
+
import ComponentContext from "../contexts/ComponentContext";
|
|
9
|
+
export const StyledFormView = ({ initialData, schema, onChange, stage, pool, readonly, hideReadonlyFields, hintComponentId, overrideJsonSchema, overrideUiSchema, }) => {
|
|
10
10
|
useEffect(initialisedCheck, []);
|
|
11
11
|
const json = overrideJsonSchema || generateJsonSchema(schema, stage, hideReadonlyFields);
|
|
12
12
|
const ui = overrideUiSchema || generateUiSchema(schema, stage, hideReadonlyFields);
|
|
13
13
|
return (React.createElement(ComponentContext, { componentId: hintComponentId, stage: stage },
|
|
14
|
-
React.createElement(
|
|
14
|
+
React.createElement("div", { className: "json-forms-wrapper" },
|
|
15
|
+
React.createElement(JsonForms, { onChange: onChange, data: initialData, schema: json, uischema: ui, renderers: [
|
|
16
|
+
...materialRenderers,
|
|
17
|
+
...((pool && getComponents(pool)) || []),
|
|
18
|
+
], readonly: readonly, cells: materialCells }))));
|
|
15
19
|
};
|