logitude-dashboard-library 1.4.78 → 1.4.80
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.js +114 -60
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +114 -60
- package/dist/index.modern.js.map +1 -1
- package/dist/types/widget.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var reactGridLayout = require('react-grid-layout');
|
|
|
6
6
|
var progressspinner = require('primereact/progressspinner');
|
|
7
7
|
var axios = _interopDefault(require('axios'));
|
|
8
8
|
var moment = _interopDefault(require('moment'));
|
|
9
|
+
var uuid = require('uuid');
|
|
9
10
|
var ReactFC = _interopDefault(require('react-fusioncharts'));
|
|
10
11
|
var FusionCharts = _interopDefault(require('fusioncharts'));
|
|
11
12
|
var Charts = _interopDefault(require('fusioncharts/fusioncharts.charts'));
|
|
@@ -310,11 +311,11 @@ var isNullOrUndefined = function isNullOrUndefined(val) {
|
|
|
310
311
|
};
|
|
311
312
|
|
|
312
313
|
var KpiChart = function KpiChart(props) {
|
|
313
|
-
var _widget$
|
|
314
|
+
var _widget$current17;
|
|
314
315
|
|
|
315
|
-
var _useState = React.useState(
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
var _useState = React.useState(true),
|
|
317
|
+
isLoading = _useState[0],
|
|
318
|
+
setIsLoading = _useState[1];
|
|
318
319
|
|
|
319
320
|
var _useState2 = React.useState(),
|
|
320
321
|
error = _useState2[0],
|
|
@@ -330,13 +331,23 @@ var KpiChart = function KpiChart(props) {
|
|
|
330
331
|
isKPICustomSizeNeeded = _useState4[0],
|
|
331
332
|
setIsKPICustomSizeNeeded = _useState4[1];
|
|
332
333
|
|
|
334
|
+
var _useState5 = React.useState(uuid.v4()),
|
|
335
|
+
triggerId = _useState5[0],
|
|
336
|
+
setTriggerId = _useState5[1];
|
|
337
|
+
|
|
333
338
|
React.useEffect(function () {
|
|
339
|
+
var _props$customChartPro;
|
|
340
|
+
|
|
334
341
|
widget.current = props.customChartProps.widget;
|
|
335
342
|
HandleKPICustomSize();
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
343
|
+
RefreshData();
|
|
344
|
+
(_props$customChartPro = props.customChartProps.dataBinding) === null || _props$customChartPro === void 0 ? void 0 : _props$customChartPro.widgetUpdated.subscribe(function (updatedWidget) {
|
|
345
|
+
var _widget$current;
|
|
346
|
+
|
|
347
|
+
if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) return;
|
|
348
|
+
widget.current = _extends({}, updatedWidget);
|
|
349
|
+
setTriggerId(uuid.v4());
|
|
350
|
+
});
|
|
340
351
|
}, []);
|
|
341
352
|
React.useEffect(function () {
|
|
342
353
|
HandleKPICustomSize();
|
|
@@ -355,7 +366,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
355
366
|
var emptyData = {};
|
|
356
367
|
emptyData.Value = 0;
|
|
357
368
|
setData(emptyData);
|
|
358
|
-
|
|
369
|
+
setIsLoading(false);
|
|
359
370
|
return;
|
|
360
371
|
}
|
|
361
372
|
|
|
@@ -366,22 +377,22 @@ var KpiChart = function KpiChart(props) {
|
|
|
366
377
|
postWidget.onChange = undefined;
|
|
367
378
|
dashboardAnalyticsService.getKpiData(postWidget).then(function (result) {
|
|
368
379
|
setData(result.data);
|
|
369
|
-
|
|
380
|
+
setIsLoading(false);
|
|
370
381
|
}, function (error) {
|
|
371
382
|
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
372
383
|
|
|
373
384
|
console.log('error', error);
|
|
374
385
|
if (error !== null && error !== void 0 && (_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$data = _error$response.data) !== null && _error$response$data !== void 0 && _error$response$data.ErrorMessage) setError(error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.ErrorMessage);else setError(error.message);
|
|
375
|
-
|
|
386
|
+
setIsLoading(false);
|
|
376
387
|
});
|
|
377
388
|
};
|
|
378
389
|
|
|
379
390
|
var kpiClick = function kpiClick() {
|
|
380
|
-
var _widget$
|
|
391
|
+
var _widget$current2, _widget$current3, _widget$current4, _widget$current4$Widg;
|
|
381
392
|
|
|
382
393
|
var measureFieldId;
|
|
383
|
-
var currentWidgetMeasure = widget === null || widget === void 0 ? void 0 : (_widget$
|
|
384
|
-
if (widget !== null && widget !== void 0 && (_widget$
|
|
394
|
+
var currentWidgetMeasure = widget === null || widget === void 0 ? void 0 : (_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : _widget$current2.WidgetMeasures[0];
|
|
395
|
+
if (widget !== null && widget !== void 0 && (_widget$current3 = widget.current) !== null && _widget$current3 !== void 0 && _widget$current3.WidgetMeasures) measureFieldId = widget === null || widget === void 0 ? void 0 : (_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : (_widget$current4$Widg = _widget$current4.WidgetMeasures[0]) === null || _widget$current4$Widg === void 0 ? void 0 : _widget$current4$Widg.MeasureFieldId;
|
|
385
396
|
props.customChartProps.onSelectDataPoint({
|
|
386
397
|
MeasureFieldId: measureFieldId,
|
|
387
398
|
Widget: widget.current,
|
|
@@ -401,6 +412,8 @@ var KpiChart = function KpiChart(props) {
|
|
|
401
412
|
}
|
|
402
413
|
|
|
403
414
|
function getArrowComponent() {
|
|
415
|
+
var _widget$current5, _widget$current6, _widget$current7, _widget$current8, _widget$current9, _widget$current10, _widget$current11, _widget$current12;
|
|
416
|
+
|
|
404
417
|
if (!data) return null;
|
|
405
418
|
if ((data === null || data === void 0 ? void 0 : data.Ratio) == 0 || data.Value == data.ComparisonValue || (data.Value == "0" || data.Value == 0) && (data.ComparisonValue == "0" || data.ComparisonValue == 0)) return React__default.createElement("div", {
|
|
406
419
|
className: "dl-kpi-arrow-container"
|
|
@@ -412,22 +425,22 @@ var KpiChart = function KpiChart(props) {
|
|
|
412
425
|
marginTop: "2px"
|
|
413
426
|
}
|
|
414
427
|
}));
|
|
415
|
-
if ((data === null || data === void 0 ? void 0 : data.Ratio) > 1 && (
|
|
428
|
+
if ((data === null || data === void 0 ? void 0 : data.Ratio) > 1 && (_widget$current5 = widget.current) !== null && _widget$current5 !== void 0 && _widget$current5.Increase && ((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.Increase) == "Positive") return React__default.createElement("div", {
|
|
416
429
|
className: "dl-kpi-arrow-container"
|
|
417
430
|
}, React__default.createElement("span", {
|
|
418
431
|
className: "dl-kpi-arrow-pic dl-kpi-arrow-up-green"
|
|
419
432
|
}));
|
|
420
|
-
if ((data === null || data === void 0 ? void 0 : data.Ratio) > 1 && (
|
|
433
|
+
if ((data === null || data === void 0 ? void 0 : data.Ratio) > 1 && (_widget$current7 = widget.current) !== null && _widget$current7 !== void 0 && _widget$current7.Increase && ((_widget$current8 = widget.current) === null || _widget$current8 === void 0 ? void 0 : _widget$current8.Increase) == "Negative") return React__default.createElement("div", {
|
|
421
434
|
className: "dl-kpi-arrow-container"
|
|
422
435
|
}, React__default.createElement("span", {
|
|
423
436
|
className: "dl-kpi-arrow-pic dl-kpi-arrow-up-red"
|
|
424
437
|
}));
|
|
425
|
-
if ((data === null || data === void 0 ? void 0 : data.Ratio) < 1 && (
|
|
438
|
+
if ((data === null || data === void 0 ? void 0 : data.Ratio) < 1 && (_widget$current9 = widget.current) !== null && _widget$current9 !== void 0 && _widget$current9.Increase && ((_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.Increase) == "Positive") return React__default.createElement("div", {
|
|
426
439
|
className: "dl-kpi-arrow-container"
|
|
427
440
|
}, React__default.createElement("span", {
|
|
428
441
|
className: "dl-kpi-arrow-pic dl-kpi-arrow-down-red"
|
|
429
442
|
}));
|
|
430
|
-
if ((data === null || data === void 0 ? void 0 : data.Ratio) < 1 && (
|
|
443
|
+
if ((data === null || data === void 0 ? void 0 : data.Ratio) < 1 && (_widget$current11 = widget.current) !== null && _widget$current11 !== void 0 && _widget$current11.Increase && ((_widget$current12 = widget.current) === null || _widget$current12 === void 0 ? void 0 : _widget$current12.Increase) == "Negative") return React__default.createElement("div", {
|
|
431
444
|
className: "dl-kpi-arrow-container"
|
|
432
445
|
}, React__default.createElement("span", {
|
|
433
446
|
className: "dl-kpi-arrow-pic dl-kpi-arrow-down-green"
|
|
@@ -478,22 +491,22 @@ var KpiChart = function KpiChart(props) {
|
|
|
478
491
|
}
|
|
479
492
|
|
|
480
493
|
var getIsKPIHasSmallestHeight = function getIsKPIHasSmallestHeight() {
|
|
481
|
-
var _props$
|
|
494
|
+
var _props$customChartPro2, _props$customChartPro3;
|
|
482
495
|
|
|
483
|
-
return props.customChartProps.widgetRef && ((_props$
|
|
496
|
+
return props.customChartProps.widgetRef && ((_props$customChartPro2 = props.customChartProps.widgetRef) === null || _props$customChartPro2 === void 0 ? void 0 : _props$customChartPro2.Layout) && ((_props$customChartPro3 = props.customChartProps.widgetRef.Layout) === null || _props$customChartPro3 === void 0 ? void 0 : _props$customChartPro3.h) == 2;
|
|
484
497
|
};
|
|
485
498
|
|
|
486
499
|
var isKPICustomResizeNeeded = function isKPICustomResizeNeeded() {
|
|
487
|
-
var _widget$
|
|
500
|
+
var _widget$current13, _widget$current14, _widget$current15, _widget$current16;
|
|
488
501
|
|
|
489
502
|
if (!widget || !widget.current) return;
|
|
490
|
-
var isThereTitle = !isNullOrUndefined((_widget$
|
|
491
|
-
var isThereSubTitle = !isNullOrUndefined((_widget$
|
|
503
|
+
var isThereTitle = !isNullOrUndefined((_widget$current13 = widget.current) === null || _widget$current13 === void 0 ? void 0 : _widget$current13.Title) && ((_widget$current14 = widget.current) === null || _widget$current14 === void 0 ? void 0 : _widget$current14.Title.length) > 0;
|
|
504
|
+
var isThereSubTitle = !isNullOrUndefined((_widget$current15 = widget.current) === null || _widget$current15 === void 0 ? void 0 : _widget$current15.Subtitle) && ((_widget$current16 = widget.current) === null || _widget$current16 === void 0 ? void 0 : _widget$current16.Subtitle.length) > 0;
|
|
492
505
|
var isKPIHasSmallestHeight = getIsKPIHasSmallestHeight();
|
|
493
506
|
return isThereTitle && isThereSubTitle && isKPIHasSmallestHeight;
|
|
494
507
|
};
|
|
495
508
|
|
|
496
|
-
return !
|
|
509
|
+
return isLoading || !widget.current ? React__default.createElement("div", {
|
|
497
510
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
498
511
|
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
499
512
|
style: {
|
|
@@ -502,9 +515,10 @@ var KpiChart = function KpiChart(props) {
|
|
|
502
515
|
},
|
|
503
516
|
strokeWidth: "4",
|
|
504
517
|
animationDuration: "2s"
|
|
505
|
-
})) : !error ? React__default.createElement("div", {
|
|
518
|
+
})) : !error && widget.current ? React__default.createElement("div", {
|
|
519
|
+
key: triggerId,
|
|
506
520
|
onClick: kpiClick,
|
|
507
|
-
className: ((_widget$
|
|
521
|
+
className: ((_widget$current17 = widget.current) === null || _widget$current17 === void 0 ? void 0 : _widget$current17.Alighnment) == "Left" ? "dl-kpi-container-click db-justify-content-flex-start" : "dl-kpi-container-click"
|
|
508
522
|
}, React__default.createElement("div", {
|
|
509
523
|
className: isKPICustomSizeNeeded ? "dl-kpi-container kpi-custom-size" : "dl-kpi-container"
|
|
510
524
|
}, getLabel(), getValueComponent(), getPreviousValueComponent())) : React__default.createElement("div", {
|
|
@@ -1014,7 +1028,7 @@ function getBarObject(seriesMeasures, widget) {
|
|
|
1014
1028
|
chartInfo.scrollPosition = "right";
|
|
1015
1029
|
chartInfo.scrollPadding = "8";
|
|
1016
1030
|
chartInfo.flatScrollBars = "1";
|
|
1017
|
-
chartInfo.showPercentValues = "1";
|
|
1031
|
+
chartInfo.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1018
1032
|
chartInfo.showLegend = widget.ShowLegend ? '1' : '0';
|
|
1019
1033
|
setLineDash(chartInfo);
|
|
1020
1034
|
chartInfo.chartTopMargin = "10";
|
|
@@ -1037,7 +1051,7 @@ function getStackedBarObject(seriesMeasures, widget) {
|
|
|
1037
1051
|
chartInfo.scrollPosition = "right";
|
|
1038
1052
|
chartInfo.scrollPadding = "8";
|
|
1039
1053
|
chartInfo.flatScrollBars = "1";
|
|
1040
|
-
chartInfo.showPercentValues = "1";
|
|
1054
|
+
chartInfo.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1041
1055
|
chartInfo.showLegend = widget.ShowLegend ? '1' : '0';
|
|
1042
1056
|
setLineDash(chartInfo);
|
|
1043
1057
|
chartInfo.chartTopMargin = "10";
|
|
@@ -1060,7 +1074,7 @@ function getClusteredColumnObject(seriesMeasures, widget) {
|
|
|
1060
1074
|
chartInfo.scrollPosition = "top";
|
|
1061
1075
|
chartInfo.scrollPadding = "8";
|
|
1062
1076
|
chartInfo.flatScrollBars = "1";
|
|
1063
|
-
chartInfo.showPercentValues = "1";
|
|
1077
|
+
chartInfo.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1064
1078
|
chartInfo.showLegend = widget.ShowLegend ? '1' : '0';
|
|
1065
1079
|
setLineDash(chartInfo);
|
|
1066
1080
|
chartInfo.chartTopMargin = "10";
|
|
@@ -1077,7 +1091,7 @@ function getClusteredLineObject(seriesMeasures, widget) {
|
|
|
1077
1091
|
chartInfo.scrollPosition = "top";
|
|
1078
1092
|
chartInfo.scrollPadding = "8";
|
|
1079
1093
|
chartInfo.flatScrollBars = "1";
|
|
1080
|
-
chartInfo.showPercentValues = "1";
|
|
1094
|
+
chartInfo.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1081
1095
|
chartInfo.showLegend = widget.ShowLegend ? '1' : '0';
|
|
1082
1096
|
setLineDash(chartInfo);
|
|
1083
1097
|
chartInfo.chartTopMargin = "10";
|
|
@@ -1094,7 +1108,7 @@ function getLineObject(seriesMeasures, widget) {
|
|
|
1094
1108
|
chartInfo.scrollPosition = "top";
|
|
1095
1109
|
chartInfo.scrollPadding = "8";
|
|
1096
1110
|
chartInfo.flatScrollBars = "1";
|
|
1097
|
-
chartInfo.showPercentValues = "1";
|
|
1111
|
+
chartInfo.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1098
1112
|
chartInfo.showLegend = widget.ShowLegend ? '1' : '0';
|
|
1099
1113
|
setLineDash(chartInfo);
|
|
1100
1114
|
chartInfo.chartTopMargin = "20";
|
|
@@ -1149,7 +1163,7 @@ function getColumnObject(seriesMeasures, widget) {
|
|
|
1149
1163
|
var chartInfo = getDefaultChartInfo(widget);
|
|
1150
1164
|
chartInfo.scrollPadding = "8";
|
|
1151
1165
|
chartInfo.flatScrollBars = "1";
|
|
1152
|
-
chartInfo.showPercentValues = "1";
|
|
1166
|
+
chartInfo.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1153
1167
|
chartInfo.showLegend = widget.ShowLegend ? '1' : '0';
|
|
1154
1168
|
chartInfo.scrollPosition = "top";
|
|
1155
1169
|
setLineDash(chartInfo);
|
|
@@ -1274,13 +1288,14 @@ function setOnChartLegend(chart, widget) {
|
|
|
1274
1288
|
chart.scrollShowButtons = "0";
|
|
1275
1289
|
chart.legendCaptionAlignment = "right";
|
|
1276
1290
|
chart.alignLegendWithCanvas = "1";
|
|
1277
|
-
chart.showPercentValues = "0";
|
|
1291
|
+
chart.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1278
1292
|
chart.chartRightMargin = "20";
|
|
1279
1293
|
}
|
|
1280
1294
|
|
|
1281
1295
|
function setChartInLegend(chart, widget) {
|
|
1282
1296
|
if (widget.LabelsPosition == 'InLegend') return;
|
|
1283
1297
|
chart.pieRadius = "70%";
|
|
1298
|
+
chart.showPercentValues = widget.ShowValueAsNumber ? "0" : "1";
|
|
1284
1299
|
}
|
|
1285
1300
|
|
|
1286
1301
|
function setDualyAxis(chartInfo, widget, seriesMeasures) {
|
|
@@ -1383,25 +1398,43 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1383
1398
|
error = _useState2[0],
|
|
1384
1399
|
setError = _useState2[1];
|
|
1385
1400
|
|
|
1401
|
+
var _useState3 = React.useState(uuid.v4()),
|
|
1402
|
+
fusionKey = _useState3[0];
|
|
1403
|
+
|
|
1404
|
+
var chartData = React.useRef(null);
|
|
1386
1405
|
var widget = React.useRef();
|
|
1387
1406
|
|
|
1388
|
-
var
|
|
1389
|
-
args =
|
|
1390
|
-
setArgs =
|
|
1407
|
+
var _useState4 = React.useState({}),
|
|
1408
|
+
args = _useState4[0],
|
|
1409
|
+
setArgs = _useState4[1];
|
|
1391
1410
|
|
|
1392
|
-
var
|
|
1393
|
-
fChart =
|
|
1394
|
-
setFchart =
|
|
1411
|
+
var _useState5 = React.useState(),
|
|
1412
|
+
fChart = _useState5[0],
|
|
1413
|
+
setFchart = _useState5[1];
|
|
1395
1414
|
|
|
1396
1415
|
var id = (Math.random() + 1).toString(36).substring(7);
|
|
1397
1416
|
var progressRef = React.useRef(null);
|
|
1398
1417
|
var fusionRef = React.useRef(null);
|
|
1399
1418
|
var fusionChartHelper = React.useRef();
|
|
1400
1419
|
React.useEffect(function () {
|
|
1420
|
+
var _props$dataBinding;
|
|
1421
|
+
|
|
1401
1422
|
widget.current = props.widget;
|
|
1402
1423
|
setTimeout(function () {
|
|
1403
1424
|
RefreshData();
|
|
1404
1425
|
}, 500);
|
|
1426
|
+
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.widgetUpdated.subscribe(function (updatedWidget) {
|
|
1427
|
+
var _widget$current;
|
|
1428
|
+
|
|
1429
|
+
if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) return;
|
|
1430
|
+
widget.current = _extends({}, updatedWidget);
|
|
1431
|
+
|
|
1432
|
+
if (chartData && chartData.current) {
|
|
1433
|
+
var _data = JSON.parse(JSON.stringify(chartData.current));
|
|
1434
|
+
|
|
1435
|
+
handleData(_data, true);
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1405
1438
|
}, []);
|
|
1406
1439
|
React.useEffect(function () {
|
|
1407
1440
|
var timeout;
|
|
@@ -1427,17 +1460,17 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1427
1460
|
});
|
|
1428
1461
|
|
|
1429
1462
|
var HandleSizeChange = function HandleSizeChange() {
|
|
1430
|
-
var _widget$
|
|
1463
|
+
var _widget$current2, _widget$current3;
|
|
1431
1464
|
|
|
1432
|
-
if (!widget || ((_widget$
|
|
1465
|
+
if (!widget || ((_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : _widget$current2.TypeCode) != "pie" && ((_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.TypeCode) != "donut") return;
|
|
1433
1466
|
setTimeout(function () {
|
|
1434
|
-
var _fusionChartHelper$cu, _fusionChartHelper$cu2, _fusionChartHelper$cu3, _fusionRef$current, _fusionRef$current2, _widget$
|
|
1467
|
+
var _fusionChartHelper$cu, _fusionChartHelper$cu2, _fusionChartHelper$cu3, _fusionRef$current, _fusionRef$current2, _widget$current4, _fusionChartHelper$cu4, _widget$current5, _fusionChartHelper$cu5;
|
|
1435
1468
|
|
|
1436
1469
|
var oldPieRadius = fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : (_fusionChartHelper$cu = fusionChartHelper.current) === null || _fusionChartHelper$cu === void 0 ? void 0 : _fusionChartHelper$cu.getPieRadius();
|
|
1437
1470
|
var oldLegendWidth = fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : (_fusionChartHelper$cu2 = fusionChartHelper.current) === null || _fusionChartHelper$cu2 === void 0 ? void 0 : _fusionChartHelper$cu2.getLegendWidth();
|
|
1438
1471
|
fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : (_fusionChartHelper$cu3 = fusionChartHelper.current) === null || _fusionChartHelper$cu3 === void 0 ? void 0 : _fusionChartHelper$cu3.trimChartLabels(fusionRef === null || fusionRef === void 0 ? void 0 : (_fusionRef$current = fusionRef.current) === null || _fusionRef$current === void 0 ? void 0 : _fusionRef$current.offsetWidth, fusionRef === null || fusionRef === void 0 ? void 0 : (_fusionRef$current2 = fusionRef.current) === null || _fusionRef$current2 === void 0 ? void 0 : _fusionRef$current2.offsetHeight);
|
|
1439
|
-
if (((_widget$
|
|
1440
|
-
if (((_widget$
|
|
1472
|
+
if (((_widget$current4 = widget.current) === null || _widget$current4 === void 0 ? void 0 : _widget$current4.LabelsPosition) != 'InLegend' && oldPieRadius == (fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : (_fusionChartHelper$cu4 = fusionChartHelper.current) === null || _fusionChartHelper$cu4 === void 0 ? void 0 : _fusionChartHelper$cu4.getPieRadius())) return;
|
|
1473
|
+
if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.LabelsPosition) == 'InLegend' && oldLegendWidth == (fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : (_fusionChartHelper$cu5 = fusionChartHelper.current) === null || _fusionChartHelper$cu5 === void 0 ? void 0 : _fusionChartHelper$cu5.getLegendWidth())) return;
|
|
1441
1474
|
setDataLoaded(false);
|
|
1442
1475
|
setTimeout(function () {
|
|
1443
1476
|
setDataLoaded(true);
|
|
@@ -1458,6 +1491,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1458
1491
|
postWidget.onChange = undefined;
|
|
1459
1492
|
dashboardAnalyticsService.getData(postWidget).then(function (result) {
|
|
1460
1493
|
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
1494
|
+
chartData.current = result === null || result === void 0 ? void 0 : result.data;
|
|
1461
1495
|
}, function (error) {
|
|
1462
1496
|
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
1463
1497
|
|
|
@@ -1467,14 +1501,21 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1467
1501
|
});
|
|
1468
1502
|
};
|
|
1469
1503
|
|
|
1470
|
-
var handleData = function handleData(data) {
|
|
1504
|
+
var handleData = function handleData(data, isDummyChange) {
|
|
1471
1505
|
var _progressRef$current, _progressRef$current2;
|
|
1472
1506
|
|
|
1507
|
+
if (isDummyChange === void 0) {
|
|
1508
|
+
isDummyChange = false;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1473
1511
|
var chart = BuildFusionChartObject(data, widget.current);
|
|
1474
1512
|
fusionChartHelper.current = new FusionChartHelper(widget.current, chart);
|
|
1475
1513
|
fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : fusionChartHelper.current.trimChartLabels(progressRef === null || progressRef === void 0 ? void 0 : (_progressRef$current = progressRef.current) === null || _progressRef$current === void 0 ? void 0 : _progressRef$current.offsetWidth, progressRef === null || progressRef === void 0 ? void 0 : (_progressRef$current2 = progressRef.current) === null || _progressRef$current2 === void 0 ? void 0 : _progressRef$current2.offsetHeight);
|
|
1476
1514
|
setArgs(chart);
|
|
1477
|
-
|
|
1515
|
+
|
|
1516
|
+
if (!isDummyChange) {
|
|
1517
|
+
setDataLoaded(true);
|
|
1518
|
+
}
|
|
1478
1519
|
};
|
|
1479
1520
|
|
|
1480
1521
|
var dataplotClick = function dataplotClick(eventObj, dataObj) {
|
|
@@ -1516,7 +1557,8 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1516
1557
|
})) : !error ? React__default.createElement("div", {
|
|
1517
1558
|
className: 'db-fc-parent-container',
|
|
1518
1559
|
ref: fusionRef
|
|
1519
|
-
},
|
|
1560
|
+
}, React__default.createElement("div", {
|
|
1561
|
+
key: fusionKey,
|
|
1520
1562
|
className: 'db-fc-container',
|
|
1521
1563
|
ref: ref,
|
|
1522
1564
|
id: id
|
|
@@ -1524,7 +1566,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1524
1566
|
"fcEvent-dataplotClick": dataplotClick,
|
|
1525
1567
|
onRender: renderComplete,
|
|
1526
1568
|
"fcEvent-drawComplete": drawComplete
|
|
1527
|
-
})))
|
|
1569
|
+
})))) : React__default.createElement("div", {
|
|
1528
1570
|
className: "dl-flex-content-center dl-full-hight",
|
|
1529
1571
|
style: {
|
|
1530
1572
|
width: '100%'
|
|
@@ -1629,7 +1671,7 @@ function SvgCopyIcon(props) {
|
|
|
1629
1671
|
}
|
|
1630
1672
|
|
|
1631
1673
|
var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
1632
|
-
var _widget$
|
|
1674
|
+
var _widget$current7, _widget$current8, _widget$current9, _widget$current10, _widget$current11, _widget$current12, _widget$current13;
|
|
1633
1675
|
|
|
1634
1676
|
var widget = React.useRef();
|
|
1635
1677
|
|
|
@@ -1643,6 +1685,10 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1643
1685
|
|
|
1644
1686
|
var fusionChartRef = React.useRef(null);
|
|
1645
1687
|
|
|
1688
|
+
var _useState3 = React.useState(uuid.v4()),
|
|
1689
|
+
triggerId = _useState3[0],
|
|
1690
|
+
setTriggerId = _useState3[1];
|
|
1691
|
+
|
|
1646
1692
|
var editWidget = function editWidget() {
|
|
1647
1693
|
props.editBtnClicked(widget.current);
|
|
1648
1694
|
};
|
|
@@ -1656,7 +1702,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1656
1702
|
};
|
|
1657
1703
|
|
|
1658
1704
|
React.useEffect(function () {
|
|
1659
|
-
var _props$dataBinding;
|
|
1705
|
+
var _props$dataBinding, _props$dataBinding2;
|
|
1660
1706
|
|
|
1661
1707
|
widget.current = props.widget;
|
|
1662
1708
|
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.onEditWidget.subscribe(function (e) {
|
|
@@ -1667,6 +1713,13 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1667
1713
|
widget.current = _extends({}, e);
|
|
1668
1714
|
setIsLoading(false);
|
|
1669
1715
|
});
|
|
1716
|
+
(_props$dataBinding2 = props.dataBinding) === null || _props$dataBinding2 === void 0 ? void 0 : _props$dataBinding2.widgetUpdated.subscribe(function (updatedWidget) {
|
|
1717
|
+
var _widget$current3;
|
|
1718
|
+
|
|
1719
|
+
if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.key)) return;
|
|
1720
|
+
widget.current = _extends({}, updatedWidget);
|
|
1721
|
+
setTriggerId(uuid.v4());
|
|
1722
|
+
});
|
|
1670
1723
|
}, []);
|
|
1671
1724
|
React.useImperativeHandle(comRef, function () {
|
|
1672
1725
|
return {
|
|
@@ -1691,10 +1744,10 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1691
1744
|
};
|
|
1692
1745
|
|
|
1693
1746
|
var GetChartComponent = function GetChartComponent() {
|
|
1694
|
-
var _widget$
|
|
1747
|
+
var _widget$current4, _widget$current5, _widget$current6;
|
|
1695
1748
|
|
|
1696
|
-
if (isLoading || !((_widget$
|
|
1697
|
-
if (((_widget$
|
|
1749
|
+
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
|
|
1750
|
+
if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi" || ((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "table") return React__default.createElement(CustomChart, {
|
|
1698
1751
|
isPreviewModeActive: props.isPreviewModeActive,
|
|
1699
1752
|
dataBinding: props.dataBinding,
|
|
1700
1753
|
widget: widget.current,
|
|
@@ -1720,6 +1773,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1720
1773
|
setIsWidgetHovered(false);
|
|
1721
1774
|
}
|
|
1722
1775
|
}, React__default.createElement("header", {
|
|
1776
|
+
key: triggerId,
|
|
1723
1777
|
className: "widget-header"
|
|
1724
1778
|
}, React__default.createElement("div", {
|
|
1725
1779
|
className: "header-contents"
|
|
@@ -1742,7 +1796,7 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1742
1796
|
color: getCSSPropertyValue(widget.current, 'TitleFontColor', ''),
|
|
1743
1797
|
textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined)
|
|
1744
1798
|
}
|
|
1745
|
-
}, (_widget$
|
|
1799
|
+
}, (_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.Title),
|
|
1746
1800
|
position: ['top center'],
|
|
1747
1801
|
arrowStyle: {
|
|
1748
1802
|
color: '#262626'
|
|
@@ -1751,15 +1805,15 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
|
|
|
1751
1805
|
on: ['hover', 'focus']
|
|
1752
1806
|
}, React__default.createElement("span", {
|
|
1753
1807
|
className: "widget-title-tooltip-text"
|
|
1754
|
-
}, (_widget$
|
|
1755
|
-
className: (_widget$
|
|
1808
|
+
}, (_widget$current8 = widget.current) === null || _widget$current8 === void 0 ? void 0 : _widget$current8.Title))), React__default.createElement("div", {
|
|
1809
|
+
className: (_widget$current9 = widget.current) !== null && _widget$current9 !== void 0 && _widget$current9.Subtitle && ((_widget$current10 = widget.current) === null || _widget$current10 === void 0 ? void 0 : _widget$current10.Subtitle.length) > 0 ? "subtitle" : "subtitle margin-top-4",
|
|
1756
1810
|
style: {
|
|
1757
1811
|
fontSize: getCSSPropertyValue(widget.current, 'SubtitleFontSize', 'px'),
|
|
1758
1812
|
textAlign: getCSSPropertyValue(widget === null || widget === void 0 ? void 0 : widget.current, 'TitleAlignment', '', undefined),
|
|
1759
1813
|
color: getCSSPropertyValue(widget.current, 'SubtitleFontColor', '')
|
|
1760
1814
|
}
|
|
1761
|
-
}, (_widget$
|
|
1762
|
-
className: (_widget$
|
|
1815
|
+
}, (_widget$current11 = widget.current) === null || _widget$current11 === void 0 ? void 0 : _widget$current11.Subtitle)), React__default.createElement("div", {
|
|
1816
|
+
className: (_widget$current12 = widget.current) !== null && _widget$current12 !== void 0 && _widget$current12.Title && ((_widget$current13 = widget.current) === null || _widget$current13 === void 0 ? void 0 : _widget$current13.Title.length) > 0 ? "widget-options-container" : "widget-options-container margin-top-6"
|
|
1763
1817
|
}, props.isInEditMode && isWidgetHovered ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SvgEditIcon, {
|
|
1764
1818
|
onClick: function onClick() {
|
|
1765
1819
|
return editWidget();
|
|
@@ -2055,7 +2109,7 @@ var Dashboard = function Dashboard(props) {
|
|
|
2055
2109
|
|
|
2056
2110
|
var _useState4 = React.useState(props.widgetData),
|
|
2057
2111
|
previewWidget = _useState4[0],
|
|
2058
|
-
|
|
2112
|
+
setPreviewWidget = _useState4[1];
|
|
2059
2113
|
|
|
2060
2114
|
React.useEffect(function () {
|
|
2061
2115
|
Session.CurrentUserId = props.userId;
|
|
@@ -2076,7 +2130,7 @@ var Dashboard = function Dashboard(props) {
|
|
|
2076
2130
|
}, []);
|
|
2077
2131
|
React.useEffect(function () {
|
|
2078
2132
|
if (props.widgetData) {
|
|
2079
|
-
|
|
2133
|
+
setPreviewWidget(JSON.parse(JSON.stringify(props.widgetData)));
|
|
2080
2134
|
}
|
|
2081
2135
|
}, [props.widgetData]);
|
|
2082
2136
|
|