impaktapps-jsonforms 5.426.80-alpha.21 → 5.426.80-alpha.22
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
-
import { JsonForms
|
|
1
|
+
import React, { useState, useEffect, useMemo } from "react";
|
|
2
|
+
import { JsonForms } from "@jsonforms/react";
|
|
3
3
|
import { materialCells } from "@jsonforms/material-renderers";
|
|
4
4
|
import renderers from "../renderers";
|
|
5
5
|
import { DataProvider } from "../renderers/context/Context";
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import CommonSkeleton from "../renderers/common/Skeleton";
|
|
17
17
|
import { useImpaktAppsJsonFormsStore } from "../renderers/context/useImpaktappsJsonformsStore";
|
|
18
18
|
import {
|
|
19
|
-
HomePropsType,
|
|
20
19
|
impaktappsJsonformsPropsType,
|
|
21
20
|
} from "../renderers/interface/inputfieldProps";
|
|
22
21
|
import { useTheme } from "../styles/StyleFactory";
|
|
@@ -35,37 +34,37 @@ function AppWithoutRouter({
|
|
|
35
34
|
}: impaktappsJsonformsPropsType) {
|
|
36
35
|
const [loading, setLoading] = useState(false);
|
|
37
36
|
const [formKey, setFormKey] = useState(uuid());
|
|
38
|
-
const [newImpaktAppsJsonFormsStore, setNewImpaktAppsJsonFormsStore] = useState(null);
|
|
39
|
-
const { id } = navigationHolder.useParams();
|
|
40
37
|
|
|
41
|
-
const
|
|
38
|
+
const { id } = navigationHolder.useParams();
|
|
39
|
+
const pageName = "RouterUnavailable";
|
|
42
40
|
|
|
43
|
-
const
|
|
41
|
+
const instance = useMemo(() => {
|
|
44
42
|
return useImpaktAppsJsonFormsStore(
|
|
45
43
|
serviceHolder,
|
|
46
44
|
validationMode,
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
pageName,
|
|
46
|
+
useTheme(styleTheme),
|
|
49
47
|
permissions,
|
|
50
48
|
navigationHolder,
|
|
51
49
|
dateTimeFormat,
|
|
52
50
|
locale,
|
|
53
51
|
timeZone
|
|
54
52
|
);
|
|
55
|
-
};
|
|
53
|
+
}, [id]);
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
// Using `useParams` without conditional logic
|
|
56
|
+
// const { id } = navigationHolder.useParams();
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setLoading(true);
|
|
61
60
|
|
|
62
61
|
const pageSetter = () => {
|
|
63
|
-
newStore.uiSchema && setLoading(true);
|
|
64
62
|
localStorage.removeItem("pagemasterMetaData");
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
serviceHolder.getService(instance).then((res: any) => {
|
|
66
65
|
res.setPage().then(() => {
|
|
67
66
|
localStorage.removeItem("pageMasterInfo");
|
|
68
|
-
|
|
67
|
+
instance.setValidation("ValidateAndHide");
|
|
69
68
|
window.scrollTo(0, 0);
|
|
70
69
|
setFormKey(uuid());
|
|
71
70
|
setTimeout(() => {
|
|
@@ -76,14 +75,14 @@ function AppWithoutRouter({
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
pageSetter();
|
|
79
|
-
}, [navigationHolder?.location,id]);
|
|
78
|
+
}, [navigationHolder?.location, id, instance]);
|
|
80
79
|
|
|
81
80
|
const ctx = useJsonForms();
|
|
82
81
|
|
|
83
82
|
const changeHandler = (data: any, errors: any) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.getService({ ...
|
|
83
|
+
instance?.updateFormdata(data);
|
|
84
|
+
instance?.serviceHolder
|
|
85
|
+
.getService({ ...instance, ctx })
|
|
87
86
|
.then((res: any) => {
|
|
88
87
|
return res?.onChange && res.onChange();
|
|
89
88
|
});
|
|
@@ -92,26 +91,26 @@ function AppWithoutRouter({
|
|
|
92
91
|
const ajv = createCustomAjv();
|
|
93
92
|
|
|
94
93
|
return (
|
|
95
|
-
<ThemeProvider theme={theme.myTheme}>
|
|
94
|
+
<ThemeProvider theme={instance.theme.myTheme}>
|
|
96
95
|
<CssBaseline />
|
|
97
|
-
{
|
|
98
|
-
<DataProvider impaktAppsJsonFormsStore={
|
|
96
|
+
{instance.uiSchema ? (
|
|
97
|
+
<DataProvider impaktAppsJsonFormsStore={instance}>
|
|
99
98
|
<Box
|
|
100
99
|
sx={{
|
|
101
|
-
...theme?.pageStyle,
|
|
102
|
-
...
|
|
100
|
+
...instance.theme?.pageStyle,
|
|
101
|
+
...instance.uiSchema?.pageStyle,
|
|
103
102
|
}}
|
|
104
103
|
>
|
|
105
104
|
<JsonForms
|
|
106
105
|
key={formKey}
|
|
107
|
-
data={
|
|
108
|
-
schema={
|
|
109
|
-
uischema={
|
|
106
|
+
data={instance.formData}
|
|
107
|
+
schema={instance.schema}
|
|
108
|
+
uischema={instance.uiSchema}
|
|
110
109
|
renderers={renderers}
|
|
111
110
|
cells={materialCells}
|
|
112
111
|
onChange={({ data, errors }) => changeHandler(data, errors)}
|
|
113
|
-
validationMode={
|
|
114
|
-
additionalErrors={
|
|
112
|
+
validationMode={instance.validationMode}
|
|
113
|
+
additionalErrors={instance.additionalErrors}
|
|
115
114
|
ajv={ajv}
|
|
116
115
|
/>
|
|
117
116
|
<Dialog open={loading}>
|
|
@@ -119,7 +118,7 @@ function AppWithoutRouter({
|
|
|
119
118
|
<DialogContentText>
|
|
120
119
|
<Stack direction={"row"} alignItems={"center"} spacing={2}>
|
|
121
120
|
<CircularProgress color="inherit" />
|
|
122
|
-
<Box>Fetching Data ...</Box>
|
|
121
|
+
<Box sx={{}}>Fetching Data ...</Box>
|
|
123
122
|
</Stack>
|
|
124
123
|
</DialogContentText>
|
|
125
124
|
</DialogContent>
|