logitude-dashboard-library 3.2.7 → 3.2.9
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 +9 -14
- package/dist/index.js +137 -78
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +137 -78
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +9 -14
- package/dist/types/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -348,11 +348,11 @@ $dark-grey: #717585;
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
.kpi-custom-size {
|
|
351
|
-
-webkit-transform: scale(0.
|
|
352
|
-
-ms-transform: scale(0.
|
|
353
|
-
-o-transform: scale(0.
|
|
354
|
-
transform: scale(0.
|
|
355
|
-
margin-top: -
|
|
351
|
+
-webkit-transform: scale(0.62);
|
|
352
|
+
-ms-transform: scale(0.62);
|
|
353
|
+
-o-transform: scale(0.62);
|
|
354
|
+
transform: scale(0.62);
|
|
355
|
+
margin-top: -12px;
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
.margin-top-6 {
|
|
@@ -547,7 +547,7 @@ $dark-grey: #717585;
|
|
|
547
547
|
box-sizing: border-box;
|
|
548
548
|
display: flex;
|
|
549
549
|
place-content: flex-end flex-start;
|
|
550
|
-
align-items:
|
|
550
|
+
align-items: center;
|
|
551
551
|
max-width: 100%;
|
|
552
552
|
}
|
|
553
553
|
|
|
@@ -558,7 +558,6 @@ $dark-grey: #717585;
|
|
|
558
558
|
.dl-kpi-label-span{
|
|
559
559
|
font-family: "Manrope";
|
|
560
560
|
font-style: normal;
|
|
561
|
-
font-weight: 700;
|
|
562
561
|
font-size: 16px;
|
|
563
562
|
line-height: 120%;
|
|
564
563
|
color: #292D30;
|
|
@@ -702,8 +701,7 @@ $dark-grey: #717585;
|
|
|
702
701
|
font-size: 11px;
|
|
703
702
|
line-height: 15px;
|
|
704
703
|
color: #A4A4A4;
|
|
705
|
-
margin-left:
|
|
706
|
-
margin-bottom: 6px;
|
|
704
|
+
margin-left: 5px;
|
|
707
705
|
flex-shrink: 0;
|
|
708
706
|
}
|
|
709
707
|
|
|
@@ -846,10 +844,8 @@ $dark-grey: #717585;
|
|
|
846
844
|
|
|
847
845
|
.dl-kpi-prev-container {
|
|
848
846
|
display: flex;
|
|
849
|
-
align-
|
|
850
|
-
|
|
851
|
-
place-content: flex-end flex-start;
|
|
852
|
-
justify-content: flex-start;
|
|
847
|
+
align-items: center;
|
|
848
|
+
justify-content: center;
|
|
853
849
|
font-family: 'Manrope';
|
|
854
850
|
font-style: normal;
|
|
855
851
|
font-weight: 500;
|
|
@@ -862,7 +858,6 @@ $dark-grey: #717585;
|
|
|
862
858
|
font-style: normal;
|
|
863
859
|
font-weight: 500;
|
|
864
860
|
font-size: 12px;
|
|
865
|
-
line-height: 15px;
|
|
866
861
|
color: #292D30;
|
|
867
862
|
}
|
|
868
863
|
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ var React__default = _interopDefault(React);
|
|
|
5
5
|
var reactGridLayout = require('react-grid-layout');
|
|
6
6
|
var progressspinner = require('primereact/progressspinner');
|
|
7
7
|
var axios = _interopDefault(require('axios'));
|
|
8
|
-
var moment = _interopDefault(require('moment'));
|
|
9
8
|
var uuid = require('uuid');
|
|
9
|
+
var moment = _interopDefault(require('moment'));
|
|
10
10
|
var datatable = require('primereact/datatable');
|
|
11
11
|
var column = require('primereact/column');
|
|
12
12
|
var ReactFC = _interopDefault(require('react-fusioncharts'));
|
|
@@ -253,70 +253,6 @@ function SvgRedWarning(props) {
|
|
|
253
253
|
})));
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
var DateGroupCodes = {
|
|
257
|
-
Full_Date: 'Full Date',
|
|
258
|
-
Month: 'Month',
|
|
259
|
-
Quarter: 'Quarter',
|
|
260
|
-
Year: 'Year',
|
|
261
|
-
Month_Year: 'Month & Year',
|
|
262
|
-
Quarter_Year: 'Quarter & Year'
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
var getDateFormat = function getDateFormat(label, _format) {
|
|
266
|
-
if (!label) return label;
|
|
267
|
-
|
|
268
|
-
var _date = moment(label);
|
|
269
|
-
|
|
270
|
-
if (!_date || !_date.isValid()) return label;
|
|
271
|
-
return _date.format(_format);
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
var getQuarterYearFormat = function getQuarterYearFormat(label) {
|
|
275
|
-
if (!label) return label;
|
|
276
|
-
|
|
277
|
-
if (label.includes("/")) {
|
|
278
|
-
var result = label.split("/");
|
|
279
|
-
var quarterVal = result && result[1] ? result[1] : "";
|
|
280
|
-
var yearVal = result && result[0] ? result[0] : "";
|
|
281
|
-
return quarterVal + " " + yearVal;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return label;
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
var getLabelFormatByDateGroupType = function getLabelFormatByDateGroupType(label, widget, isSecondGrouping) {
|
|
288
|
-
if (isSecondGrouping === void 0) {
|
|
289
|
-
isSecondGrouping = false;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (!widget) return label;
|
|
293
|
-
var groupFieldDataType = isSecondGrouping ? widget.SecondaryDateGroupCode : widget.DateGroupCode;
|
|
294
|
-
if (!groupFieldDataType) return label;
|
|
295
|
-
|
|
296
|
-
switch (groupFieldDataType) {
|
|
297
|
-
case DateGroupCodes.Full_Date:
|
|
298
|
-
return getDateFormat(label, "DD MMM YYYY");
|
|
299
|
-
|
|
300
|
-
case DateGroupCodes.Month:
|
|
301
|
-
return getDateFormat(label, "MMM");
|
|
302
|
-
|
|
303
|
-
case DateGroupCodes.Quarter:
|
|
304
|
-
return label;
|
|
305
|
-
|
|
306
|
-
case DateGroupCodes.Year:
|
|
307
|
-
return getDateFormat(label, "YYYY");
|
|
308
|
-
|
|
309
|
-
case DateGroupCodes.Month_Year:
|
|
310
|
-
return getDateFormat(label, "MMM YYYY");
|
|
311
|
-
|
|
312
|
-
case DateGroupCodes.Quarter_Year:
|
|
313
|
-
return getQuarterYearFormat(label);
|
|
314
|
-
|
|
315
|
-
default:
|
|
316
|
-
return label;
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
256
|
var isNullOrUndefined = function isNullOrUndefined(val) {
|
|
321
257
|
return val == null || val == undefined;
|
|
322
258
|
};
|
|
@@ -326,7 +262,7 @@ var isNullOrUndefinedOrEmpty = function isNullOrUndefinedOrEmpty(val) {
|
|
|
326
262
|
};
|
|
327
263
|
|
|
328
264
|
var KpiChart = function KpiChart(props) {
|
|
329
|
-
var _widget$
|
|
265
|
+
var _widget$current16;
|
|
330
266
|
|
|
331
267
|
var _useState = React.useState(true),
|
|
332
268
|
isLoading = _useState[0],
|
|
@@ -437,6 +373,9 @@ var KpiChart = function KpiChart(props) {
|
|
|
437
373
|
return React__default.createElement("div", {
|
|
438
374
|
className: "dl-kpi-ratio-container"
|
|
439
375
|
}, getArrowComponent(), React__default.createElement("div", {
|
|
376
|
+
style: {
|
|
377
|
+
fontSize: getKPIFormattingPropertyValue("PercentageFontSize", "px")
|
|
378
|
+
},
|
|
440
379
|
className: 'dl-kpi-ratio-text'
|
|
441
380
|
}, data === null || data === void 0 ? void 0 : data.Ratio, " %"));
|
|
442
381
|
}
|
|
@@ -480,14 +419,22 @@ var KpiChart = function KpiChart(props) {
|
|
|
480
419
|
|
|
481
420
|
function getPreviousValueComponent() {
|
|
482
421
|
if (isNullOrUndefined(data) || isNullOrUndefined(data === null || data === void 0 ? void 0 : data.ComparisonValue) || isNullOrUndefined(data === null || data === void 0 ? void 0 : data.ComparisonLabel)) return "";
|
|
483
|
-
var
|
|
484
|
-
var
|
|
485
|
-
var prevtext = labelFormated ? labelFormated + ": " + (data === null || data === void 0 ? void 0 : data.ComparisonValue) : "";
|
|
422
|
+
var formatedValue = data ? data.ComparisonLabel : "";
|
|
423
|
+
var comparisonValue = data ? data === null || data === void 0 ? void 0 : data.ComparisonValue : "";
|
|
486
424
|
return React__default.createElement("div", {
|
|
425
|
+
title: formatedValue,
|
|
487
426
|
className: "dl-kpi-prev-container"
|
|
488
427
|
}, React__default.createElement("div", {
|
|
428
|
+
style: {
|
|
429
|
+
color: getKPIFormattingPropertyValue("ComparisonValueFontColor"),
|
|
430
|
+
fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
|
|
431
|
+
},
|
|
489
432
|
className: "dl-kpi-prev-text"
|
|
490
|
-
},
|
|
433
|
+
}, comparisonValue), (data === null || data === void 0 ? void 0 : data.ComparisonAbbreviationSymbol) && React__default.createElement("div", {
|
|
434
|
+
style: {
|
|
435
|
+
color: getKPIFormattingPropertyValue("ComparisonValueFontColor"),
|
|
436
|
+
fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
|
|
437
|
+
},
|
|
491
438
|
className: "dl-kpi-prev-abbreviationSymbol"
|
|
492
439
|
}, data === null || data === void 0 ? void 0 : data.ComparisonAbbreviationSymbol));
|
|
493
440
|
}
|
|
@@ -497,6 +444,10 @@ var KpiChart = function KpiChart(props) {
|
|
|
497
444
|
className: "dl-kpi-no-data"
|
|
498
445
|
}, "No data to display.");
|
|
499
446
|
return React__default.createElement("div", {
|
|
447
|
+
style: {
|
|
448
|
+
color: getKPIFormattingPropertyValue("MainValueFontColor"),
|
|
449
|
+
fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
|
|
450
|
+
},
|
|
500
451
|
className: "dl-kpi-value dl-kpi-textTrimming"
|
|
501
452
|
}, data === null || data === void 0 ? void 0 : data.Value);
|
|
502
453
|
}
|
|
@@ -505,19 +456,67 @@ var KpiChart = function KpiChart(props) {
|
|
|
505
456
|
return React__default.createElement("div", {
|
|
506
457
|
className: "dl-kpi-sub-container"
|
|
507
458
|
}, getValueData(), (data === null || data === void 0 ? void 0 : data.AbbreviationSymbol) && React__default.createElement("div", {
|
|
459
|
+
style: {
|
|
460
|
+
color: getKPIFormattingPropertyValue("MainValueFontColor"),
|
|
461
|
+
fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
|
|
462
|
+
},
|
|
508
463
|
className: "dl-kpi-abbreviationSymbol"
|
|
509
464
|
}, data === null || data === void 0 ? void 0 : data.AbbreviationSymbol), widget.current && widget.current.ShowMeasureUnit && (data === null || data === void 0 ? void 0 : data.Unit) && React__default.createElement("div", {
|
|
465
|
+
style: {
|
|
466
|
+
color: getKPIFormattingPropertyValue("MainValueFontColor"),
|
|
467
|
+
fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
|
|
468
|
+
},
|
|
510
469
|
className: "dl-kpi-unit"
|
|
511
470
|
}, data === null || data === void 0 ? void 0 : data.Unit), getRatioComponent());
|
|
512
471
|
}
|
|
513
472
|
|
|
473
|
+
var getPeriodLabelByPeriodCode = function getPeriodLabelByPeriodCode(code) {
|
|
474
|
+
if (!isNullOrUndefinedOrEmpty(code)) {
|
|
475
|
+
return code.replaceAll("_", " ");
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return "";
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
var getLabelFromKPISettings = function getLabelFromKPISettings() {
|
|
482
|
+
if (widget.current && widget.current.KPIComparisonSettings && widget.current.KPIComparisonSettings.length) {
|
|
483
|
+
var kpiSettings = JSON.parse(widget.current.KPIComparisonSettings);
|
|
484
|
+
var PeriodDateFilter = kpiSettings ? kpiSettings.PeriodDateFilter : null;
|
|
485
|
+
var isKPISettingsActivated = !isNullOrUndefinedOrEmpty(kpiSettings.PeriodFieldId);
|
|
486
|
+
return isKPISettingsActivated && PeriodDateFilter && PeriodDateFilter.DateTimeValueCode ? getPeriodLabelByPeriodCode(PeriodDateFilter.DateTimeValueCode) : "";
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return "";
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
var getKPIFormattingData = function getKPIFormattingData() {
|
|
493
|
+
var _widget$current14, _widget$current15;
|
|
494
|
+
|
|
495
|
+
return isNullOrUndefinedOrEmpty((_widget$current14 = widget.current) === null || _widget$current14 === void 0 ? void 0 : _widget$current14.KPIFormatSettings) ? {} : JSON.parse((_widget$current15 = widget.current) === null || _widget$current15 === void 0 ? void 0 : _widget$current15.KPIFormatSettings);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
var getKPIFormattingPropertyValue = function getKPIFormattingPropertyValue(propertyName, unit) {
|
|
499
|
+
if (unit === void 0) {
|
|
500
|
+
unit = "";
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
var kpiFormattingData = getKPIFormattingData();
|
|
504
|
+
return kpiFormattingData && kpiFormattingData[propertyName] ? kpiFormattingData[propertyName] + unit : undefined;
|
|
505
|
+
};
|
|
506
|
+
|
|
514
507
|
function getLabel() {
|
|
515
|
-
var
|
|
508
|
+
var formatedValue = data ? data.Label : "";
|
|
509
|
+
var label = getLabelFromKPISettings();
|
|
516
510
|
return React__default.createElement("div", {
|
|
517
511
|
className: "dl-kpi-label-container"
|
|
518
512
|
}, React__default.createElement("span", {
|
|
513
|
+
style: {
|
|
514
|
+
color: getKPIFormattingPropertyValue("MainPeriodFontColor"),
|
|
515
|
+
fontSize: getKPIFormattingPropertyValue("MainPeriodFontSize", "px")
|
|
516
|
+
},
|
|
517
|
+
title: formatedValue,
|
|
519
518
|
className: "dl-kpi-label-span dl-kpi-textTrimming"
|
|
520
|
-
},
|
|
519
|
+
}, label));
|
|
521
520
|
}
|
|
522
521
|
|
|
523
522
|
var getIsKPIHasSmallestHeight = function getIsKPIHasSmallestHeight() {
|
|
@@ -527,13 +526,9 @@ var KpiChart = function KpiChart(props) {
|
|
|
527
526
|
};
|
|
528
527
|
|
|
529
528
|
var isKPICustomResizeNeeded = function isKPICustomResizeNeeded() {
|
|
530
|
-
var _widget$current14, _widget$current15, _widget$current16, _widget$current17;
|
|
531
|
-
|
|
532
529
|
if (!widget || !widget.current) return;
|
|
533
|
-
var isThereTitle = !isNullOrUndefined((_widget$current14 = widget.current) === null || _widget$current14 === void 0 ? void 0 : _widget$current14.Title) && ((_widget$current15 = widget.current) === null || _widget$current15 === void 0 ? void 0 : _widget$current15.Title.length) > 0;
|
|
534
|
-
var isThereSubTitle = !isNullOrUndefined((_widget$current16 = widget.current) === null || _widget$current16 === void 0 ? void 0 : _widget$current16.Subtitle) && ((_widget$current17 = widget.current) === null || _widget$current17 === void 0 ? void 0 : _widget$current17.Subtitle.length) > 0;
|
|
535
530
|
var isKPIHasSmallestHeight = getIsKPIHasSmallestHeight();
|
|
536
|
-
return
|
|
531
|
+
return isKPIHasSmallestHeight;
|
|
537
532
|
};
|
|
538
533
|
|
|
539
534
|
return isLoading || !widget.current ? React__default.createElement("div", {
|
|
@@ -548,7 +543,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
548
543
|
})) : !error && widget.current ? React__default.createElement("div", {
|
|
549
544
|
key: triggerId,
|
|
550
545
|
onClick: kpiClick,
|
|
551
|
-
className: ((_widget$
|
|
546
|
+
className: ((_widget$current16 = widget.current) === null || _widget$current16 === void 0 ? void 0 : _widget$current16.Alighnment) == "Left" ? "dl-kpi-container-click db-justify-content-flex-start" : "dl-kpi-container-click"
|
|
552
547
|
}, React__default.createElement("div", {
|
|
553
548
|
className: isKPICustomSizeNeeded ? "dl-kpi-container kpi-custom-size" : "dl-kpi-container"
|
|
554
549
|
}, getLabel(), getValueComponent(), getPreviousValueComponent())) : React__default.createElement("div", {
|
|
@@ -875,6 +870,70 @@ var CustomChart = function CustomChart(props) {
|
|
|
875
870
|
}, project()));
|
|
876
871
|
};
|
|
877
872
|
|
|
873
|
+
var DateGroupCodes = {
|
|
874
|
+
Full_Date: 'Full Date',
|
|
875
|
+
Month: 'Month',
|
|
876
|
+
Quarter: 'Quarter',
|
|
877
|
+
Year: 'Year',
|
|
878
|
+
Month_Year: 'Month & Year',
|
|
879
|
+
Quarter_Year: 'Quarter & Year'
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
var getDateFormat = function getDateFormat(label, _format) {
|
|
883
|
+
if (!label) return label;
|
|
884
|
+
|
|
885
|
+
var _date = moment(label);
|
|
886
|
+
|
|
887
|
+
if (!_date || !_date.isValid()) return label;
|
|
888
|
+
return _date.format(_format);
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
var getQuarterYearFormat = function getQuarterYearFormat(label) {
|
|
892
|
+
if (!label) return label;
|
|
893
|
+
|
|
894
|
+
if (label.includes("/")) {
|
|
895
|
+
var result = label.split("/");
|
|
896
|
+
var quarterVal = result && result[1] ? result[1] : "";
|
|
897
|
+
var yearVal = result && result[0] ? result[0] : "";
|
|
898
|
+
return quarterVal + " " + yearVal;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
return label;
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
var getLabelFormatByDateGroupType = function getLabelFormatByDateGroupType(label, widget, isSecondGrouping) {
|
|
905
|
+
if (isSecondGrouping === void 0) {
|
|
906
|
+
isSecondGrouping = false;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
if (!widget) return label;
|
|
910
|
+
var groupFieldDataType = isSecondGrouping ? widget.SecondaryDateGroupCode : widget.DateGroupCode;
|
|
911
|
+
if (!groupFieldDataType) return label;
|
|
912
|
+
|
|
913
|
+
switch (groupFieldDataType) {
|
|
914
|
+
case DateGroupCodes.Full_Date:
|
|
915
|
+
return getDateFormat(label, "DD MMM YYYY");
|
|
916
|
+
|
|
917
|
+
case DateGroupCodes.Month:
|
|
918
|
+
return getDateFormat(label, "MMM");
|
|
919
|
+
|
|
920
|
+
case DateGroupCodes.Quarter:
|
|
921
|
+
return label;
|
|
922
|
+
|
|
923
|
+
case DateGroupCodes.Year:
|
|
924
|
+
return getDateFormat(label, "YYYY");
|
|
925
|
+
|
|
926
|
+
case DateGroupCodes.Month_Year:
|
|
927
|
+
return getDateFormat(label, "MMM YYYY");
|
|
928
|
+
|
|
929
|
+
case DateGroupCodes.Quarter_Year:
|
|
930
|
+
return getQuarterYearFormat(label);
|
|
931
|
+
|
|
932
|
+
default:
|
|
933
|
+
return label;
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
|
|
878
937
|
function buildToolTip(widget, value, seriesName, label, index) {
|
|
879
938
|
var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
|
|
880
939
|
return "\n <div style=\"min-width: 108px;" + padding + "\">\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; min-height: 10px; min-width: 10px; height: 10px; width: 10px; background-color: transparent; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px; white-space: pre-line; font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232;\"> " + getTooltiplabel(label, seriesName) + "</p>\n </div>\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getMeasureType(seriesName) + "</p>\n <p style=\"margin: 0;margin-left: 6px; white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #323232;\">" + getTooltipValue(value) + "</p>\n " + getTooltipPercentage(widget) + " </div>\n </div>\n ";
|