@msrajawat298/do-graphs 1.0.0

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 (80) hide show
  1. package/README.md +73 -0
  2. package/dist/App.css +72 -0
  3. package/dist/App.js +124 -0
  4. package/dist/App.test.js +8 -0
  5. package/dist/Assets/Fonts/NotoSans-Bold.ttf +0 -0
  6. package/dist/Assets/Fonts/NotoSans-Medium.ttf +0 -0
  7. package/dist/Assets/Fonts/NotoSans-Regular.ttf +0 -0
  8. package/dist/Assets/Fonts/NotoSans-SemiBold.ttf +0 -0
  9. package/dist/Assets/Images/analytic-graph.png +0 -0
  10. package/dist/Assets/Images/bar-graph.png +0 -0
  11. package/dist/Assets/Images/bubble-chart.png +0 -0
  12. package/dist/Assets/Images/coding.png +0 -0
  13. package/dist/Assets/Images/doughnut.png +0 -0
  14. package/dist/Assets/Images/horizontal-bar-graph.png +0 -0
  15. package/dist/Assets/Images/line-chart.png +0 -0
  16. package/dist/Assets/Images/mixed-chart.png +0 -0
  17. package/dist/Assets/Images/pie-chart.png +0 -0
  18. package/dist/Assets/Images/polar-chart.png +0 -0
  19. package/dist/Assets/Images/progress-bar.png +0 -0
  20. package/dist/Assets/Images/scatter-graph.png +0 -0
  21. package/dist/Assets/Images/table.png +0 -0
  22. package/dist/Assets/Images/travel.png +0 -0
  23. package/dist/Bootstrap.min.css +2 -0
  24. package/dist/Components/Charts/Bar/Form.js +231 -0
  25. package/dist/Components/Charts/Bar/Format.js +43 -0
  26. package/dist/Components/Charts/Bar/index.js +106 -0
  27. package/dist/Components/Charts/Chart.css +203 -0
  28. package/dist/Components/Charts/DoughnutAndPie/Form.js +232 -0
  29. package/dist/Components/Charts/DoughnutAndPie/Format.js +52 -0
  30. package/dist/Components/Charts/DoughnutAndPie/index.js +106 -0
  31. package/dist/Components/Charts/DrawGraph.js +32 -0
  32. package/dist/Components/Charts/Line/Form.js +231 -0
  33. package/dist/Components/Charts/Line/Format.js +47 -0
  34. package/dist/Components/Charts/Line/index.js +106 -0
  35. package/dist/Components/Charts/MixedChart/index.js +107 -0
  36. package/dist/Components/Charts/Options.js +139 -0
  37. package/dist/Components/Charts/PolarArea/Form.js +225 -0
  38. package/dist/Components/Charts/PolarArea/Format.js +42 -0
  39. package/dist/Components/Charts/PolarArea/index.js +106 -0
  40. package/dist/Components/Charts/Progess/Form.js +107 -0
  41. package/dist/Components/Charts/Progess/index.js +119 -0
  42. package/dist/Components/Charts/Scatter/Form.js +225 -0
  43. package/dist/Components/Charts/Scatter/Format.js +45 -0
  44. package/dist/Components/Charts/Scatter/index.js +106 -0
  45. package/dist/Components/Charts/Table/Form.js +70 -0
  46. package/dist/Components/Charts/Table/Styles.js +27 -0
  47. package/dist/Components/Charts/Table/index.js +56 -0
  48. package/dist/Components/Common/CustomComponent/index.js +83 -0
  49. package/dist/Components/Common/Menu/DynamicMenu/List.js +43 -0
  50. package/dist/Components/Common/Menu/DynamicMenu/index.css +109 -0
  51. package/dist/Components/Common/Menu/DynamicMenu/index.js +155 -0
  52. package/dist/Components/Common/Menu/index.css +74 -0
  53. package/dist/Components/Common/Menu/index.js +24 -0
  54. package/dist/Components/Common/Model/Model.css +112 -0
  55. package/dist/Components/Common/Model/Model.js +56 -0
  56. package/dist/Components/Common/MultipleSelectDropdown/index.js +124 -0
  57. package/dist/Components/Common/NotFound/index.css +16 -0
  58. package/dist/Components/Common/NotFound/index.js +19 -0
  59. package/dist/Components/Common/Title/Form.js +36 -0
  60. package/dist/Components/Common/Title/Styles.js +16 -0
  61. package/dist/Components/Common/Title/index.js +41 -0
  62. package/dist/Components/Common/Widget/index.css +435 -0
  63. package/dist/Components/Common/Widget/index.js +407 -0
  64. package/dist/Pages/Dashboard/CreatePage.css +23 -0
  65. package/dist/Pages/Dashboard/CreatePage.js +115 -0
  66. package/dist/Pages/Dashboard/index.css +114 -0
  67. package/dist/Pages/Dashboard/index.js +150 -0
  68. package/dist/Pages/LayoutPages/index.css +80 -0
  69. package/dist/Pages/LayoutPages/index.js +143 -0
  70. package/dist/Pages/Layouts/index.js +52 -0
  71. package/dist/Services/Menu.js +58 -0
  72. package/dist/Services/Routing.js +80 -0
  73. package/dist/Utility/Contexts.js +20 -0
  74. package/dist/Utility/Main.js +368 -0
  75. package/dist/Utility/Routes.js +10 -0
  76. package/dist/index.css +13 -0
  77. package/dist/index.js +15 -0
  78. package/dist/reportWebVitals.js +13 -0
  79. package/dist/setupTests.js +5 -0
  80. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Introduction
