@ebubekirylmaz/link-test 1.2.44 → 1.2.46
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 +13 -6
- package/src/Platform.jsx +14 -15
- package/src/assets/illustrations/avatar-shape.jsx +6 -7
- package/src/assets/illustrations/booking-illustration.jsx +4 -14
- package/src/assets/illustrations/check-in-illustration.jsx +4 -10
- package/src/assets/illustrations/check-out-illustration.jsx +4 -3
- package/src/assets/illustrations/coming-soon-illustration.jsx +4 -17
- package/src/assets/illustrations/forbidden-illustration.jsx +4 -12
- package/src/assets/illustrations/maintenance-illustration.jsx +4 -24
- package/src/assets/illustrations/motivation-illustration.jsx +4 -9
- package/src/assets/illustrations/order-complete-illustration.jsx +4 -12
- package/src/assets/illustrations/page-not-found-illustration.jsx +4 -9
- package/src/assets/illustrations/seo-illustration.jsx +4 -16
- package/src/assets/illustrations/sever-error-illustration.jsx +4 -21
- package/src/assets/illustrations/upgrade-storage-illustration.jsx +4 -20
- package/src/assets/illustrations/upload-illustration.jsx +4 -81
- package/src/components/NucleoidLoginForm/NucleoidLoginForm.jsx +1 -0
- package/src/components/TopNavBar/TopNavBar.jsx +6 -2
- package/src/components/file-thumbnail/file-thumbnail.jsx +5 -6
- package/src/components/nav-section/horizontal/nav-section-horizontal.jsx +5 -6
- package/src/components/settings/drawer/layout-options.jsx +5 -4
- package/src/components/settings/drawer/presets-options.jsx +6 -5
- package/src/components/settings/drawer/settings-drawer.jsx +7 -4
- package/src/components/settings/drawer/stretch-options.jsx +5 -5
- package/src/config/schemas.js +1 -0
- package/src/context/Context.js +98 -0
- package/src/context/reducer.js +590 -10
- package/src/hooks/index.js +2 -1
- package/src/hooks/use-beta.js +8 -0
- package/src/layouts/DashboardLayout/header.jsx +5 -4
- package/src/layouts/DashboardLayout/nav-mini.jsx +5 -7
- package/src/layouts/DashboardLayout/nav-vertical.jsx +11 -11
- package/src/layouts/FullScreenLayout/FullScreenLayout.jsx +5 -1
- package/src/layouts/FullScreenLayout/nav-vertical.jsx +11 -11
- package/src/layouts/MainLayout/footer.jsx +7 -7
- package/src/layouts/MainLayout/header.jsx +3 -2
- package/src/layouts/MainLayout/nav/desktop/nav-list.jsx +8 -8
- package/src/layouts/MainLayout/nav/mobile/index.jsx +7 -6
- package/src/layouts/auth/classic.jsx +6 -6
- package/src/layouts/auth/modern.jsx +7 -6
- package/src/layouts/common/ProjectBar/index.jsx +13 -11
- package/src/layouts/common/account-popover.jsx +1 -2
- package/src/layouts/common/header-sim.jsx +3 -2
- package/src/layouts/common/header-simple.jsx +6 -3
- package/src/layouts/common/notifications-popover/index.jsx +18 -13
- package/src/layouts/common/notifications-popover/notification-item.jsx +28 -16
- package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
- package/src/lib/APIDialogAction/index.js +1 -0
- package/src/lib/APIDialogAction/styles.js +6 -0
- package/src/lib/APIParams/APIParams.jsx +57 -0
- package/src/lib/APIParams/index.js +1 -0
- package/src/lib/APIPath/APIPath.jsx +82 -0
- package/src/lib/APIPath/index.js +1 -0
- package/src/lib/APIPath/styles.js +19 -0
- package/src/lib/APITree/APITree.jsx +411 -0
- package/src/lib/APITree/Arrow.jsx +21 -0
- package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
- package/src/lib/APITree/index.js +1 -0
- package/src/lib/APITree/styles.js +19 -0
- package/src/lib/APITypes/APITypes.jsx +141 -0
- package/src/lib/APITypes/TypeEditor.jsx +46 -0
- package/src/lib/APITypes/TypeList.jsx +180 -0
- package/src/lib/APITypes/index.js +1 -0
- package/src/lib/AddItemWizard/AddItemWizard.jsx +21 -10
- package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
- package/src/lib/BlankTreeMessage/index.js +1 -0
- package/src/lib/CustomBreadcrumbs/CustomBreadcrumbs.jsx +3 -2
- package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
- package/src/lib/DialogTootip/index.js +1 -0
- package/src/lib/DialogTootip/styles.js +9 -0
- package/src/lib/Flow/connectors/DynamicConnector.jsx +179 -107
- package/src/lib/Flow/core/Flow.jsx +2 -0
- package/src/lib/Flow/core/FlowNode.jsx +2 -0
- package/src/lib/Flow/core/FlowViewport.jsx +41 -9
- package/src/lib/Flow/hooks/useNodeStyle.js +14 -0
- package/src/lib/Flow/layouts/CardLayout.jsx +4 -3
- package/src/lib/Flow/nodes/DefaultCard.jsx +6 -8
- package/src/lib/Flow/nodes/FlowNodeView.jsx +105 -21
- package/src/lib/Flow/styles.js +4 -0
- package/src/lib/IconSelector/IconSelector.jsx +5 -1
- package/src/lib/ItemSummary/ItemSummary.jsx +11 -6
- package/src/lib/ItemSummary/ItemsSummary.jsx +38 -26
- package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
- package/src/lib/NewApiBody/ParamView.jsx +38 -0
- package/src/lib/NucDialog/NucDialog.jsx +108 -0
- package/src/lib/NucDialog/index.js +1 -0
- package/src/lib/ParamTable/ParamTable.jsx +133 -0
- package/src/lib/ParamTable/TypeMenu.jsx +102 -0
- package/src/lib/ParamTable/defaults.js +47 -0
- package/src/lib/ParamTable/index.js +1 -0
- package/src/lib/ParamTable/styles.js +12 -0
- package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
- package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
- package/src/lib/ResourceMenu/ResourceMenu.jsx +158 -0
- package/src/lib/ResourceMenu/index.js +1 -0
- package/src/lib/ResourceMenu/styles.js +5 -0
- package/src/lib/Schema/Schema.jsx +204 -0
- package/src/lib/Schema/index.js +1 -0
- package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
- package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
- package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
- package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
- package/src/lib/SchemaEditor/index.js +1 -0
- package/src/lib/SparkleInput/SparkleInput.jsx +31 -28
- package/src/lib/TableSelectedAction/TableSelectedAction.jsx +7 -8
- package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
- package/src/lib/ToggleableMenu/index.js +1 -0
- package/src/lib/index.js +14 -0
- package/src/pages/Callback.jsx +6 -8
- package/src/pages/ConfigError.jsx +3 -1
- package/src/pages/LoginPage.jsx +3 -12
- package/src/stories/APITree.stories.jsx +429 -0
- package/src/stories/FlowChart.stories.jsx +1 -1
- package/src/templates/ActionTemplate.js +24 -0
- package/src/theme/overrides/default-props.jsx +17 -11
- package/src/widgets/Login/CognitoLogin.jsx +165 -173
- package/src/widgets/Login/DemoLogin.jsx +43 -38
- package/src/widgets/Login/amplifyAuth.js +6 -6
- package/src/widgets/Login/amplifyConfig.js +3 -0
- package/src/widgets/LoginForm/LoginForm.jsx +8 -3
- package/src/widgets/SettingsDialog.jsx +206 -16
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const Defaults = {
|
|
2
|
+
compiledObject: (objID, objPropID) => {
|
|
3
|
+
return {
|
|
4
|
+
[objID]: {
|
|
5
|
+
type: "object",
|
|
6
|
+
id: objID,
|
|
7
|
+
properties: {
|
|
8
|
+
[objPropID]: {
|
|
9
|
+
id: objPropID,
|
|
10
|
+
name: "id",
|
|
11
|
+
type: "string",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
compiledProperty: (id) => {
|
|
18
|
+
return {
|
|
19
|
+
[id]: {
|
|
20
|
+
id: id,
|
|
21
|
+
name: "id",
|
|
22
|
+
type: "string",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
object: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
id: {
|
|
30
|
+
type: "string",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
array: {
|
|
35
|
+
type: "array",
|
|
36
|
+
items: {
|
|
37
|
+
id: {
|
|
38
|
+
type: "string",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
action: `function action(req) {\n\treturn req.body.name;\n}\n`,
|
|
43
|
+
summary: "Summary",
|
|
44
|
+
description: "Description",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default Defaults;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ParamTable";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Alert } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Snackbar from "@mui/material/Snackbar";
|
|
4
|
+
|
|
5
|
+
export default function AlertMassage({ message }) {
|
|
6
|
+
const [open, setOpen] = React.useState(true);
|
|
7
|
+
|
|
8
|
+
function handleClose(event, reason) {
|
|
9
|
+
if (reason === "clickaway") return;
|
|
10
|
+
setOpen(false);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Snackbar
|
|
15
|
+
anchorOrigin={{
|
|
16
|
+
vertical: "bottom",
|
|
17
|
+
horizontal: "center",
|
|
18
|
+
}}
|
|
19
|
+
open={open}
|
|
20
|
+
autoHideDuration={2000}
|
|
21
|
+
onClose={handleClose}
|
|
22
|
+
>
|
|
23
|
+
<Alert onClose={handleClose} severity="info">
|
|
24
|
+
{message}
|
|
25
|
+
</Alert>
|
|
26
|
+
</Snackbar>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Button from "@mui/material/Button";
|
|
2
|
+
import Dialog from "@mui/material/Dialog";
|
|
3
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
4
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
5
|
+
import DialogTitle from "@mui/material/DialogTitle";
|
|
6
|
+
import { Typography } from "@mui/material";
|
|
7
|
+
import { forwardRef } from "react";
|
|
8
|
+
|
|
9
|
+
const DeleteResourceDialog = forwardRef(({ setOpen, deleteResource }, ref) => {
|
|
10
|
+
const resource = ref.current;
|
|
11
|
+
|
|
12
|
+
const handleClose = () => {
|
|
13
|
+
setOpen(false);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const handleDelete = () => {
|
|
17
|
+
deleteResource();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Dialog
|
|
22
|
+
open={true}
|
|
23
|
+
onClose={handleClose}
|
|
24
|
+
aria-labelledby="responsive-dialog-title"
|
|
25
|
+
>
|
|
26
|
+
<DialogTitle id="responsive-dialog-title">Delete resource</DialogTitle>
|
|
27
|
+
<DialogContent>
|
|
28
|
+
<Typography>
|
|
29
|
+
{`The selected resource "${resource?.deleteAdress}" will be deleted.`}
|
|
30
|
+
</Typography>
|
|
31
|
+
{resource?.deleteList.length > 0 && (
|
|
32
|
+
<>
|
|
33
|
+
<Typography sx={{ mt: 2 }}>
|
|
34
|
+
The following child resources will also be deleted:
|
|
35
|
+
</Typography>
|
|
36
|
+
{resource?.deleteList.map((item, index) => (
|
|
37
|
+
<Typography key={index} sx={{ ml: 2 }}>
|
|
38
|
+
- {item}
|
|
39
|
+
</Typography>
|
|
40
|
+
))}
|
|
41
|
+
</>
|
|
42
|
+
)}
|
|
43
|
+
</DialogContent>
|
|
44
|
+
<DialogActions>
|
|
45
|
+
<Button autoFocus onClick={handleClose}>
|
|
46
|
+
Cancel
|
|
47
|
+
</Button>
|
|
48
|
+
<Button
|
|
49
|
+
onClick={handleDelete}
|
|
50
|
+
autoFocus
|
|
51
|
+
data-cy="delete-resource-confirm-button"
|
|
52
|
+
>
|
|
53
|
+
Delete
|
|
54
|
+
</Button>
|
|
55
|
+
</DialogActions>
|
|
56
|
+
</Dialog>
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export default DeleteResourceDialog;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import AlertMassage from "./AlertMassage";
|
|
2
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
3
|
+
import DeleteResourceDialog from "./DeleteResourceDialog";
|
|
4
|
+
import Fade from "@mui/material/Fade";
|
|
5
|
+
import HttpIcon from "@mui/icons-material/Http";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import SourceIcon from "@mui/icons-material/Source";
|
|
8
|
+
import styles from "./styles";
|
|
9
|
+
import { useRef } from "react";
|
|
10
|
+
|
|
11
|
+
import { Divider, Menu, MenuItem, Typography } from "@mui/material";
|
|
12
|
+
import { publish, useEvent } from "@nucleoidai/react-event";
|
|
13
|
+
|
|
14
|
+
const ResourceMenu = (props) => {
|
|
15
|
+
const { anchor, openMenu, handleClose, hash, map } = props;
|
|
16
|
+
|
|
17
|
+
const [methodDisabled, setMethodDisabled] = React.useState();
|
|
18
|
+
const [alertMessage, setAlertMessage] = React.useState("");
|
|
19
|
+
const [open, setOpen] = React.useState(false);
|
|
20
|
+
const resourceRef = useRef();
|
|
21
|
+
|
|
22
|
+
const [api] = useEvent("API_DATA_CHANGED", []);
|
|
23
|
+
const [selectedAPI] = useEvent("SELECTED_API_CHANGED", {
|
|
24
|
+
path: "/",
|
|
25
|
+
method: "GET",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
const checkMethodAddable = () => {
|
|
30
|
+
const countMethodsForPath = (path) => {
|
|
31
|
+
return api.filter((endpoint) => endpoint.path === path).length;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
if (hash) {
|
|
35
|
+
const path = map ? map[hash].path : null;
|
|
36
|
+
return countMethodsForPath(path) > 3;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (selectedAPI) {
|
|
40
|
+
const apiSelectedPath = selectedAPI.path;
|
|
41
|
+
return countMethodsForPath(apiSelectedPath) > 4;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
setMethodDisabled(checkMethodAddable());
|
|
47
|
+
}, [api, hash, map, selectedAPI]);
|
|
48
|
+
|
|
49
|
+
const addMethod = () => {
|
|
50
|
+
selectPath();
|
|
51
|
+
publish("API_DIALOG_OPEN", { type: "method", action: "add" });
|
|
52
|
+
handleClose();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const addResource = () => {
|
|
56
|
+
selectPath();
|
|
57
|
+
publish("API_DIALOG_OPEN", { type: "resource", action: "add" });
|
|
58
|
+
handleClose();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const deleteResource = () => {
|
|
62
|
+
const path = selectedAPI?.path;
|
|
63
|
+
if (!path) return;
|
|
64
|
+
|
|
65
|
+
publish("API_RESOURCE_DELETE", { path });
|
|
66
|
+
handleClose();
|
|
67
|
+
setOpen(false);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleResourceDeleteDialog = () => {
|
|
71
|
+
selectPath();
|
|
72
|
+
|
|
73
|
+
if (selectedAPI?.path === "/") {
|
|
74
|
+
setAlertMessage("Root path cannot be deleted");
|
|
75
|
+
handleClose();
|
|
76
|
+
} else {
|
|
77
|
+
const selectedPath = selectedAPI?.path;
|
|
78
|
+
const deleteList = api
|
|
79
|
+
.filter(
|
|
80
|
+
(item) =>
|
|
81
|
+
item.path.startsWith(selectedPath) && item.path !== selectedPath
|
|
82
|
+
)
|
|
83
|
+
.map((item) => item.path)
|
|
84
|
+
.filter((path, index, self) => self.indexOf(path) === index);
|
|
85
|
+
|
|
86
|
+
resourceRef.current = {
|
|
87
|
+
deleteAdress: selectedPath,
|
|
88
|
+
deleteList: deleteList,
|
|
89
|
+
};
|
|
90
|
+
handleClose();
|
|
91
|
+
setOpen(true);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const selectPath = () => {
|
|
96
|
+
const item = map ? map[hash] : null;
|
|
97
|
+
|
|
98
|
+
if (item) {
|
|
99
|
+
publish("SELECTED_API_CHANGED", { path: item.path, method: null });
|
|
100
|
+
} else if (selectedAPI) {
|
|
101
|
+
publish("SELECTED_API_CHANGED", {
|
|
102
|
+
path: selectedAPI.path,
|
|
103
|
+
method: null,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
{open && (
|
|
111
|
+
<DeleteResourceDialog
|
|
112
|
+
open={open}
|
|
113
|
+
setOpen={setOpen}
|
|
114
|
+
deleteResource={deleteResource}
|
|
115
|
+
ref={resourceRef}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
{alertMessage && <AlertMassage message={alertMessage} />}
|
|
119
|
+
<Menu
|
|
120
|
+
open={openMenu}
|
|
121
|
+
onClose={handleClose}
|
|
122
|
+
onContextMenu={(event) => event.preventDefault()}
|
|
123
|
+
anchorReference="anchorPosition"
|
|
124
|
+
anchorPosition={{
|
|
125
|
+
top: anchor?.clientY || 0,
|
|
126
|
+
left: anchor?.clientX || 0,
|
|
127
|
+
}}
|
|
128
|
+
slots={{
|
|
129
|
+
transition: Fade
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
<MenuItem onClick={addResource} data-cy="add-resource">
|
|
133
|
+
<SourceIcon />
|
|
134
|
+
<Typography sx={styles.menuItemText}>Resource</Typography>
|
|
135
|
+
</MenuItem>
|
|
136
|
+
<MenuItem
|
|
137
|
+
onClick={addMethod}
|
|
138
|
+
disabled={methodDisabled}
|
|
139
|
+
data-cy="add-method"
|
|
140
|
+
>
|
|
141
|
+
<HttpIcon />
|
|
142
|
+
<Typography sx={styles.menuItemText}>Method</Typography>
|
|
143
|
+
</MenuItem>
|
|
144
|
+
<Divider />
|
|
145
|
+
<MenuItem
|
|
146
|
+
onClick={handleResourceDeleteDialog}
|
|
147
|
+
disabled={selectedAPI?.path === "/"}
|
|
148
|
+
data-cy="delete-resource"
|
|
149
|
+
>
|
|
150
|
+
<DeleteIcon />
|
|
151
|
+
<Typography sx={styles.menuItemText}>Delete</Typography>
|
|
152
|
+
</MenuItem>
|
|
153
|
+
</Menu>
|
|
154
|
+
</>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export default ResourceMenu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ResourceMenu";
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
2
|
+
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
3
|
+
import { v4 as uuidv4 } from "uuid";
|
|
4
|
+
|
|
5
|
+
import { Box, Typography } from "@mui/material";
|
|
6
|
+
import React, { useEffect, useState } from "react";
|
|
7
|
+
import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView";
|
|
8
|
+
import { TreeItem } from "@mui/x-tree-view/TreeItem";
|
|
9
|
+
|
|
10
|
+
const Schema = ({ initialData = {}, customTypes = [] }) => {
|
|
11
|
+
const [schemaData, setSchemaData] = useState({});
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const addIdsToSchema = (schema) => {
|
|
15
|
+
if (!schema) return null;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
...schema,
|
|
19
|
+
id: uuidv4(),
|
|
20
|
+
properties: schema.properties?.map(addIdsToSchema),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if (Object.keys(initialData).length === 0) {
|
|
25
|
+
setSchemaData({
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: [],
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
setSchemaData(addIdsToSchema(initialData));
|
|
31
|
+
}
|
|
32
|
+
}, [initialData]);
|
|
33
|
+
|
|
34
|
+
const renderTree = (node, level = 0) => (
|
|
35
|
+
<TreeItem
|
|
36
|
+
key={node.id}
|
|
37
|
+
itemId={level === 0 ? "1" : node.id}
|
|
38
|
+
label={
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "space-between",
|
|
44
|
+
width: "100%",
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
gap: "1px",
|
|
52
|
+
width: "100%",
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<Box
|
|
56
|
+
sx={{
|
|
57
|
+
display: "flex",
|
|
58
|
+
justifyContent: "space-between",
|
|
59
|
+
width: "100%",
|
|
60
|
+
gap: "4px",
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<Box
|
|
64
|
+
sx={{
|
|
65
|
+
display: "flex",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
cursor: "pointer",
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<Typography
|
|
71
|
+
variant="body2"
|
|
72
|
+
sx={{
|
|
73
|
+
padding: "2px 2px",
|
|
74
|
+
borderRadius: "4px",
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
{level === 0 ? "" : node.name}
|
|
78
|
+
</Typography>
|
|
79
|
+
</Box>
|
|
80
|
+
|
|
81
|
+
<Box
|
|
82
|
+
sx={{
|
|
83
|
+
display: "flex",
|
|
84
|
+
alignItems: "center",
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<Typography
|
|
89
|
+
variant="body2"
|
|
90
|
+
sx={{
|
|
91
|
+
cursor: "pointer",
|
|
92
|
+
borderRadius: "4px",
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{node.type}
|
|
96
|
+
</Typography>
|
|
97
|
+
</Box>
|
|
98
|
+
</Box>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
}
|
|
102
|
+
>
|
|
103
|
+
{Array.isArray(node.properties)
|
|
104
|
+
? node.properties.map((childNode) => renderTree(childNode, level + 1))
|
|
105
|
+
: isCustomType(node.type)
|
|
106
|
+
? renderCustomTypeNode(node)
|
|
107
|
+
: null}
|
|
108
|
+
</TreeItem>
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const isCustomType = (type) => {
|
|
112
|
+
return customTypes.some((customType) => customType.name === type);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const renderCustomTypeNode = (node) => {
|
|
116
|
+
const customTypeSchema = customTypes.find(
|
|
117
|
+
(type) => type.name === node.type
|
|
118
|
+
)?.schema;
|
|
119
|
+
|
|
120
|
+
if (!customTypeSchema || !customTypeSchema.properties) {
|
|
121
|
+
return <Box sx={{ paddingLeft: "20px" }}>No properties defined</Box>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<Box sx={{ paddingLeft: "20px" }}>
|
|
126
|
+
{customTypeSchema.properties.map((prop, index) => (
|
|
127
|
+
<Box
|
|
128
|
+
key={index}
|
|
129
|
+
sx={{
|
|
130
|
+
paddingTop: "5px",
|
|
131
|
+
paddingBottom: "5px",
|
|
132
|
+
display: "flex",
|
|
133
|
+
alignItems: "center",
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<Typography
|
|
137
|
+
variant="body2"
|
|
138
|
+
sx={{
|
|
139
|
+
color: (theme) => theme.palette.grey[600],
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
{prop.name}
|
|
143
|
+
</Typography>
|
|
144
|
+
<Typography
|
|
145
|
+
variant="body2"
|
|
146
|
+
sx={{
|
|
147
|
+
marginLeft: "8px",
|
|
148
|
+
color: (theme) => theme.palette.grey[500],
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
{prop.type}
|
|
152
|
+
</Typography>
|
|
153
|
+
</Box>
|
|
154
|
+
))}
|
|
155
|
+
</Box>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<SimpleTreeView
|
|
161
|
+
slots={{
|
|
162
|
+
collapseIcon: () => <ExpandMoreIcon />,
|
|
163
|
+
expandIcon: () => <ChevronRightIcon />,
|
|
164
|
+
}}
|
|
165
|
+
defaultExpandedItems={["1"]}
|
|
166
|
+
sx={{
|
|
167
|
+
flexGrow: 1,
|
|
168
|
+
overflowY: "auto",
|
|
169
|
+
width: "100%",
|
|
170
|
+
".MuiTreeItem-root": {
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
},
|
|
173
|
+
".MuiTreeItem-content": {
|
|
174
|
+
width: "100%",
|
|
175
|
+
display: "flex",
|
|
176
|
+
justifyContent: "space-between",
|
|
177
|
+
padding: "1px 8px",
|
|
178
|
+
borderRadius: "4px",
|
|
179
|
+
margin: "1px 0",
|
|
180
|
+
transition: "width 0.3s ease-in-out, height 0.3s ease-in-out",
|
|
181
|
+
},
|
|
182
|
+
".MuiTreeItem-label": {
|
|
183
|
+
width: "100%",
|
|
184
|
+
fontWeight: "bold",
|
|
185
|
+
},
|
|
186
|
+
".MuiTreeItem-group": {
|
|
187
|
+
marginLeft: "16px !important",
|
|
188
|
+
paddingLeft: "8px",
|
|
189
|
+
borderLeft: `1px solid`,
|
|
190
|
+
borderColor: (theme) => theme.palette.grey[400],
|
|
191
|
+
},
|
|
192
|
+
".MuiTreeItem-iconContainer": {
|
|
193
|
+
minWidth: "0",
|
|
194
|
+
marginRight: "0px",
|
|
195
|
+
padding: "0px",
|
|
196
|
+
},
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
{renderTree(schemaData, 0)}
|
|
200
|
+
</SimpleTreeView>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export default Schema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Schema";
|