logitude-dashboard-library 1.3.87 → 1.3.90
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/assets/styles/dl-dashboard.scss +3 -1
- package/dist/features/Dashboard/ChartsComponents/FusionChartObjectBuilder.d.ts +1 -1
- package/dist/index.js +72 -105
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +72 -105
- package/dist/index.modern.js.map +1 -1
- package/dist/types/SeriesMeasure.d.ts +1 -0
- package/package.json +1 -1
|
@@ -294,11 +294,13 @@ $dark-grey: #717585;
|
|
|
294
294
|
box-sizing: border-box;
|
|
295
295
|
position: relative;
|
|
296
296
|
height: 100%;
|
|
297
|
+
|
|
297
298
|
header {
|
|
298
299
|
display: flex;
|
|
299
300
|
justify-content: space-between;
|
|
300
301
|
align-items: center;
|
|
301
302
|
position: unset;
|
|
303
|
+
|
|
302
304
|
i {
|
|
303
305
|
font-size: 18px;
|
|
304
306
|
// color: colors.$red;
|
|
@@ -454,4 +456,4 @@ $dark-grey: #717585;
|
|
|
454
456
|
.db-fc-container {
|
|
455
457
|
width: 100%;
|
|
456
458
|
height: 100%;
|
|
457
|
-
}
|
|
459
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ChartObject } from "fusioncharts";
|
|
2
2
|
import { SeriesMeasure } from "../../../types/SeriesMeasure";
|
|
3
3
|
import { FusionChartProps } from "./FusionChart";
|
|
4
|
-
export declare function BuildFusionChartObject(seriesMeasures: SeriesMeasure[], props: FusionChartProps
|
|
4
|
+
export declare function BuildFusionChartObject(seriesMeasures: SeriesMeasure[], props: FusionChartProps): ChartObject;
|
package/dist/index.js
CHANGED
|
@@ -203,51 +203,51 @@ var DashboardAnalyticsService = /*#__PURE__*/function () {
|
|
|
203
203
|
|
|
204
204
|
var KpiChart = function KpiChart(props) {
|
|
205
205
|
var _useState = React.useState(false),
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
dataLoaded = _useState[0],
|
|
207
|
+
setDataLoaded = _useState[1];
|
|
208
208
|
|
|
209
|
-
var _useState2 = React.useState(
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
var _useState2 = React.useState(),
|
|
210
|
+
error = _useState2[0],
|
|
211
|
+
setError = _useState2[1];
|
|
212
212
|
|
|
213
|
-
var isLoadingDrow = React.useRef(true);
|
|
214
213
|
var widget = React.useRef();
|
|
215
214
|
var widgetRef = React.useRef();
|
|
216
|
-
var isDataLoaded = React.useRef(false);
|
|
217
215
|
var hasDataError = React.useRef(false);
|
|
218
216
|
|
|
219
|
-
var _useState3 = React.useState(
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
var _useState3 = React.useState(),
|
|
218
|
+
data = _useState3[0],
|
|
219
|
+
setData = _useState3[1];
|
|
222
220
|
|
|
223
221
|
var _useState4 = React.useState(),
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
var _useState5 = React.useState(),
|
|
228
|
-
title = _useState5[0],
|
|
229
|
-
setTitle = _useState5[1];
|
|
222
|
+
title = _useState4[0],
|
|
223
|
+
setTitle = _useState4[1];
|
|
230
224
|
|
|
231
225
|
React.useEffect(function () {
|
|
226
|
+
widget.current = props.customChartProps.widget;
|
|
227
|
+
onRefresh();
|
|
228
|
+
}, []);
|
|
229
|
+
|
|
230
|
+
var onRefresh = function onRefresh() {
|
|
232
231
|
var _props$customChartPro;
|
|
233
232
|
|
|
234
|
-
setTimeout(function () {
|
|
235
|
-
isLoadingDrow.current = false;
|
|
236
|
-
updateView();
|
|
237
|
-
}, 500);
|
|
238
|
-
widget.current = props.customChartProps.widget;
|
|
239
233
|
(_props$customChartPro = props.customChartProps.dataBinding) === null || _props$customChartPro === void 0 ? void 0 : _props$customChartPro.onEditWidget.subscribe(function (e) {
|
|
240
234
|
var _widget$current;
|
|
241
235
|
|
|
242
236
|
if (e.key == ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) {
|
|
237
|
+
setDataLoaded(false);
|
|
243
238
|
Tools.Map(e, widget.current);
|
|
244
|
-
|
|
239
|
+
setTimeout(function () {
|
|
240
|
+
RefreshData();
|
|
241
|
+
}, 500);
|
|
245
242
|
}
|
|
246
243
|
});
|
|
247
|
-
}
|
|
244
|
+
};
|
|
245
|
+
|
|
248
246
|
React.useEffect(function () {
|
|
249
247
|
widgetRef.current = props.customChartProps.widgetRef;
|
|
250
|
-
|
|
248
|
+
setTimeout(function () {
|
|
249
|
+
RefreshData();
|
|
250
|
+
}, 500);
|
|
251
251
|
}, []);
|
|
252
252
|
React.useEffect(function () {
|
|
253
253
|
widgetRef.current = props.customChartProps.widgetRef;
|
|
@@ -264,32 +264,16 @@ var KpiChart = function KpiChart(props) {
|
|
|
264
264
|
postWidget.onChange = undefined;
|
|
265
265
|
dashboardAnalyticsService.getKpiData(postWidget).then(function (result) {
|
|
266
266
|
setData(result.data);
|
|
267
|
-
|
|
268
|
-
hasDataError.current = false;
|
|
269
|
-
updateView();
|
|
267
|
+
setDataLoaded(true);
|
|
270
268
|
}, function (error) {
|
|
271
269
|
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
272
270
|
|
|
273
271
|
console.log('error', error);
|
|
274
|
-
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)
|
|
275
|
-
|
|
276
|
-
hasDataError.current = true;
|
|
277
|
-
updateView();
|
|
272
|
+
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);
|
|
273
|
+
setDataLoaded(true);
|
|
278
274
|
});
|
|
279
275
|
};
|
|
280
276
|
|
|
281
|
-
var updateView = function updateView() {
|
|
282
|
-
if (isDataLoaded.current && !isLoadingDrow.current && !hasDataError.current) {
|
|
283
|
-
setisView(true);
|
|
284
|
-
setViewError(false);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (isDataLoaded.current && !isLoadingDrow.current && hasDataError.current) {
|
|
288
|
-
setisView(false);
|
|
289
|
-
setViewError(true);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
|
|
293
277
|
var kpiClick = function kpiClick() {
|
|
294
278
|
var _props$customChartPro4, _props$customChartPro5, _props$customChartPro6, _props$customChartPro7, _props$customChartPro8;
|
|
295
279
|
|
|
@@ -301,7 +285,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
301
285
|
});
|
|
302
286
|
};
|
|
303
287
|
|
|
304
|
-
return !
|
|
288
|
+
return !dataLoaded ? React__default.createElement("div", {
|
|
305
289
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
306
290
|
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
307
291
|
style: {
|
|
@@ -310,7 +294,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
310
294
|
},
|
|
311
295
|
strokeWidth: "4",
|
|
312
296
|
animationDuration: "2s"
|
|
313
|
-
})) :
|
|
297
|
+
})) : !error ? React__default.createElement("div", {
|
|
314
298
|
className: "kpIcontainer",
|
|
315
299
|
onClick: kpiClick
|
|
316
300
|
}, React__default.createElement("div", {
|
|
@@ -349,7 +333,7 @@ var CustomChart = function CustomChart(props) {
|
|
|
349
333
|
}, project());
|
|
350
334
|
};
|
|
351
335
|
|
|
352
|
-
function BuildFusionChartObject(seriesMeasures, props
|
|
336
|
+
function BuildFusionChartObject(seriesMeasures, props) {
|
|
353
337
|
var _props$widget;
|
|
354
338
|
|
|
355
339
|
handelNullLabels(seriesMeasures);
|
|
@@ -401,7 +385,7 @@ function getPieObject(seriesMeasures, chart) {
|
|
|
401
385
|
return chart;
|
|
402
386
|
}
|
|
403
387
|
|
|
404
|
-
function getDefaultChartobject(seriesMeasures, props
|
|
388
|
+
function getDefaultChartobject(seriesMeasures, props) {
|
|
405
389
|
var chart = {};
|
|
406
390
|
chart.type = "column2d";
|
|
407
391
|
chart.width = "100%";
|
|
@@ -412,21 +396,20 @@ function getDefaultChartobject(seriesMeasures, props, id) {
|
|
|
412
396
|
}
|
|
413
397
|
|
|
414
398
|
function buildChartDataSource(chart, props, seriesMeasures) {
|
|
415
|
-
var _props$widget2, _props$widget3, _props$widget4;
|
|
399
|
+
var _props$widget2, _props$widget3, _props$widget4, _props$widget5;
|
|
416
400
|
|
|
417
401
|
if (!seriesMeasures || !seriesMeasures[0]) return;
|
|
418
402
|
var chartinfo = {
|
|
419
|
-
caption: (_props$widget2 = props.widget) === null || _props$widget2 === void 0 ? void 0 : _props$widget2.Title,
|
|
420
403
|
theme: "fusion",
|
|
421
404
|
scrollHeight: "5",
|
|
422
405
|
scrollWidth: "5",
|
|
423
406
|
scrollPadding: "8",
|
|
424
407
|
flatScrollBars: "1",
|
|
425
408
|
enableSlicing: "0",
|
|
426
|
-
showLegend: "0"
|
|
409
|
+
showLegend: ((_props$widget2 = props.widget) === null || _props$widget2 === void 0 ? void 0 : _props$widget2.TypeCode) == "bar" || ((_props$widget3 = props.widget) === null || _props$widget3 === void 0 ? void 0 : _props$widget3.TypeCode) == "line" ? "1" : "0"
|
|
427
410
|
};
|
|
428
411
|
|
|
429
|
-
if (((_props$
|
|
412
|
+
if (((_props$widget4 = props.widget) === null || _props$widget4 === void 0 ? void 0 : _props$widget4.TypeCode) == "bar" || ((_props$widget5 = props.widget) === null || _props$widget5 === void 0 ? void 0 : _props$widget5.TypeCode) == "line") {
|
|
430
413
|
chart.dataSource = {
|
|
431
414
|
chart: chartinfo,
|
|
432
415
|
categories: buildCategories(seriesMeasures),
|
|
@@ -459,7 +442,6 @@ function buildDataSource(values) {
|
|
|
459
442
|
|
|
460
443
|
function buildDataSet(seriesMeasures) {
|
|
461
444
|
var dataSet = [];
|
|
462
|
-
var position = 1;
|
|
463
445
|
seriesMeasures.forEach(function (seriesMeasure) {
|
|
464
446
|
var datas = seriesMeasure.SeriesMeasureVulues.map(function (e) {
|
|
465
447
|
return {
|
|
@@ -472,9 +454,8 @@ function buildDataSet(seriesMeasures) {
|
|
|
472
454
|
});
|
|
473
455
|
dataSet.push({
|
|
474
456
|
data: datas,
|
|
475
|
-
seriesname:
|
|
457
|
+
seriesname: seriesMeasure.Name
|
|
476
458
|
});
|
|
477
|
-
position++;
|
|
478
459
|
});
|
|
479
460
|
return dataSet;
|
|
480
461
|
}
|
|
@@ -496,66 +477,52 @@ ReactFC.fcRoot(FusionCharts, Charts, FusionTheme);
|
|
|
496
477
|
|
|
497
478
|
var FusionChart = function FusionChart(props) {
|
|
498
479
|
var _useState = React.useState(false),
|
|
499
|
-
|
|
500
|
-
|
|
480
|
+
dataLoaded = _useState[0],
|
|
481
|
+
setDataLoaded = _useState[1];
|
|
501
482
|
|
|
502
|
-
var _useState2 = React.useState(
|
|
503
|
-
|
|
504
|
-
|
|
483
|
+
var _useState2 = React.useState(),
|
|
484
|
+
error = _useState2[0],
|
|
485
|
+
setError = _useState2[1];
|
|
505
486
|
|
|
506
|
-
var isLoadingDrow = React.useRef(true);
|
|
507
487
|
var widget = React.useRef();
|
|
508
488
|
var widgetRef = React.useRef();
|
|
509
|
-
var isDataLoaded = React.useRef(false);
|
|
510
|
-
var hasDataError = React.useRef(false);
|
|
511
489
|
|
|
512
|
-
var _useState3 = React.useState(
|
|
513
|
-
|
|
514
|
-
|
|
490
|
+
var _useState3 = React.useState({}),
|
|
491
|
+
args = _useState3[0],
|
|
492
|
+
setArgs = _useState3[1];
|
|
515
493
|
|
|
516
494
|
var _useState4 = React.useState({}),
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
var _useState5 = React.useState({}),
|
|
521
|
-
fChart = _useState5[0],
|
|
522
|
-
setFchart = _useState5[1];
|
|
495
|
+
fChart = _useState4[0],
|
|
496
|
+
setFchart = _useState4[1];
|
|
523
497
|
|
|
524
498
|
var entered = React.useRef(false);
|
|
525
499
|
var id = (Math.random() + 1).toString(36).substring(7);
|
|
526
500
|
React.useEffect(function () {
|
|
501
|
+
widget.current = props.widget;
|
|
502
|
+
onRefresh();
|
|
503
|
+
}, []);
|
|
504
|
+
|
|
505
|
+
var onRefresh = function onRefresh() {
|
|
527
506
|
var _props$dataBinding;
|
|
528
507
|
|
|
529
|
-
setTimeout(function () {
|
|
530
|
-
isLoadingDrow.current = false;
|
|
531
|
-
updateView();
|
|
532
|
-
}, 500);
|
|
533
|
-
widget.current = props.widget;
|
|
534
508
|
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.onEditWidget.subscribe(function (e) {
|
|
535
509
|
var _widget$current;
|
|
536
510
|
|
|
537
511
|
if (e.key == ((_widget$current = widget.current) === null || _widget$current === void 0 ? void 0 : _widget$current.key)) {
|
|
512
|
+
setDataLoaded(false);
|
|
538
513
|
Tools.Map(e, widget.current);
|
|
539
|
-
|
|
514
|
+
setTimeout(function () {
|
|
515
|
+
RefreshData();
|
|
516
|
+
}, 500);
|
|
540
517
|
}
|
|
541
518
|
});
|
|
542
|
-
}, []);
|
|
543
|
-
|
|
544
|
-
var updateView = function updateView() {
|
|
545
|
-
if (isDataLoaded.current && !isLoadingDrow.current && !hasDataError.current) {
|
|
546
|
-
setisView(true);
|
|
547
|
-
setViewError(false);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (isDataLoaded.current && !isLoadingDrow.current && hasDataError.current) {
|
|
551
|
-
setisView(false);
|
|
552
|
-
setViewError(true);
|
|
553
|
-
}
|
|
554
519
|
};
|
|
555
520
|
|
|
556
521
|
React.useEffect(function () {
|
|
557
522
|
widgetRef.current = props.widgetRef;
|
|
558
|
-
|
|
523
|
+
setTimeout(function () {
|
|
524
|
+
RefreshData();
|
|
525
|
+
}, 500);
|
|
559
526
|
}, []);
|
|
560
527
|
React.useEffect(function () {
|
|
561
528
|
widgetRef.current = props.widgetRef;
|
|
@@ -568,19 +535,15 @@ var FusionChart = function FusionChart(props) {
|
|
|
568
535
|
|
|
569
536
|
postWidget.onChange = undefined;
|
|
570
537
|
dashboardAnalyticsService.getData(postWidget).then(function (result) {
|
|
571
|
-
updateView();
|
|
572
538
|
var chart = BuildFusionChartObject(result.data, props);
|
|
573
539
|
setArgs(chart);
|
|
574
|
-
|
|
575
|
-
hasDataError.current = false;
|
|
540
|
+
setDataLoaded(true);
|
|
576
541
|
}, function (error) {
|
|
577
542
|
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
578
543
|
|
|
579
544
|
console.log('error', error);
|
|
580
545
|
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);
|
|
581
|
-
|
|
582
|
-
hasDataError.current = true;
|
|
583
|
-
updateView();
|
|
546
|
+
setDataLoaded(true);
|
|
584
547
|
});
|
|
585
548
|
};
|
|
586
549
|
|
|
@@ -611,7 +574,7 @@ var FusionChart = function FusionChart(props) {
|
|
|
611
574
|
}),
|
|
612
575
|
ref = _useResizeObserver.ref;
|
|
613
576
|
|
|
614
|
-
return !
|
|
577
|
+
return !dataLoaded ? React__default.createElement("div", {
|
|
615
578
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
616
579
|
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
617
580
|
style: {
|
|
@@ -620,9 +583,10 @@ var FusionChart = function FusionChart(props) {
|
|
|
620
583
|
},
|
|
621
584
|
strokeWidth: "4",
|
|
622
585
|
animationDuration: "2s"
|
|
623
|
-
})) :
|
|
586
|
+
})) : !error ? React__default.createElement("div", {
|
|
624
587
|
className: 'db-fc-container',
|
|
625
|
-
ref: ref
|
|
588
|
+
ref: ref,
|
|
589
|
+
id: id
|
|
626
590
|
}, React__default.createElement(ReactFC, Object.assign({}, args, {
|
|
627
591
|
"fcEvent-dataplotClick": dataplotClick,
|
|
628
592
|
onRender: renderComplete
|
|
@@ -639,7 +603,7 @@ var FusionChart = function FusionChart(props) {
|
|
|
639
603
|
};
|
|
640
604
|
|
|
641
605
|
var WidgetCard = function WidgetCard(props, state) {
|
|
642
|
-
var _props$widget2;
|
|
606
|
+
var _props$widget, _props$widget2, _props$widget4;
|
|
643
607
|
|
|
644
608
|
var moreBtnToggle = React.useRef(null);
|
|
645
609
|
|
|
@@ -652,12 +616,15 @@ var WidgetCard = function WidgetCard(props, state) {
|
|
|
652
616
|
|
|
653
617
|
return React__default.createElement("div", {
|
|
654
618
|
className: "panel",
|
|
655
|
-
key: props.el.i
|
|
619
|
+
key: props.el.i,
|
|
620
|
+
style: {
|
|
621
|
+
cursor: props.isInEditMode ? 'move' : 'default'
|
|
622
|
+
}
|
|
656
623
|
}, React__default.createElement("header", {
|
|
657
624
|
style: {
|
|
658
625
|
paddingLeft: "5px"
|
|
659
626
|
}
|
|
660
|
-
}, React__default.createElement("h1", null), props.isInEditMode ? React__default.createElement(button.Button, {
|
|
627
|
+
}, React__default.createElement("h1", null, (props === null || props === void 0 ? void 0 : (_props$widget = props.widget) === null || _props$widget === void 0 ? void 0 : _props$widget.TypeCode) == "kpi" ? null : (_props$widget2 = props.widget) === null || _props$widget2 === void 0 ? void 0 : _props$widget2.Title), props.isInEditMode ? React__default.createElement(button.Button, {
|
|
661
628
|
icon: "pi pi-ellipsis-v",
|
|
662
629
|
className: "p-button-lg p-button-rounded p-button-text",
|
|
663
630
|
onClick: function onClick(e) {
|
|
@@ -674,13 +641,13 @@ var WidgetCard = function WidgetCard(props, state) {
|
|
|
674
641
|
onClick: editWidget
|
|
675
642
|
}, " Edit "), React__default.createElement("div", {
|
|
676
643
|
onClick: function onClick() {
|
|
677
|
-
var _props$
|
|
644
|
+
var _props$widget3;
|
|
678
645
|
|
|
679
|
-
return props.deleteBtnClicked((_props$
|
|
646
|
+
return props.deleteBtnClicked((_props$widget3 = props.widget) === null || _props$widget3 === void 0 ? void 0 : _props$widget3.key);
|
|
680
647
|
}
|
|
681
648
|
}, "Remove")))), React__default.createElement("div", {
|
|
682
649
|
className: "dl-dashboard-widget"
|
|
683
|
-
}, (props === null || props === void 0 ? void 0 : (_props$
|
|
650
|
+
}, (props === null || props === void 0 ? void 0 : (_props$widget4 = props.widget) === null || _props$widget4 === void 0 ? void 0 : _props$widget4.TypeCode) == "kpi" ? React__default.createElement(CustomChart, {
|
|
684
651
|
dataBinding: props.dataBinding,
|
|
685
652
|
widget: props.widget,
|
|
686
653
|
widgetRef: props.widgetRef,
|