2
+
3
+ Do Graph is an open source package used to build/create/design dynamic graphs for your react project.
4
+
5
+ # Installation
6
+ ```
7
+ npm i do_graphs --save
8
+ ```
9
+
10
+ # Components
11
+ 1. CustomDashboard: Dashboard to display and create list of dynamic chart pages.
12
+ 2. LayoutPages: Page layout design using in-built charts and configure as per your requirement.
13
+ 3. Layouts: View Dynamic created pages in your app. Use this component in your root/main file i.e, App.js.
14
+
15
+ # Functions
16
+ 1. getRoutLists: Fetch dynamic pages and list it using CustomDashboard component.
17
+ 2. getMenuList: Fetch dynamic menu and list it using CustomDashboard component.
18
+
19
+ # Props
20
+ 1. CustomDashboard:<br/>
21
+ a. routeBackendUrl: (mandatory) backend url of list of dynamically created route pages.<br/>
22
+ b. isMenuLayoutPresent: (mandatory) true if your app has side menu bar.<br/>
23
+ c. headers: (optional) API headers.
24
+
25
+ 2. LayoutPages: <br/>
26
+ a. routeBackendUrl: (mandatory) backend url of list of dynamically created route pages.<br/>
27
+ b. menuBackendUrl: (mandatory) backend url of list of dynamically created menu.<br/>
28
+ c. frontendUrl: (mandatory) frontend url of your application.<br/>
29
+ d. headers: (optional) API headers.
30
+
31
+ # Implementation
32
+ Use Layouts component in your App.js file to add dynamically ceated pages in your app.
33
+ Example:
34
+ ```
35
+ import { RouteContext, getRoutLists, getMenuList, Layouts, CustomDashboard, LayoutPages } from 'do_graphs';
36
+
37
+ const App = () => {
38
+ const [routePages, setRoutePages] = useState([])
39
+ const [menu, setMenu] = useState([])
40
+ const getRoutes = async () => {
41
+ const result: any = await getRoutLists(backendUrl, config) // return the list of pages from backend
42
+ setRoutePages(result)
43
+ }
44
+ const getMenus = async () => {
45
+ const result: any = await getMenuList(backendUrl, config) // return the list of menu from backend
46
+ if (result?.length > 0) {
47
+ setMenu(result)
48
+ } else {
49
+ setMenu([])
50
+ }
51
+ }
52
+ useMemo(() => {
53
+ getRoutes()
54
+ getMenus()
55
+ }, [])
56
+ return (
57
+ <RouteContext.Provider value={{ routePages, setRoutePages, menu, setMenu }}>
58
+ <Route path={'/custom_layout'} element={<CustomDashboard routeBackendUrl={routeBackendUrl} isMenuLayoutPresent={isMenuLayoutPresent} headers={headers} />} />
59
+ <Route path={'/layout/:id'} element={<LayoutPages routeBackendUrl={CustomRouteUrl} menuBackendUrl={CustomMenuUrl} frontendUrl={Frontend} headers={headers} />} />
60
+ {routePages?.length > 0 && routePages?.map((it: any, n: number) => (
61
+ <React.Fragment key={n}>
62
+ <Route path={it.path} element={(<Layouts title={it?.title} html={it?.element} menuId={it?.menu_id} />)} />
63
+ </React.Fragment>
64
+ ))}
65
+ </RouteContext>
66
+ )
67
+ }
68
+
69
+ export default App;
70
+
71
+ ```
72
+
73
+
package/dist/App.css ADDED
@@ -0,0 +1,72 @@
1
+ @font-face {
2
+ font-family: 'Noto Sans';
3
+ font-weight: 400;
4
+ src: local('Noto Sans'), url('Assets/Fonts/NotoSans-Regular.ttf') format('truetype');
5
+ }
6
+
7
+ @font-face {
8
+ font-family: 'Noto Sans';
9
+ font-weight: 500;
10
+ src: local('Noto Sans'), url('Assets/Fonts/NotoSans-Medium.ttf') format('truetype');
11
+ }
12
+
13
+ @font-face {
14
+ font-family: 'Noto Sans';
15
+ font-weight: 600;
16
+ src: local('Noto Sans'), url('Assets/Fonts/NotoSans-SemiBold.ttf') format('truetype');
17
+ }
18
+
19
+ @font-face {
20
+ font-family: 'Noto Sans';
21
+ font-weight: 700;
22
+ src: local('Noto Sans'), url('Assets/Fonts/NotoSans-Bold.ttf') format('truetype');
23
+ }
24
+
25
+ body{
26
+ background-color: #f5f7ff !important;
27
+ }
28
+ .pad-0{
29
+ padding: 0 !important;
30
+ }
31
+
32
+ .App {
33
+ text-align: left;
34
+ font-family: "Noto Sans", sans-serif;
35
+ font-weight: 400;
36
+ font-size: 13px;
37
+ }
38
+
39
+ .App-logo {
40
+ height: 40vmin;
41
+ pointer-events: none;
42
+ }
43
+
44
+ @media (prefers-reduced-motion: no-preference) {
45
+ .App-logo {
46
+ animation: App-logo-spin infinite 20s linear;
47
+ }
48
+ }
49
+
50
+ .App-header {
51
+ background-color: #282c34;
52
+ min-height: 100vh;
53
+ display: flex;
54
+ flex-direction: column;
55
+ align-items: center;
56
+ justify-content: center;
57
+ font-size: calc(10px + 2vmin);
58
+ color: white;
59
+ }
60
+
61
+ .App-link {
62
+ color: #61dafb;
63
+ }
64
+
65
+ @keyframes App-logo-spin {
66
+ from {
67
+ transform: rotate(0deg);
68
+ }
69
+ to {
70
+ transform: rotate(360deg);
71
+ }
72
+ }
package/dist/App.js ADDED
@@ -0,0 +1,124 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import React, { useMemo, useState } from 'react';
50
+ import './App.css';
51
+ import './Bootstrap.min.css';
52
+ import { BrowserRouter, Routes, Route } from 'react-router-dom';
53
+ import { RoutePath } from './Utility/Routes';
54
+ import { getRoutLists } from './Services/Routing';
55
+ import Layouts from './Pages/Layouts';
56
+ import { RouteContext } from './Utility/Contexts';
57
+ import { toast, ToastContainer } from 'react-toastify';
58
+ import 'react-toastify/dist/ReactToastify.css';
59
+ import { getMenuList } from './Services/Menu';
60
+ var DOGraphs = function () {
61
+ var _a;
62
+ var _b = useState([]), routePages = _b[0], setRoutePages = _b[1];
63
+ var _c = useState([]), menu = _c[0], setMenu = _c[1];
64
+ var getRoutes = function () { return __awaiter(void 0, void 0, void 0, function () {
65
+ var url, config, result, error_1;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ _a.trys.push([0, 2, , 3]);
70
+ url = 'http://localhost:8001/dev/api/v1/custom-layout/routing';
71
+ config = {
72
+ method: 'GET',
73
+ headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + process.env.REACT_APP_TOKEN }
74
+ };
75
+ return [4 /*yield*/, getRoutLists(url, config)];
76
+ case 1:
77
+ result = _a.sent();
78
+ setRoutePages(result === null || result === void 0 ? void 0 : result.message);
79
+ return [3 /*break*/, 3];
80
+ case 2:
81
+ error_1 = _a.sent();
82
+ toast.error(error_1 === null || error_1 === void 0 ? void 0 : error_1.toString());
83
+ return [3 /*break*/, 3];
84
+ case 3: return [2 /*return*/];
85
+ }
86
+ });
87
+ }); };
88
+ var getMenus = function () { return __awaiter(void 0, void 0, void 0, function () {
89
+ var url, config, result, error_2;
90
+ var _a;
91
+ return __generator(this, function (_b) {
92
+ switch (_b.label) {
93
+ case 0:
94
+ _b.trys.push([0, 2, , 3]);
95
+ url = 'http://localhost:8001/dev/api/v1/custom-layout/menu';
96
+ config = {
97
+ method: 'GET',
98
+ headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + process.env.REACT_APP_TOKEN }
99
+ };
100
+ return [4 /*yield*/, getMenuList(url, config)];
101
+ case 1:
102
+ result = _b.sent();
103
+ if (((_a = result === null || result === void 0 ? void 0 : result.message) === null || _a === void 0 ? void 0 : _a.length) > 0) {
104
+ setMenu(result === null || result === void 0 ? void 0 : result.message);
105
+ }
106
+ else {
107
+ setMenu([]);
108
+ }
109
+ return [3 /*break*/, 3];
110
+ case 2:
111
+ error_2 = _b.sent();
112
+ toast.error(error_2 === null || error_2 === void 0 ? void 0 : error_2.toString());
113
+ return [3 /*break*/, 3];
114
+ case 3: return [2 /*return*/];
115
+ }
116
+ });
117
+ }); };
118
+ useMemo(function () {
119
+ getRoutes();
120
+ getMenus();
121
+ }, []);
122
+ return (_jsx(RouteContext.Provider, __assign({ value: { routePages: routePages, setRoutePages: setRoutePages, menu: menu, setMenu: setMenu } }, { children: _jsxs("div", __assign({ className: "App" }, { children: [_jsx(ToastContainer, { position: "bottom-center", autoClose: 2000, hideProgressBar: false, newestOnTop: false, closeOnClick: true, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsx(BrowserRouter, { children: _jsxs(Routes, { children: [(_a = RoutePath()) === null || _a === void 0 ? void 0 : _a.map(function (item, i) { return (_jsx(React.Fragment, { children: _jsx(Route, { path: item.path, element: (item.element) }) }, i)); }), (routePages === null || routePages === void 0 ? void 0 : routePages.length) > 0 && (routePages === null || routePages === void 0 ? void 0 : routePages.map(function (it, n) { return (_jsx(React.Fragment, { children: _jsx(Route, { path: it.path, element: (_jsx(Layouts, { title: it === null || it === void 0 ? void 0 : it.title, html: it === null || it === void 0 ? void 0 : it.element, menuId: it === null || it === void 0 ? void 0 : it.menu_id, headers: { 'Content-Type': 'application/json' } })) }) }, n)); }))] }) })] })) })));
123
+ };
124
+ export default DOGraphs;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from './App';
4
+ test('renders learn react link', function () {
5
+ render(_jsx(App, {}));
6
+ var linkElement = screen.getByText(/learn react/i);
7
+ expect(linkElement).toBeInTheDocument();
8
+ });
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file