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