logitude-dashboard-library 1.4.4 → 1.4.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/features/Dashboard/ChartsComponents/ApexChart.d.ts +0 -1
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/CustomChart.d.ts +0 -1
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/KpiChart.d.ts +0 -1
- package/dist/features/Dashboard/ChartsComponents/FusionChart.d.ts +0 -1
- package/dist/features/Dashboard/ChartsComponents/FusionChartObjectBuilder.d.ts +2 -2
- package/dist/features/Dashboard/ChartsComponents/FusionChartTest.d.ts +0 -1
- package/dist/features/Dashboard/DashboardDesigner.d.ts +0 -1
- package/dist/features/Dashboard/WidgetCard.d.ts +0 -1
- package/dist/features/Dashboard/dashboard-dialog/dashboard-dialog-component.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +45 -71
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +45 -71
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +141 -25
- package/dist/styles/fonts.scss +0 -4
- package/package.json +1 -1
- package/dist/features/Dashboard/ChartsComponents/CustomChart.d.ts +0 -11
- package/dist/features/Dashboard/ChartsComponents/FusionCharts.d.ts +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ChartObject } from "fusioncharts";
|
|
2
2
|
import { SeriesMeasure } from "../../../types/SeriesMeasure";
|
|
3
|
-
import {
|
|
4
|
-
export declare function BuildFusionChartObject(seriesMeasures: SeriesMeasure[],
|
|
3
|
+
import { ReactWidgetPM } from "../../../types/widget";
|
|
4
|
+
export declare function BuildFusionChartObject(seriesMeasures: SeriesMeasure[], widget: ReactWidgetPM): ChartObject;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -202,7 +202,7 @@ var DashboardAnalyticsService = /*#__PURE__*/function () {
|
|
|
202
202
|
}();
|
|
203
203
|
|
|
204
204
|
var KpiChart = function KpiChart(props) {
|
|
205
|
-
var _widget$
|
|
205
|
+
var _widget$current7;
|
|
206
206
|
|
|
207
207
|
var _useState = React.useState(false),
|
|
208
208
|
dataLoaded = _useState[0],
|
|
@@ -233,28 +233,12 @@ var KpiChart = function KpiChart(props) {
|
|
|
233
233
|
var prev = "";
|
|
234
234
|
React.useEffect(function () {
|
|
235
235
|
widget.current = props.customChartProps.widget;
|
|
236
|
-
|
|
236
|
+
setDataLoaded(false);
|
|
237
237
|
setTimeout(function () {
|
|
238
238
|
RefreshData();
|
|
239
239
|
}, 500);
|
|
240
240
|
}, []);
|
|
241
241
|
|
|
242
|
-
var onRefresh = function onRefresh() {
|
|
243
|
-
var _props$customChartPro;
|
|
244
|
-
|
|
245
|
-
(_props$customChartPro = props.customChartProps.dataBinding) === null || _props$customChartPro === void 0 ? void 0 : _props$customChartPro.onEditWidget.subscribe(function (e) {
|
|
246
|
-
var _widget$current;
|
|
247
|
-
|
|
248
|
-
if (e.key == ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) {
|
|
249
|
-
setDataLoaded(false);
|
|
250
|
-
widget.current = e;
|
|
251
|
-
setTimeout(function () {
|
|
252
|
-
RefreshData();
|
|
253
|
-
}, 500);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
|
|
258
242
|
var RefreshData = function RefreshData() {
|
|
259
243
|
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
260
244
|
|
|
@@ -277,10 +261,10 @@ var KpiChart = function KpiChart(props) {
|
|
|
277
261
|
};
|
|
278
262
|
|
|
279
263
|
var kpiClick = function kpiClick() {
|
|
280
|
-
var _widget$
|
|
264
|
+
var _widget$current, _widget$current2, _widget$current2$Widg;
|
|
281
265
|
|
|
282
266
|
var measureFieldId;
|
|
283
|
-
if (widget !== null && widget !== void 0 && (_widget$
|
|
267
|
+
if (widget !== null && widget !== void 0 && (_widget$current = widget.current) !== null && _widget$current !== void 0 && _widget$current.WidgetMeasures) measureFieldId = widget === null || widget === void 0 ? void 0 : (_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : (_widget$current2$Widg = _widget$current2.WidgetMeasures[0]) === null || _widget$current2$Widg === void 0 ? void 0 : _widget$current2$Widg.MeasureFieldId;
|
|
284
268
|
props.customChartProps.onSelectDataPoint({
|
|
285
269
|
MeasureFieldId: measureFieldId,
|
|
286
270
|
Widget: widget.current
|
|
@@ -288,9 +272,9 @@ var KpiChart = function KpiChart(props) {
|
|
|
288
272
|
};
|
|
289
273
|
|
|
290
274
|
var setTimeOverTimeImage = function setTimeOverTimeImage(data) {
|
|
291
|
-
var _widget$
|
|
275
|
+
var _widget$current3;
|
|
292
276
|
|
|
293
|
-
if (!(widget !== null && widget !== void 0 && (_widget$
|
|
277
|
+
if (!(widget !== null && widget !== void 0 && (_widget$current3 = widget.current) !== null && _widget$current3 !== void 0 && _widget$current3.TimeOverTime)) return;
|
|
294
278
|
var ratio = data === null || data === void 0 ? void 0 : data.Ratio;
|
|
295
279
|
if (!ratio) return;
|
|
296
280
|
if (ratio >= 1) setArrowColorDirection(React__default.createElement("span", {
|
|
@@ -301,19 +285,19 @@ var KpiChart = function KpiChart(props) {
|
|
|
301
285
|
};
|
|
302
286
|
|
|
303
287
|
var checkValues = function checkValues(data) {
|
|
304
|
-
var _widget$
|
|
288
|
+
var _widget$current4, _widget$current5;
|
|
305
289
|
|
|
306
290
|
setCheckValuesValidity(false);
|
|
307
|
-
if (!(widget !== null && widget !== void 0 && (_widget$
|
|
308
|
-
if (widget !== null && widget !== void 0 && (_widget$
|
|
291
|
+
if (!(widget !== null && widget !== void 0 && (_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TimeOverTime)) return;
|
|
292
|
+
if (widget !== null && widget !== void 0 && (_widget$current5 = widget.current) !== null && _widget$current5 !== void 0 && _widget$current5.TimeOverTime && (data === null || data === void 0 ? void 0 : data.ComparisonValue) == 0 && (data === null || data === void 0 ? void 0 : data.Value) === 0) return;
|
|
309
293
|
setCheckValuesValidity(true);
|
|
310
294
|
};
|
|
311
295
|
|
|
312
296
|
var checkUnitVisible = function checkUnitVisible(data) {
|
|
313
|
-
var _widget$
|
|
297
|
+
var _widget$current6;
|
|
314
298
|
|
|
315
299
|
setVisibilityUnit(false);
|
|
316
|
-
if (!(widget !== null && widget !== void 0 && (_widget$
|
|
300
|
+
if (!(widget !== null && widget !== void 0 && (_widget$current6 = widget.current) !== null && _widget$current6 !== void 0 && _widget$current6.TimeOverTime) || (data === null || data === void 0 ? void 0 : data.ComparisonValue) == 0) return;
|
|
317
301
|
setVisibilityUnit(true);
|
|
318
302
|
};
|
|
319
303
|
|
|
@@ -337,7 +321,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
337
321
|
className: "dl-kpi-same-line"
|
|
338
322
|
}, React__default.createElement("div", {
|
|
339
323
|
className: "dl-kpi-margin"
|
|
340
|
-
}, arrowColorDirection), React__default.createElement("div", null, data === null || data === void 0 ? void 0 : data.Ratio)) : null, widget !== null && widget !== void 0 && (_widget$
|
|
324
|
+
}, arrowColorDirection), React__default.createElement("div", null, data === null || data === void 0 ? void 0 : data.Ratio)) : null, widget !== null && widget !== void 0 && (_widget$current7 = widget.current) !== null && _widget$current7 !== void 0 && _widget$current7.TimeOverTime ? React__default.createElement("div", {
|
|
341
325
|
className: "dl-kpi-same-line"
|
|
342
326
|
}, React__default.createElement("div", {
|
|
343
327
|
className: "dl-kpi-margin"
|
|
@@ -377,13 +361,11 @@ var CustomChart = function CustomChart(props) {
|
|
|
377
361
|
}, project());
|
|
378
362
|
};
|
|
379
363
|
|
|
380
|
-
function BuildFusionChartObject(seriesMeasures,
|
|
381
|
-
var _props$widget;
|
|
382
|
-
|
|
364
|
+
function BuildFusionChartObject(seriesMeasures, widget) {
|
|
383
365
|
handelNullLabels(seriesMeasures);
|
|
384
|
-
var defaultChart = getDefaultChartobject(seriesMeasures,
|
|
366
|
+
var defaultChart = getDefaultChartobject(seriesMeasures, widget);
|
|
385
367
|
|
|
386
|
-
switch (
|
|
368
|
+
switch (widget === null || widget === void 0 ? void 0 : widget.TypeCode) {
|
|
387
369
|
case 'bar':
|
|
388
370
|
return getBarObject(seriesMeasures, defaultChart);
|
|
389
371
|
|
|
@@ -429,19 +411,17 @@ function getPieObject(seriesMeasures, chart) {
|
|
|
429
411
|
return chart;
|
|
430
412
|
}
|
|
431
413
|
|
|
432
|
-
function getDefaultChartobject(seriesMeasures,
|
|
414
|
+
function getDefaultChartobject(seriesMeasures, widget) {
|
|
433
415
|
var chart = {};
|
|
434
416
|
chart.type = "column2d";
|
|
435
417
|
chart.width = "100%";
|
|
436
418
|
chart.height = "100%";
|
|
437
419
|
chart.dataFormat = "json";
|
|
438
|
-
buildChartDataSource(chart,
|
|
420
|
+
buildChartDataSource(chart, widget, seriesMeasures);
|
|
439
421
|
return chart;
|
|
440
422
|
}
|
|
441
423
|
|
|
442
|
-
function buildChartDataSource(chart,
|
|
443
|
-
var _props$widget2, _props$widget3, _props$widget4, _props$widget5, _props$widget6, _props$widget7, _props$widget8, _props$widget9;
|
|
444
|
-
|
|
424
|
+
function buildChartDataSource(chart, widget, seriesMeasures) {
|
|
445
425
|
if (!seriesMeasures || !seriesMeasures[0]) return;
|
|
446
426
|
var chartinfo = {
|
|
447
427
|
theme: "fusion",
|
|
@@ -454,12 +434,12 @@ function buildChartDataSource(chart, props, seriesMeasures) {
|
|
|
454
434
|
chartTopMargin: "20",
|
|
455
435
|
chartRightMargin: "20",
|
|
456
436
|
chartBottomMargin: "20",
|
|
457
|
-
showPercentValues: (
|
|
458
|
-
showValues: (
|
|
459
|
-
showLegend: ((
|
|
437
|
+
showPercentValues: (widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "donut" || (widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "pie" ? "0" : "1",
|
|
438
|
+
showValues: (widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "donut" || (widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "pie" ? "0" : "1",
|
|
439
|
+
showLegend: ((widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "bar" || (widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "line") && (seriesMeasures === null || seriesMeasures === void 0 ? void 0 : seriesMeasures.length) > 1 ? "1" : "0"
|
|
460
440
|
};
|
|
461
441
|
|
|
462
|
-
if ((
|
|
442
|
+
if ((widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "bar" || (widget === null || widget === void 0 ? void 0 : widget.TypeCode) == "line") {
|
|
463
443
|
chart.dataSource = {
|
|
464
444
|
chart: chartinfo,
|
|
465
445
|
categories: buildCategories(seriesMeasures),
|
|
@@ -566,27 +546,11 @@ var FusionChart = function FusionChart(props) {
|
|
|
566
546
|
|
|
567
547
|
React.useEffect(function () {
|
|
568
548
|
widget.current = props.widget;
|
|
569
|
-
onRefresh();
|
|
570
549
|
setTimeout(function () {
|
|
571
550
|
RefreshData();
|
|
572
551
|
}, 500);
|
|
573
552
|
}, []);
|
|
574
553
|
|
|
575
|
-
var onRefresh = function onRefresh() {
|
|
576
|
-
var _props$dataBinding;
|
|
577
|
-
|
|
578
|
-
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.onEditWidget.subscribe(function (e) {
|
|
579
|
-
var _widget$current;
|
|
580
|
-
|
|
581
|
-
if (e.key != ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) return;
|
|
582
|
-
setDataLoaded(false);
|
|
583
|
-
widget.current = e;
|
|
584
|
-
setTimeout(function () {
|
|
585
|
-
RefreshData();
|
|
586
|
-
}, 500);
|
|
587
|
-
});
|
|
588
|
-
};
|
|
589
|
-
|
|
590
554
|
var RefreshData = function RefreshData() {
|
|
591
555
|
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
592
556
|
|
|
@@ -594,7 +558,7 @@ var FusionChart = function FusionChart(props) {
|
|
|
594
558
|
|
|
595
559
|
postWidget.onChange = undefined;
|
|
596
560
|
dashboardAnalyticsService.getData(postWidget).then(function (result) {
|
|
597
|
-
var chart = BuildFusionChartObject(result.data,
|
|
561
|
+
var chart = BuildFusionChartObject(result.data, widget.current);
|
|
598
562
|
setArgs(chart);
|
|
599
563
|
setDataLoaded(true);
|
|
600
564
|
if (widgetHeight && widgetWidth && fChart) fChart.resizeTo(widgetWidth, widgetHeight);
|
|
@@ -659,25 +623,33 @@ var FusionChart = function FusionChart(props) {
|
|
|
659
623
|
};
|
|
660
624
|
|
|
661
625
|
var WidgetCard = function WidgetCard(props, state) {
|
|
626
|
+
var _widget$current2, _widget$current3;
|
|
627
|
+
|
|
662
628
|
var moreBtnToggle = React.useRef(null);
|
|
629
|
+
var widget = React.useRef();
|
|
663
630
|
|
|
664
|
-
var _useState = React.useState(),
|
|
665
|
-
|
|
666
|
-
|
|
631
|
+
var _useState = React.useState(false),
|
|
632
|
+
isLoading = _useState[0],
|
|
633
|
+
setIsLoading = _useState[1];
|
|
667
634
|
|
|
668
635
|
var editWidget = function editWidget() {
|
|
669
636
|
var _moreBtnToggle$curren;
|
|
670
637
|
|
|
671
638
|
(_moreBtnToggle$curren = moreBtnToggle.current) === null || _moreBtnToggle$curren === void 0 ? void 0 : _moreBtnToggle$curren.hide();
|
|
672
|
-
props.editBtnClicked(widget);
|
|
639
|
+
props.editBtnClicked(widget.current);
|
|
673
640
|
};
|
|
674
641
|
|
|
675
642
|
React.useEffect(function () {
|
|
676
643
|
var _props$dataBinding;
|
|
677
644
|
|
|
678
|
-
|
|
645
|
+
widget.current = props.widget;
|
|
679
646
|
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.onEditWidget.subscribe(function (e) {
|
|
680
|
-
|
|
647
|
+
var _widget$current;
|
|
648
|
+
|
|
649
|
+
if ((e === null || e === void 0 ? void 0 : e.key) != ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) return;
|
|
650
|
+
setIsLoading(true);
|
|
651
|
+
widget.current = _extends({}, e);
|
|
652
|
+
setIsLoading(false);
|
|
681
653
|
});
|
|
682
654
|
}, []);
|
|
683
655
|
return React__default.createElement("div", {
|
|
@@ -689,10 +661,10 @@ var WidgetCard = function WidgetCard(props, state) {
|
|
|
689
661
|
}, React__default.createElement("header", null, React__default.createElement(tooltip.Tooltip, {
|
|
690
662
|
target: ".h-tool-tip"
|
|
691
663
|
}), React__default.createElement("h1", {
|
|
692
|
-
"data-pr-tooltip": widget === null ||
|
|
664
|
+
"data-pr-tooltip": (_widget$current2 = widget.current) === null || _widget$current2 === void 0 ? void 0 : _widget$current2.Title,
|
|
693
665
|
"data-pr-position": "top",
|
|
694
666
|
className: "h-tool-tip"
|
|
695
|
-
}, widget === null ||
|
|
667
|
+
}, (_widget$current3 = widget.current) === null || _widget$current3 === void 0 ? void 0 : _widget$current3.Title), props.isInEditMode ? React__default.createElement(button.Button, {
|
|
696
668
|
icon: "pi pi-ellipsis-v",
|
|
697
669
|
className: "p-button-rounded p-button-text",
|
|
698
670
|
onClick: function onClick(e) {
|
|
@@ -723,16 +695,18 @@ var WidgetCard = function WidgetCard(props, state) {
|
|
|
723
695
|
}, " ", GetChartComponent(), " "));
|
|
724
696
|
|
|
725
697
|
function GetChartComponent() {
|
|
726
|
-
|
|
727
|
-
|
|
698
|
+
var _widget$current4, _widget$current5;
|
|
699
|
+
|
|
700
|
+
if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return null;
|
|
701
|
+
if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
|
|
728
702
|
dataBinding: props.dataBinding,
|
|
729
|
-
widget: widget,
|
|
703
|
+
widget: widget.current,
|
|
730
704
|
widgetRef: props.widgetRef,
|
|
731
705
|
onSelectDataPoint: props.onSelectDataPoint
|
|
732
706
|
});
|
|
733
707
|
return React__default.createElement(FusionChart, {
|
|
734
708
|
dataBinding: props.dataBinding,
|
|
735
|
-
widget: widget,
|
|
709
|
+
widget: widget.current,
|
|
736
710
|
widgetRef: props.widgetRef,
|
|
737
711
|
onSelectDataPoint: props.onSelectDataPoint
|
|
738
712
|
});
|