@canmingir/link 1.2.23 → 1.2.25

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.
Files changed (60) hide show
  1. package/package.json +3 -1
  2. package/src/Platform.jsx +10 -14
  3. package/src/context/Context.js +98 -0
  4. package/src/context/reducer.js +590 -10
  5. package/src/layouts/auth/modern.jsx +2 -2
  6. package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
  7. package/src/lib/APIDialogAction/index.js +1 -0
  8. package/src/lib/APIDialogAction/styles.js +6 -0
  9. package/src/lib/APIParams/APIParams.jsx +57 -0
  10. package/src/lib/APIParams/index.js +1 -0
  11. package/src/lib/APIPath/APIPath.jsx +82 -0
  12. package/src/lib/APIPath/index.js +1 -0
  13. package/src/lib/APIPath/styles.js +19 -0
  14. package/src/lib/APITree/APITree.jsx +409 -0
  15. package/src/lib/APITree/Arrow.jsx +21 -0
  16. package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
  17. package/src/lib/APITree/index.js +1 -0
  18. package/src/lib/APITree/styles.js +19 -0
  19. package/src/lib/APITypes/APITypes.jsx +141 -0
  20. package/src/lib/APITypes/TypeEditor.jsx +46 -0
  21. package/src/lib/APITypes/TypeList.jsx +180 -0
  22. package/src/lib/APITypes/index.js +1 -0
  23. package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
  24. package/src/lib/BlankTreeMessage/index.js +1 -0
  25. package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
  26. package/src/lib/DialogTootip/index.js +1 -0
  27. package/src/lib/DialogTootip/styles.js +9 -0
  28. package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
  29. package/src/lib/NewApiBody/ParamView.jsx +38 -0
  30. package/src/lib/NucDialog/NucDialog.jsx +108 -0
  31. package/src/lib/NucDialog/index.js +1 -0
  32. package/src/lib/ParamTable/ParamTable.jsx +133 -0
  33. package/src/lib/ParamTable/TypeMenu.jsx +102 -0
  34. package/src/lib/ParamTable/defaults.js +47 -0
  35. package/src/lib/ParamTable/index.js +1 -0
  36. package/src/lib/ParamTable/styles.js +12 -0
  37. package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
  38. package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
  39. package/src/lib/ResourceMenu/ResourceMenu.jsx +156 -0
  40. package/src/lib/ResourceMenu/index.js +1 -0
  41. package/src/lib/ResourceMenu/styles.js +5 -0
  42. package/src/lib/Schema/Schema.jsx +204 -0
  43. package/src/lib/Schema/index.js +1 -0
  44. package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
  45. package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
  46. package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
  47. package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
  48. package/src/lib/SchemaEditor/index.js +1 -0
  49. package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
  50. package/src/lib/ToggleableMenu/index.js +1 -0
  51. package/src/lib/index.js +14 -0
  52. package/src/pages/Callback.jsx +2 -4
  53. package/src/pages/LoginPage.jsx +3 -12
  54. package/src/stories/APITree.stories.jsx +429 -0
  55. package/src/stories/FlowChart.stories.jsx +1 -1
  56. package/src/templates/ActionTemplate.js +24 -0
  57. package/src/widgets/Login/CognitoLogin.jsx +2 -2
  58. package/src/widgets/Login/DemoLogin.jsx +1 -1
  59. package/src/widgets/LoginForm/LoginForm.jsx +8 -3
  60. package/src/widgets/SettingsDialog.jsx +33 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canmingir/link",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -30,7 +30,9 @@
30
30
  "@mui/icons-material": "^5.16.4",
31
31
  "@mui/lab": "^5.0.0-alpha.172",
32
32
  "@mui/material": "^5.16.4",
33
+ "@mui/x-data-grid": "^8.27.1",
33
34
  "@mui/x-date-pickers": "^7.10.0",
35
+ "@mui/x-tree-view": "^8.27.1",
34
36
  "@nucleoidai/react-event": "^1.1.9",
35
37
  "@nucleoidjs/webstorage": "^1.0.5",
36
38
  "autosuggest-highlight": "^3.3.4",
package/src/Platform.jsx CHANGED
@@ -1,7 +1,6 @@
1
1
  import "./global.css";
2
2
  import "./widgets/Login/amplifyAuth";
3
3
 
