@ammarkhalidfarooq/dashboard-package 0.1.4 → 0.1.5
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/dist/index.cjs.js +32 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +32 -15
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -91,6 +91,15 @@ function _toPropertyKey(t) {
|
|
|
91
91
|
var i = _toPrimitive(t, "string");
|
|
92
92
|
return "symbol" == typeof i ? i : i + "";
|
|
93
93
|
}
|
|
94
|
+
function _typeof(o) {
|
|
95
|
+
"@babel/helpers - typeof";
|
|
96
|
+
|
|
97
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
98
|
+
return typeof o;
|
|
99
|
+
} : function (o) {
|
|
100
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
101
|
+
}, _typeof(o);
|
|
102
|
+
}
|
|
94
103
|
function _unsupportedIterableToArray(r, a) {
|
|
95
104
|
if (r) {
|
|
96
105
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -369,12 +378,18 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
369
378
|
if (isRadial) {
|
|
370
379
|
var _series$;
|
|
371
380
|
// For donut/pie, series must be a simple array of numbers
|
|
372
|
-
|
|
381
|
+
var processedData = Array.isArray(data) ? data.map(function (v) {
|
|
382
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
383
|
+
}) : [];
|
|
384
|
+
chartSeries = processedData.length > 0 ? processedData : (series === null || series === void 0 || (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.data) || [];
|
|
373
385
|
} else {
|
|
374
386
|
// For bar/line/area, series must be an array of objects [{ name: '', data: [] }]
|
|
387
|
+
var _processedData = Array.isArray(data) ? data.map(function (v) {
|
|
388
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
389
|
+
}) : [];
|
|
375
390
|
chartSeries = Array.isArray(series) ? series : [{
|
|
376
391
|
name: metric || "Value",
|
|
377
|
-
data:
|
|
392
|
+
data: _processedData
|
|
378
393
|
}];
|
|
379
394
|
}
|
|
380
395
|
return /*#__PURE__*/jsxRuntime.jsx(ReactApexChart, {
|
|
@@ -448,14 +463,14 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
448
463
|
color: "#000000",
|
|
449
464
|
mb: 0.5
|
|
450
465
|
},
|
|
451
|
-
children: item.value
|
|
466
|
+
children: _typeof(item.value) === 'object' && item.value !== null ? item.value.value !== undefined ? item.value.value : JSON.stringify(item.value) : item.value
|
|
452
467
|
}), item.subValue && /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
453
468
|
variant: "subtitle2",
|
|
454
469
|
sx: {
|
|
455
470
|
color: "#000000",
|
|
456
471
|
fontWeight: 600
|
|
457
472
|
},
|
|
458
|
-
children: item.subValue
|
|
473
|
+
children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
|
|
459
474
|
})]
|
|
460
475
|
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
461
476
|
sx: {
|
|
@@ -723,7 +738,7 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
723
738
|
fontSize: '22px',
|
|
724
739
|
fontWeight: '500'
|
|
725
740
|
},
|
|
726
|
-
children: value
|
|
741
|
+
children: _typeof(value) === 'object' && value !== null ? value.value !== undefined ? value.value : JSON.stringify(value) : value
|
|
727
742
|
})]
|
|
728
743
|
})
|
|
729
744
|
});
|
|
@@ -5180,7 +5195,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5180
5195
|
});
|
|
5181
5196
|
|
|
5182
5197
|
var OverallSection = function OverallSection(_ref) {
|
|
5183
|
-
var
|
|
5198
|
+
var _ref$apiData = _ref.apiData,
|
|
5199
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
5200
|
+
primaryCharts = _ref.primaryCharts,
|
|
5184
5201
|
secondaryCharts = _ref.secondaryCharts,
|
|
5185
5202
|
tertiaryCharts = _ref.tertiaryCharts,
|
|
5186
5203
|
quaternaryCharts = _ref.quaternaryCharts;
|
|
@@ -5193,31 +5210,31 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5193
5210
|
},
|
|
5194
5211
|
children: [/*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5195
5212
|
title: "Total Raised",
|
|
5196
|
-
value: "$9,200",
|
|
5213
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRaised) || "$9,200",
|
|
5197
5214
|
sx: {
|
|
5198
5215
|
flex: 1
|
|
5199
5216
|
}
|
|
5200
5217
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5201
5218
|
title: "Net Raised",
|
|
5202
|
-
value: "$9,200",
|
|
5219
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.netRaised) || "$9,200",
|
|
5203
5220
|
sx: {
|
|
5204
5221
|
flex: 1
|
|
5205
5222
|
}
|
|
5206
5223
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5207
5224
|
title: "Total Spent",
|
|
5208
|
-
value: "$9,200",
|
|
5225
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalSpent) || "$9,200",
|
|
5209
5226
|
sx: {
|
|
5210
5227
|
flex: 1
|
|
5211
5228
|
}
|
|
5212
5229
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5213
5230
|
title: "Total ROAS",
|
|
5214
|
-
value: "3.0",
|
|
5231
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRoas) || "3.0",
|
|
5215
5232
|
sx: {
|
|
5216
5233
|
flex: 1
|
|
5217
5234
|
}
|
|
5218
5235
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5219
5236
|
title: "Total Donors",
|
|
5220
|
-
value: "215",
|
|
5237
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "215",
|
|
5221
5238
|
sx: {
|
|
5222
5239
|
flex: 1
|
|
5223
5240
|
}
|
|
@@ -5232,7 +5249,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5232
5249
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5233
5250
|
item: item,
|
|
5234
5251
|
index: index
|
|
5235
|
-
});
|
|
5252
|
+
}, "primary-".concat(index));
|
|
5236
5253
|
})
|
|
5237
5254
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
5238
5255
|
container: true,
|
|
@@ -5244,7 +5261,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5244
5261
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5245
5262
|
item: item,
|
|
5246
5263
|
index: index
|
|
5247
|
-
});
|
|
5264
|
+
}, "secondary-".concat(index));
|
|
5248
5265
|
})
|
|
5249
5266
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
5250
5267
|
container: true,
|
|
@@ -5256,7 +5273,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5256
5273
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5257
5274
|
item: item,
|
|
5258
5275
|
index: index
|
|
5259
|
-
});
|
|
5276
|
+
}, "tertiary-".concat(index));
|
|
5260
5277
|
})
|
|
5261
5278
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
5262
5279
|
container: true,
|
|
@@ -5268,7 +5285,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5268
5285
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5269
5286
|
item: item,
|
|
5270
5287
|
index: index
|
|
5271
|
-
});
|
|
5288
|
+
}, "quaternary-".concat(index));
|
|
5272
5289
|
})
|
|
5273
5290
|
})]
|
|
5274
5291
|
});
|