@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
@@ -0,0 +1,80 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ export var getRoutLists = function (url, config) { return __awaiter(void 0, void 0, void 0, function () {
38
+ var result;
39
+ return __generator(this, function (_a) {
40
+ switch (_a.label) {
41
+ case 0: return [4 /*yield*/, fetch(url, config).then(function (res) { return (res === null || res === void 0 ? void 0 : res.ok) && res.json(); })];
42
+ case 1:
43
+ result = _a.sent();
44
+ return [2 /*return*/, result];
45
+ }
46
+ });
47
+ }); };
48
+ export var create = function (url, config) { return __awaiter(void 0, void 0, void 0, function () {
49
+ var result;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, fetch(url, config).then(function (res) { return (res === null || res === void 0 ? void 0 : res.ok) && res.json(); })];
53
+ case 1:
54
+ result = _a.sent();
55
+ return [2 /*return*/, result];
56
+ }
57
+ });
58
+ }); };
59
+ export var update = function (url, config, id) { return __awaiter(void 0, void 0, void 0, function () {
60
+ var result;
61
+ return __generator(this, function (_a) {
62
+ switch (_a.label) {
63
+ case 0: return [4 /*yield*/, fetch("".concat(url, "/").concat(id), config).then(function (res) { return (res === null || res === void 0 ? void 0 : res.ok) && res.json(); })];
64
+ case 1:
65
+ result = _a.sent();
66
+ return [2 /*return*/, result];
67
+ }
68
+ });
69
+ }); };
70
+ export var deletePageById = function (url, config, id) { return __awaiter(void 0, void 0, void 0, function () {
71
+ var result;
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0: return [4 /*yield*/, fetch("".concat(url, "/").concat(id), config).then(function (res) { return (res === null || res === void 0 ? void 0 : res.ok) && res.json(); })];
75
+ case 1:
76
+ result = _a.sent();
77
+ return [2 /*return*/, result];
78
+ }
79
+ });
80
+ }); };
@@ -0,0 +1,20 @@
1
+ import { createContext } from "react";
2
+ export var ModelPopUp = {
3
+ showPopup: false,
4
+ setshowPopup: function () { },
5
+ modelData: {},
6
+ setModelData: function () { }
7
+ };
8
+ export var GraphData = {
9
+ drawData: {},
10
+ setDrawData: function () { },
11
+ graphOptions: {},
12
+ setGraphOptions: function () { }
13
+ };
14
+ export var DynamicRoute = {
15
+ routePages: {},
16
+ setRoutePages: function () { }
17
+ };
18
+ export var PopUpContext = createContext(ModelPopUp);
19
+ export var GraphContext = createContext(GraphData);
20
+ export var RouteContext = createContext(DynamicRoute);
@@ -0,0 +1,368 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39
+ if (ar || !(i in from)) {
40
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41
+ ar[i] = from[i];
42
+ }
43
+ }
44
+ return to.concat(ar || Array.prototype.slice.call(from));
45
+ };
46
+ import { jsx as _jsx } from "react/jsx-runtime";
47
+ import BarImage from '../Assets/Images/bar-graph.png';
48
+ import LineImage from '../Assets/Images/line-chart.png';
49
+ import HorizontalBarImage from '../Assets/Images/horizontal-bar-graph.png';
50
+ import MizedChartImage from '../Assets/Images/mixed-chart.png';
51
+ import DoughnutChartImage from '../Assets/Images/doughnut.png';
52
+ import PieChartImage from '../Assets/Images/pie-chart.png';
53
+ import PolarChartImage from '../Assets/Images/polar-chart.png';
54
+ import ScatterChartImage from '../Assets/Images/scatter-graph.png';
55
+ import TableChartImage from '../Assets/Images/table.png';
56
+ import ProgressChartImage from '../Assets/Images/progress-bar.png';
57
+ import Coding from '../Assets/Images/coding.png';
58
+ import Bar from '../Components/Charts/Bar';
59
+ import Line from '../Components/Charts/Line';
60
+ import MixedChart from '../Components/Charts/MixedChart';
61
+ import DoughnutAndPie from '../Components/Charts/DoughnutAndPie';
62
+ import PolarArea from '../Components/Charts/PolarArea';
63
+ import TableChart from '../Components/Charts/Table';
64
+ import Scatter from '../Components/Charts/Scatter';
65
+ import ProgressChart from '../Components/Charts/Progess';
66
+ import { toast } from 'react-toastify';
67
+ import CustomComponent from '../Components/Common/CustomComponent';
68
+ export var ChartTypes;
69
+ (function (ChartTypes) {
70
+ ChartTypes["BAR"] = "bar";
71
+ ChartTypes["LINE"] = "line";
72
+ ChartTypes["DOUGHNUT"] = "doughnut";
73
+ ChartTypes["PIE"] = "pie";
74
+ ChartTypes["BUBBLE"] = "bubble";
75
+ ChartTypes["POLAR"] = "polarArea";
76
+ ChartTypes["RADAR"] = "radar";
77
+ ChartTypes["SCATTER"] = "scatter";
78
+ ChartTypes["GEO"] = "choropleth";
79
+ ChartTypes["TABLE"] = "table";
80
+ ChartTypes["MIXED"] = "mixed";
81
+ ChartTypes["PROGRESS"] = "progress";
82
+ })(ChartTypes || (ChartTypes = {}));
83
+ export var GraphConfigs = {
84
+ POINT_FONT_SIZE: 10,
85
+ DEFAULT_BGCOLOR: ['#fd746c', '#ff9068'],
86
+ TICK_FONT_SIZE: 10,
87
+ FONT_FAMILY: "Noto Sans"
88
+ };
89
+ export var ModelTypes;
90
+ (function (ModelTypes) {
91
+ ModelTypes["CONFIGURE"] = "configure";
92
+ ModelTypes["FORM"] = "form";
93
+ ModelTypes["SIDE_FORM"] = "side_form";
94
+ })(ModelTypes || (ModelTypes = {}));
95
+ export var Modules;
96
+ (function (Modules) {
97
+ Modules["DASHBOARD"] = "dashboard";
98
+ Modules["MENU"] = "menu";
99
+ Modules["TITLE"] = "title";
100
+ })(Modules || (Modules = {}));
101
+ export var ChartCategories = [
102
+ {
103
+ id: 1,
104
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.BAR,
105
+ title: 'Bar',
106
+ image: BarImage
107
+ },
108
+ {
109
+ id: 2,
110
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.LINE,
111
+ title: 'Line',
112
+ image: LineImage
113
+ },
114
+ {
115
+ id: 3,
116
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.BAR,
117
+ title: 'Horizontal Bar',
118
+ image: HorizontalBarImage
119
+ },
120
+ {
121
+ id: 4,
122
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.LINE,
123
+ title: 'Mixed Chart',
124
+ image: MizedChartImage
125
+ },
126
+ {
127
+ id: 5,
128
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.DOUGHNUT,
129
+ title: 'Douhgnut',
130
+ image: DoughnutChartImage
131
+ },
132
+ {
133
+ id: 6,
134
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.PIE,
135
+ title: 'Pie',
136
+ image: PieChartImage
137
+ },
138
+ {
139
+ id: 7,
140
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.POLAR,
141
+ title: 'Polar',
142
+ image: PolarChartImage
143
+ },
144
+ {
145
+ id: 8,
146
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.SCATTER,
147
+ title: 'Scatter',
148
+ image: ScatterChartImage
149
+ },
150
+ // {
151
+ // id: 9,
152
+ // name: ChartTypes?.GEO,
153
+ // title: 'Geography',
154
+ // image: GeogrpahyChartImage
155
+ // },
156
+ {
157
+ id: 10,
158
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.TABLE,
159
+ title: 'Table',
160
+ image: TableChartImage
161
+ },
162
+ {
163
+ id: 11,
164
+ name: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.PROGRESS,
165
+ title: 'Progress',
166
+ image: ProgressChartImage
167
+ },
168
+ {
169
+ id: 12,
170
+ name: 'custom',
171
+ title: 'Custom',
172
+ image: Coding
173
+ }
174
+ ];
175
+ export var storeLocal = function (key, value) {
176
+ return localStorage.setItem(key, value);
177
+ };
178
+ export var getLocal = function (key) {
179
+ return localStorage.getItem(key);
180
+ };
181
+ export var renderHtmlData = function (component, props) {
182
+ switch (component) {
183
+ case ChartTypes.BAR:
184
+ return _jsx(Bar, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
185
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.LINE:
186
+ return _jsx(Line, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
187
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.MIXED:
188
+ return _jsx(MixedChart, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
189
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.DOUGHNUT:
190
+ return _jsx(DoughnutAndPie, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, chart: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.DOUGHNUT, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
191
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.PIE:
192
+ return _jsx(DoughnutAndPie, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, chart: ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.PIE, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
193
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.POLAR:
194
+ return _jsx(PolarArea, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
195
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.SCATTER:
196
+ return _jsx(Scatter, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
197
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.TABLE:
198
+ return _jsx(TableChart, { title: props === null || props === void 0 ? void 0 : props.title, tableData: props === null || props === void 0 ? void 0 : props.tableData, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, chartOptions: props === null || props === void 0 ? void 0 : props.chartOptions, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
199
+ case ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.PROGRESS:
200
+ return _jsx(ProgressChart, { title: props === null || props === void 0 ? void 0 : props.title, labels: props === null || props === void 0 ? void 0 : props.labels, datasets: props === null || props === void 0 ? void 0 : props.datasets, isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, layoutId: props === null || props === void 0 ? void 0 : props.id, apiCall: props === null || props === void 0 ? void 0 : props.apiCall });
201
+ case 'custom':
202
+ return _jsx(CustomComponent, { isConfigEdit: props === null || props === void 0 ? void 0 : props.isConfigEdit, component: props === null || props === void 0 ? void 0 : props.component, layoutId: props === null || props === void 0 ? void 0 : props.id });
203
+ default:
204
+ return '';
205
+ }
206
+ };
207
+ export var APIRequestMethods;
208
+ (function (APIRequestMethods) {
209
+ APIRequestMethods["GET"] = "GET";
210
+ APIRequestMethods["POST"] = "POST";
211
+ APIRequestMethods["DELETE"] = "DELETE";
212
+ APIRequestMethods["PATCH"] = "PATCH";
213
+ APIRequestMethods["PUT"] = "PUT";
214
+ })(APIRequestMethods || (APIRequestMethods = {}));
215
+ export var fetchApi = function (apiCall, drawData, chart_type, modelEdit, chartOptions) { return __awaiter(void 0, void 0, void 0, function () {
216
+ var config, res, result, i, colValues, j, arr, labels, j, maxArr, hasStateLegend, _loop_1, i, sumMaxArr, error_1;
217
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
218
+ return __generator(this, function (_y) {
219
+ switch (_y.label) {
220
+ case 0:
221
+ _y.trys.push([0, 5, , 6]);
222
+ if (!((apiCall === null || apiCall === void 0 ? void 0 : apiCall.display) && !modelEdit)) return [3 /*break*/, 4];
223
+ config = {
224
+ method: apiCall === null || apiCall === void 0 ? void 0 : apiCall.method,
225
+ headers: JSON.parse(apiCall === null || apiCall === void 0 ? void 0 : apiCall.headers)
226
+ };
227
+ if ((apiCall === null || apiCall === void 0 ? void 0 : apiCall.method) !== (APIRequestMethods === null || APIRequestMethods === void 0 ? void 0 : APIRequestMethods.GET)) {
228
+ config['body'] = apiCall === null || apiCall === void 0 ? void 0 : apiCall.body;
229
+ }
230
+ return [4 /*yield*/, fetch(apiCall === null || apiCall === void 0 ? void 0 : apiCall.uri, config)];
231
+ case 1:
232
+ res = _y.sent();
233
+ if (!(res === null || res === void 0 ? void 0 : res.ok)) return [3 /*break*/, 3];
234
+ return [4 /*yield*/, (res === null || res === void 0 ? void 0 : res.json())];
235
+ case 2:
236
+ result = _y.sent();
237
+ if (chart_type === (ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.TABLE)) {
238
+ for (i = 0; i < ((_a = result === null || result === void 0 ? void 0 : result.message) === null || _a === void 0 ? void 0 : _a.length); i++) {
239
+ colValues = [];
240
+ for (j = 0; j < ((_b = drawData === null || drawData === void 0 ? void 0 : drawData.columns) === null || _b === void 0 ? void 0 : _b.length); j++) {
241
+ colValues.push(((_d = (_c = result === null || result === void 0 ? void 0 : result.message) === null || _c === void 0 ? void 0 : _c[i]) === null || _d === void 0 ? void 0 : _d[(_e = drawData === null || drawData === void 0 ? void 0 : drawData.columns) === null || _e === void 0 ? void 0 : _e[j]]) || '');
242
+ }
243
+ drawData['rows'][i] = colValues;
244
+ }
245
+ }
246
+ else if (chart_type === (ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.PROGRESS)) {
247
+ arr = [];
248
+ labels = [];
249
+ for (j = 0; j < ((_f = result === null || result === void 0 ? void 0 : result.message) === null || _f === void 0 ? void 0 : _f.length); j++) {
250
+ arr.push((_h = (_g = result === null || result === void 0 ? void 0 : result.message) === null || _g === void 0 ? void 0 : _g[j]) === null || _h === void 0 ? void 0 : _h[apiCall === null || apiCall === void 0 ? void 0 : apiCall.yAxisField[0]]);
251
+ labels.push((_k = (_j = result === null || result === void 0 ? void 0 : result.message) === null || _j === void 0 ? void 0 : _j[j]) === null || _k === void 0 ? void 0 : _k[apiCall === null || apiCall === void 0 ? void 0 : apiCall.xAxisField[0]]);
252
+ }
253
+ drawData['datasets'] = arr;
254
+ drawData['labels'] = labels;
255
+ }
256
+ else {
257
+ maxArr = [];
258
+ hasStateLegend = ['Per Capita Income(INR)', 'CPI (Ratio)', 'WPI (Ratio)', 'Per Capita Electricity Consumption (KWH)', 'Credit to Deposit Ratio', 'Overall Fish Production (Tons/Ha)', 'Total Egg Production (Mn.)', 'Poultry Meat Production (Mn. Tn.)', 'Total Milk Production (Mn. Tn.)', 'No. of AI Procedures Conducted in Sector', 'Manufacturing GSVA (INR Lakh Cr.)', 'GVA per Factory (INR Cr./Unit)', 'Overall Exports (INR Cr.)', 'No. of Operational Factories under ASI Frame', 'Increase in No. of MSMEs Registered on UDYAM Registration Portal', 'MSME credit as a % of GSDP (%)', 'Advances to MSME (INR Cr.)', 'Total Energy Consumption of Industries based on ASI (INR Thousand Cr.)', 'Percentage of Manufacturing to Total Working Population', 'Employment Generated under PMEGP (000s)', 'No. of establishments registered with EPFO', 'No. of members enrolled under EPFO in the State'];
259
+ _loop_1 = function (i) {
260
+ var arr = [];
261
+ var labels = [];
262
+ for (var j = 0; j < ((_m = result === null || result === void 0 ? void 0 : result.message) === null || _m === void 0 ? void 0 : _m.length); j++) {
263
+ arr.push(((_p = (_o = result === null || result === void 0 ? void 0 : result.message) === null || _o === void 0 ? void 0 : _o[j]) === null || _p === void 0 ? void 0 : _p[apiCall === null || apiCall === void 0 ? void 0 : apiCall.yAxisField[i]]) || 0);
264
+ labels.push((_r = (_q = result === null || result === void 0 ? void 0 : result.message) === null || _q === void 0 ? void 0 : _q[j]) === null || _r === void 0 ? void 0 : _r[apiCall === null || apiCall === void 0 ? void 0 : apiCall.xAxisField[0]]);
265
+ }
266
+ drawData['datasets'][i]['data'] = arr;
267
+ drawData['labels'] = labels;
268
+ drawData['datasets'][i]['datalabels']['formatter'] = function (value) {
269
+ var _a, _b;
270
+ return ((_a = drawData['datasets'][i]) === null || _a === void 0 ? void 0 : _a.addPointLabel) ? value + ((_b = drawData['datasets'][i]) === null || _b === void 0 ? void 0 : _b.addPointLabel) : value;
271
+ };
272
+ var parseBody = (apiCall === null || apiCall === void 0 ? void 0 : apiCall.body) ? JSON.parse(apiCall['body']) : null;
273
+ if ((_s = parseBody === null || parseBody === void 0 ? void 0 : parseBody.state_array) === null || _s === void 0 ? void 0 : _s.includes('India')) {
274
+ var getIndex = (_t = parseBody === null || parseBody === void 0 ? void 0 : parseBody.state_array) === null || _t === void 0 ? void 0 : _t.indexOf('India');
275
+ var removeElement = (_u = parseBody === null || parseBody === void 0 ? void 0 : parseBody.state_array) === null || _u === void 0 ? void 0 : _u.splice(getIndex, 1);
276
+ parseBody['state_array'] = __spreadArray(__spreadArray([], parseBody['state_array'], true), ['India'], false);
277
+ }
278
+ if ((_v = parseBody === null || parseBody === void 0 ? void 0 : parseBody.state_array) === null || _v === void 0 ? void 0 : _v.length) {
279
+ if (hasStateLegend === null || hasStateLegend === void 0 ? void 0 : hasStateLegend.includes(drawData === null || drawData === void 0 ? void 0 : drawData.title)) {
280
+ drawData['datasets'][i]['label'] = ((_w = parseBody === null || parseBody === void 0 ? void 0 : parseBody.state_array) === null || _w === void 0 ? void 0 : _w[i]) || 'NA';
281
+ }
282
+ }
283
+ var getMax = Math.max.apply(Math, arr);
284
+ maxArr === null || maxArr === void 0 ? void 0 : maxArr.push(getMax);
285
+ };
286
+ for (i = 0; i < ((_l = drawData === null || drawData === void 0 ? void 0 : drawData.datasets) === null || _l === void 0 ? void 0 : _l.length); i++) {
287
+ _loop_1(i);
288
+ }
289
+ sumMaxArr = maxArr === null || maxArr === void 0 ? void 0 : maxArr.reduce(function (a, b) { return a + b; }, 0);
290
+ if ((_x = [ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.MIXED, ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.BAR, ChartTypes === null || ChartTypes === void 0 ? void 0 : ChartTypes.LINE]) === null || _x === void 0 ? void 0 : _x.includes(chart_type)) {
291
+ chartOptions['scales']['y']['max'] = sumMaxArr * 1.2;
292
+ }
293
+ }
294
+ return [2 /*return*/, drawData];
295
+ case 3:
296
+ if (!(res === null || res === void 0 ? void 0 : res.ok)) {
297
+ drawData['datasets'] = [];
298
+ drawData['labels'] = [];
299
+ }
300
+ _y.label = 4;
301
+ case 4: return [3 /*break*/, 6];
302
+ case 5:
303
+ error_1 = _y.sent();
304
+ toast.error(error_1 === null || error_1 === void 0 ? void 0 : error_1.toString());
305
+ return [3 /*break*/, 6];
306
+ case 6: return [2 /*return*/];
307
+ }
308
+ });
309
+ }); };
310
+ export var titleStyleConfig = function () {
311
+ return {
312
+ backgroundColor: '#fff',
313
+ color: '#000'
314
+ };
315
+ };
316
+ export var chartDrawData = function (props, layout, chartDatasets) {
317
+ var _a;
318
+ var getLayout = (_a = layout === null || layout === void 0 ? void 0 : layout.find(function (it) { return (it === null || it === void 0 ? void 0 : it.i) === (props === null || props === void 0 ? void 0 : props.layoutId); })) === null || _a === void 0 ? void 0 : _a.props;
319
+ var getStyles = getLayout === null || getLayout === void 0 ? void 0 : getLayout.styles;
320
+ var getUrl = getLayout === null || getLayout === void 0 ? void 0 : getLayout.url;
321
+ var getUrlTitle = getLayout === null || getLayout === void 0 ? void 0 : getLayout.urlTitle;
322
+ var getFilters = getLayout === null || getLayout === void 0 ? void 0 : getLayout.filters;
323
+ return {
324
+ title: props === null || props === void 0 ? void 0 : props.title,
325
+ labels: props === null || props === void 0 ? void 0 : props.labels,
326
+ datasets: chartDatasets,
327
+ styles: getStyles ? getStyles : titleStyleConfig(),
328
+ urlTitle: getUrlTitle ? getUrlTitle : '',
329
+ url: getUrl ? getUrl : '',
330
+ filters: getFilters || [],
331
+ apiCall: (props === null || props === void 0 ? void 0 : props.apiCall) ? props === null || props === void 0 ? void 0 : props.apiCall : {}
332
+ };
333
+ };
334
+ export var updateChartLayoutDetails = function (field, data, layout, layoutId) {
335
+ for (var i = 0; i < (layout === null || layout === void 0 ? void 0 : layout.length); i++) {
336
+ if (layout[i]['i'] === layoutId) {
337
+ if (field.includes('labels')) {
338
+ layout[i]['props']['labels'] = data['labels'];
339
+ }
340
+ if (field.includes('datasets')) {
341
+ layout[i]['props']['datasets'] = data['datasets'];
342
+ }
343
+ if (field.includes('options')) {
344
+ layout[i]['props']['chartOptions'] = data;
345
+ }
346
+ if (field.includes('title')) {
347
+ layout[i]['props']['title'] = data['title'];
348
+ }
349
+ if (field.includes('styles')) {
350
+ layout[i]['props']['styles'] = data['styles'];
351
+ }
352
+ if (field.includes('url')) {
353
+ layout[i]['props']['url'] = data['url'];
354
+ }
355
+ if (field.includes('filters')) {
356
+ layout[i]['props']['filters'] = data['filters'];
357
+ }
358
+ if (field.includes('apiCall')) {
359
+ layout[i]['props']['apiCall'] = data['apiCall'];
360
+ }
361
+ if (field.includes('urlTitle')) {
362
+ layout[i]['props']['urlTitle'] = data['urlTitle'];
363
+ }
364
+ }
365
+ }
366
+ return layout;
367
+ };
368
+ export var STORAGE_KEY = 'chartData';
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import LayoutPages from "../Pages/LayoutPages";
3
+ import Dashboard from "../Pages/Dashboard";
4
+ export var RoutePath = function () {
5
+ var route = [
6
+ { id: 1, path: '/', element: _jsx(Dashboard, { routeBackendUrl: 'http://localhost:8001/dev/api/v1/custom-layout/routing' }) },
7
+ { id: 2, path: '/layout/:id', element: _jsx(LayoutPages, { routeBackendUrl: 'http://localhost:8001/dev/api/v1/custom-layout/routing', menuBackendUrl: 'http://localhost:8001/dev/api/v1/custom-layout/menu', headers: {}, frontendUrl: 'http://localhost:3000' }) },
8
+ ];
9
+ return route;
10
+ };
package/dist/index.css ADDED
@@ -0,0 +1,13 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export { RouteContext } from './Utility/Contexts';
2
+ export { getRoutLists } from './Services/Routing';
3
+ export { getMenuList } from './Services/Menu';
4
+ export { default as CustomDashboard } from "./Pages/Dashboard";
5
+ export { default as LayoutPages } from "./Pages/LayoutPages";
6
+ export { default as Layouts } from "./Pages/Layouts";
7
+ // import ReactDOM from 'react-dom/client';
8
+ // import './index.css';
9
+ // import DOGraphs from './App';
10
+ // import reportWebVitals from './reportWebVitals';
11
+ // const root = ReactDOM.createRoot(
12
+ // document.getElementById('app') as HTMLElement
13
+ // );
14
+ // root.render(<DOGraphs />);
15
+ // reportWebVitals();
@@ -0,0 +1,13 @@
1
+ var reportWebVitals = function (onPerfEntry) {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(function (_a) {
4
+ var getCLS = _a.getCLS, getFID = _a.getFID, getFCP = _a.getFCP, getLCP = _a.getLCP, getTTFB = _a.getTTFB;
5
+ getCLS(onPerfEntry);
6
+ getFID(onPerfEntry);
7
+ getFCP(onPerfEntry);
8
+ getLCP(onPerfEntry);
9
+ getTTFB(onPerfEntry);
10
+ });
11
+ }
12
+ };
13
+ export default reportWebVitals;
@@ -0,0 +1,5 @@
1
+ // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
+ // allows you to do things like:
3
+ // expect(element).toHaveTextContent(/react/i)
4
+ // learn more: https://github.com/testing-library/jest-dom
5
+ import '@testing-library/jest-dom';
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@msrajawat298/do-graphs",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "author": "Mayank Singh Kushwah",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "keywords": [
13
+ "react",
14
+ "component",
15
+ "npm",
16
+ "graphs",
17
+ "charts",
18
+ "dashboard",
19
+ "analytics"
20
+ ],
21
+ "dependencies": {
22
+ "@fortawesome/fontawesome-svg-core": "^6.6.0",
23
+ "@fortawesome/free-regular-svg-icons": "^6.6.0",
24
+ "@fortawesome/free-solid-svg-icons": "^6.6.0",
25
+ "@fortawesome/react-fontawesome": "^0.2.2",
26
+ "@testing-library/jest-dom": "^5.17.0",
27
+ "@testing-library/react": "^13.4.0",
28
+ "@testing-library/user-event": "^13.5.0",
29
+ "@types/jest": "^27.5.2",
30
+ "@types/node": "^16.18.104",
31
+ "@types/react": "^18.3.3",
32
+ "@types/react-dom": "^18.3.0",
33
+ "chart.js": "^4.4.4",
34
+ "chartjs-plugin-datalabels": "^2.2.0",
35
+ "react": "^18.3.1",
36
+ "react-chartjs-2": "^5.2.0",
37
+ "react-dom": "^18.3.1",
38
+ "react-grid-layout": "^1.4.4",
39
+ "react-router-dom": "^6.25.1",
40
+ "react-scripts": "5.0.1",
41
+ "react-toastify": "^10.0.5",
42
+ "save-dev": "^0.0.1-security",
43
+ "typescript": "^4.9.5",
44
+ "web-vitals": "^2.1.4",
45
+ "xlsx": "^0.18.5"
46
+ },
47
+ "scripts": {
48
+ "start": "react-scripts start",
49
+ "test": "react-scripts test",
50
+ "eject": "react-scripts eject",
51
+ "clean": "rimraf dist/",
52
+ "copy-files": "copyfiles -u 1 src/**/*.html src/**/*.css src/Assets/** dist/",
53
+ "build": "npm run clean && tsc && npm run copy-files",
54
+ "prepublishOnly": "npm run build"
55
+ },
56
+ "eslintConfig": {
57
+ "extends": [
58
+ "react-app",
59
+ "react-app/jest"
60
+ ]
61
+ },
62
+ "browserslist": [
63
+ ">0.2%",
64
+ "not dead",
65
+ "not op_mini all"
66
+ ],
67
+ "devDependencies": {
68
+ "@types/react-grid-layout": "^1.3.5",
69
+ "copyfiles": "^2.4.1",
70
+ "rimraf": "^6.0.1"
71
+ }
72
+ }