4
- import ContextProvider from "./ContextProvider/ContextProvider";
5
4
  import GlobalSnackMessage from "./GlobalSnackMessage/GlobalSnackMessage";
6
5
  import React from "react";
7
6
  import RouteManager from "./RouteManager/RouteManager";
@@ -16,7 +15,6 @@ import { init } from "./config/config";
16
15
  import oauth from "./http/oauth";
17
16
 
18
17
  import { BrowserRouter, Navigate } from "react-router-dom";
19
- import { initialState, reducer } from "./context/reducer";
20
18
  import { publish, subscribe, useEvent } from "@nucleoidai/react-event";
21
19
 
22
20
  init();
@@ -60,18 +58,16 @@ const Platform = ({ routes }) => {
60
58
  {configInitError.error !== "" && (
61
59
  <Navigate to="/config-error" state={configInitError} />
62
60
  )}
63
- <ContextProvider reducer={reducer} state={initialState}>
64
- <SnackbarProvider
65
- anchorOrigin={{
66
- vertical: "top",
67
- horizontal: "right",
68
- }}
69
- >
70
- <SettingsDrawer />
71
- <GlobalSnackMessage />
72
- <RouteManager routes={routes} />
73
- </SnackbarProvider>
74
- </ContextProvider>
61
+ <SnackbarProvider
62
+ anchorOrigin={{
63
+ vertical: "top",
64
+ horizontal: "right",
65
+ }}
66
+ >
67
+ <SettingsDrawer />
68
+ <GlobalSnackMessage />
69
+ <RouteManager routes={routes} />
70
+ </SnackbarProvider>
75
71
  </BrowserRouter>
76
72
  </ThemeProvider>
77
73
  </SettingsProvider>
@@ -0,0 +1,98 @@
1
+ class Context {
2
+ constructor(data = {}) {
3
+ this.login = data.login !== undefined ? data.login : false;
4
+ this.itemId = data.itemId || null;
5
+
6
+ this.specification = {
7
+ api: [],
8
+ functions: [],
9
+ types: [],
10
+ declarations: [],
11
+ ...(data.specification || {}),
12
+ };
13
+
14
+ this.pages = {
15
+ api: {
16
+ selected: { path: "/", method: "get" },
17
+ dialog: {
18
+ type: null,
19
+ action: null,
20
+ open: false,
21
+ view: null,
22
+ map: {},
23
+ params: {},
24
+ },
25
+ resourceMenu: {
26
+ open: false,
27
+ anchor: null,
28
+ path: null,
29
+ },
30
+ ...(data.pages?.api || {}),
31
+ },
32
+ functions: {
33
+ selected: null,
34
+ dialog: {
35
+ type: null,
36
+ open: false,
37
+ },
38
+ AIDialog: {
39
+ open: false,
40
+ },
41
+ ...(data.pages?.functions || {}),
42
+ },
43
+ logic: {
44
+ selected: null,
45
+ AIDialog: {
46
+ open: false,
47
+ },
48
+ ...(data.pages?.logic || {}),
49
+ },
50
+ query: {
51
+ results: null,
52
+ ...(data.pages?.query || {}),
53
+ },
54
+ ...(data.pages || {}),
55
+ };
56
+ }
57
+
58
+ static copy(context) {
59
+ const copied = new Context();
60
+
61
+ copied.login = context.login;
62
+ copied.itemId = context.itemId;
63
+
64
+ copied.specification = {
65
+ api: context.specification?.api ? [...context.specification.api] : [],
66
+ functions: context.specification?.functions
67
+ ? [...context.specification.functions]
68
+ : [],
69
+ types: context.specification?.types
70
+ ? [...context.specification.types]
71
+ : [],
72
+ declarations: context.specification?.declarations
73
+ ? [...context.specification.declarations]
74
+ : [],
75
+ };
76
+
77
+ copied.pages = JSON.parse(JSON.stringify(context.pages || {}));
78
+
79
+ return copied;
80
+ }
81
+
82
+ get(path) {
83
+ const keys = path.split(".");
84
+ let result = this;
85
+
86
+ for (const key of keys) {
87
+ if (result && typeof result === "object" && key in result) {
88
+ result = result[key];
89
+ } else {
90
+ return undefined;
91
+ }
92
+ }
93
+
94
+ return result;
95
+ }
96
+ }
97
+
98
+ export default Context;