logitude-dashboard-library 3.1.20 → 3.1.21
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 +136 -78
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +136 -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
package/dist/index.modern.js
CHANGED
|
@@ -2,8 +2,8 @@ import React__default, { createElement, useState, useRef, useEffect, forwardRef,
|
|
|
2
2
|
import { WidthProvider, Responsive } from 'react-grid-layout';
|
|
3
3
|
import { ProgressSpinner } from 'primereact/progressspinner';
|
|
4
4
|
import axios from 'axios';
|
|
5
|
-
import moment from 'moment';
|
|
6
5
|
import { v4 } from 'uuid';
|
|
6
|
+
import moment from 'moment';
|
|
7
7
|
import { DataTable } from 'primereact/datatable';
|
|
8
8
|
import { Column } from 'primereact/column';
|
|
9
9
|
import ReactFC from 'react-fusioncharts';
|
|
@@ -250,70 +250,6 @@ function SvgRedWarning(props) {
|
|
|
250
250
|
})));
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
var DateGroupCodes = {
|
|
254
|
-
Full_Date: 'Full Date',
|
|
255
|
-
Month: 'Month',
|
|
256
|
-
Quarter: 'Quarter',
|
|
257
|
-
Year: 'Year',
|
|
258
|
-
Month_Year: 'Month & Year',
|
|
259
|
-
Quarter_Year: 'Quarter & Year'
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
var getDateFormat = function getDateFormat(label, _format) {
|
|
263
|
-
if (!label) return label;
|
|
264
|
-
|
|
265
|
-
var _date = moment(label);
|
|
266
|
-
|
|
267
|
-
if (!_date || !_date.isValid()) return label;
|
|
268
|
-
return _date.format(_format);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
var getQuarterYearFormat = function getQuarterYearFormat(label) {
|
|
272
|
-
if (!label) return label;
|
|
273
|
-
|
|
274
|
-
if (label.includes("/")) {
|
|
275
|
-
var result = label.split("/");
|
|
276
|
-
var quarterVal = result && result[1] ? result[1] : "";
|
|
277
|
-
var yearVal = result && result[0] ? result[0] : "";
|
|
278
|
-
return quarterVal + " " + yearVal;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return label;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
var getLabelFormatByDateGroupType = function getLabelFormatByDateGroupType(label, widget, isSecondGrouping) {
|
|
285
|
-
if (isSecondGrouping === void 0) {
|
|
286
|
-
isSecondGrouping = false;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (!widget) return label;
|
|
290
|
-
var groupFieldDataType = isSecondGrouping ? widget.SecondaryDateGroupCode : widget.DateGroupCode;
|
|
291
|
-
if (!groupFieldDataType) return label;
|
|
292
|
-
|
|
293
|
-
switch (groupFieldDataType) {
|
|
294
|
-
case DateGroupCodes.Full_Date:
|
|
295
|
-
return getDateFormat(label, "DD MMM YYYY");
|
|
296
|
-
|
|
297
|
-
case DateGroupCodes.Month:
|
|
298
|
-
return getDateFormat(label, "MMM");
|
|
299
|
-
|
|
300
|
-
case DateGroupCodes.Quarter:
|
|
301
|
-
return label;
|
|
302
|
-
|
|
303
|
-
case DateGroupCodes.Year:
|
|
304
|
-
return getDateFormat(label, "YYYY");
|
|
305
|
-
|
|
306
|
-
case DateGroupCodes.Month_Year:
|
|
307
|
-
return getDateFormat(label, "MMM YYYY");
|
|
308
|
-
|
|
309
|
-
case DateGroupCodes.Quarter_Year:
|
|
310
|
-
return getQuarterYearFormat(label);
|
|
311
|
-
|
|
312
|
-
default:
|
|
313
|
-
return label;
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
|
|
317
253
|
var isNullOrUndefined = function isNullOrUndefined(val) {
|
|
318
254
|
return val == null || val == undefined;
|
|
319
255
|
};
|
|
@@ -323,7 +259,7 @@ var isNullOrUndefinedOrEmpty = function isNullOrUndefinedOrEmpty(val) {
|
|
|
323
259
|
};
|
|
324
260
|
|
|
325
261
|
var KpiChart = function KpiChart(props) {
|
|
326
|
-
var _widget$
|
|
262
|
+
var _widget$current16;
|
|
327
263
|
|
|
328
264
|
var _useState = useState(true),
|
|
329
265
|
isLoading = _useState[0],
|
|
@@ -434,6 +370,9 @@ var KpiChart = function KpiChart(props) {
|
|
|
434
370
|
return React__default.createElement("div", {
|
|
435
371
|
className: "dl-kpi-ratio-container"
|
|
436
372
|
}, getArrowComponent(), React__default.createElement("div", {
|
|
373
|
+
style: {
|
|
374
|
+
fontSize: getKPIFormattingPropertyValue("PercentageFontSize", "px")
|
|
375
|
+
},
|
|
437
376
|
className: 'dl-kpi-ratio-text'
|
|
438
377
|
}, data === null || data === void 0 ? void 0 : data.Ratio, " %"));
|
|
439
378
|
}
|
|
@@ -477,14 +416,22 @@ var KpiChart = function KpiChart(props) {
|
|
|
477
416
|
|
|
478
417
|
function getPreviousValueComponent() {
|
|
479
418
|
if (isNullOrUndefined(data) || isNullOrUndefined(data === null || data === void 0 ? void 0 : data.ComparisonValue) || isNullOrUndefined(data === null || data === void 0 ? void 0 : data.ComparisonLabel)) return "";
|
|
480
|
-
var
|
|
481
|
-
var
|
|
482
|
-
var prevtext = labelFormated ? labelFormated + ": " + (data === null || data === void 0 ? void 0 : data.ComparisonValue) : "";
|
|
419
|
+
var formatedValue = data ? data.ComparisonLabel : "";
|
|
420
|
+
var comparisonValue = data ? data === null || data === void 0 ? void 0 : data.ComparisonValue : "";
|
|
483
421
|
return React__default.createElement("div", {
|
|
484
422
|
className: "dl-kpi-prev-container"
|
|
485
423
|
}, React__default.createElement("div", {
|
|
424
|
+
style: {
|
|
425
|
+
color: getKPIFormattingPropertyValue("ComparisonValueFontColor"),
|
|
426
|
+
fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
|
|
427
|
+
},
|
|
428
|
+
title: formatedValue,
|
|
486
429
|
className: "dl-kpi-prev-text"
|
|
487
|
-
},
|
|
430
|
+
}, comparisonValue), (data === null || data === void 0 ? void 0 : data.ComparisonAbbreviationSymbol) && React__default.createElement("div", {
|
|
431
|
+
style: {
|
|
432
|
+
color: getKPIFormattingPropertyValue("ComparisonValueFontColor"),
|
|
433
|
+
fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
|
|
434
|
+
},
|
|
488
435
|
className: "dl-kpi-prev-abbreviationSymbol"
|
|
489
436
|
}, data === null || data === void 0 ? void 0 : data.ComparisonAbbreviationSymbol));
|
|
490
437
|
}
|
|
@@ -494,6 +441,10 @@ var KpiChart = function KpiChart(props) {
|
|
|
494
441
|
className: "dl-kpi-no-data"
|
|
495
442
|
}, "No data to display.");
|
|
496
443
|
return React__default.createElement("div", {
|
|
444
|
+
style: {
|
|
445
|
+
color: getKPIFormattingPropertyValue("MainValueFontColor"),
|
|
446
|
+
fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
|
|
447
|
+
},
|
|
497
448
|
className: "dl-kpi-value dl-kpi-textTrimming"
|
|
498
449
|
}, data === null || data === void 0 ? void 0 : data.Value);
|
|
499
450
|
}
|
|
@@ -502,19 +453,66 @@ var KpiChart = function KpiChart(props) {
|
|
|
502
453
|
return React__default.createElement("div", {
|
|
503
454
|
className: "dl-kpi-sub-container"
|
|
504
455
|
}, getValueData(), (data === null || data === void 0 ? void 0 : data.AbbreviationSymbol) && React__default.createElement("div", {
|
|
456
|
+
style: {
|
|
457
|
+
color: getKPIFormattingPropertyValue("MainValueFontColor"),
|
|
458
|
+
fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
|
|
459
|
+
},
|
|
505
460
|
className: "dl-kpi-abbreviationSymbol"
|
|
506
461
|
}, 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", {
|
|
462
|
+
style: {
|
|
463
|
+
color: getKPIFormattingPropertyValue("MainValueFontColor"),
|
|
464
|
+
fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
|
|
465
|
+
},
|
|
507
466
|
className: "dl-kpi-unit"
|
|
508
467
|
}, data === null || data === void 0 ? void 0 : data.Unit), getRatioComponent());
|
|
509
468
|
}
|
|
510
469
|
|
|
470
|
+
var getPeriodLabelByPeriodCode = function getPeriodLabelByPeriodCode(code) {
|
|
471
|
+
if (!isNullOrUndefinedOrEmpty(code)) {
|
|
472
|
+
return code.replaceAll("_", " ");
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return "";
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
var getLabelFromKPISettings = function getLabelFromKPISettings() {
|
|
479
|
+
if (widget.current && widget.current.KPIComparisonSettings && widget.current.KPIComparisonSettings.length) {
|
|
480
|
+
var kpiSettings = JSON.parse(widget.current.KPIComparisonSettings);
|
|
481
|
+
var PeriodDateFilter = kpiSettings ? kpiSettings.PeriodDateFilter : null;
|
|
482
|
+
return PeriodDateFilter && PeriodDateFilter.DateTimeValueCode ? getPeriodLabelByPeriodCode(PeriodDateFilter.DateTimeValueCode) : "";
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return "";
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
var getKPIFormattingData = function getKPIFormattingData() {
|
|
489
|
+
var _widget$current14, _widget$current15;
|
|
490
|
+
|
|
491
|
+
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);
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
var getKPIFormattingPropertyValue = function getKPIFormattingPropertyValue(propertyName, unit) {
|
|
495
|
+
if (unit === void 0) {
|
|
496
|
+
unit = "";
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
var kpiFormattingData = getKPIFormattingData();
|
|
500
|
+
return kpiFormattingData && kpiFormattingData[propertyName] ? kpiFormattingData[propertyName] + unit : undefined;
|
|
501
|
+
};
|
|
502
|
+
|
|
511
503
|
function getLabel() {
|
|
512
|
-
var
|
|
504
|
+
var formatedValue = data ? data.Label : "";
|
|
505
|
+
var label = getLabelFromKPISettings();
|
|
513
506
|
return React__default.createElement("div", {
|
|
514
507
|
className: "dl-kpi-label-container"
|
|
515
508
|
}, React__default.createElement("span", {
|
|
509
|
+
style: {
|
|
510
|
+
color: getKPIFormattingPropertyValue("MainPeriodFontColor"),
|
|
511
|
+
fontSize: getKPIFormattingPropertyValue("MainPeriodFontSize", "px")
|
|
512
|
+
},
|
|
513
|
+
title: formatedValue,
|
|
516
514
|
className: "dl-kpi-label-span dl-kpi-textTrimming"
|
|
517
|
-
},
|
|
515
|
+
}, label));
|
|
518
516
|
}
|
|
519
517
|
|
|
520
518
|
var getIsKPIHasSmallestHeight = function getIsKPIHasSmallestHeight() {
|
|
@@ -524,13 +522,9 @@ var KpiChart = function KpiChart(props) {
|
|
|
524
522
|
};
|
|
525
523
|
|
|
526
524
|
var isKPICustomResizeNeeded = function isKPICustomResizeNeeded() {
|
|
527
|
-
var _widget$current14, _widget$current15, _widget$current16, _widget$current17;
|
|
528
|
-
|
|
529
525
|
if (!widget || !widget.current) return;
|
|
530
|
-
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;
|
|
531
|
-
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;
|
|
532
526
|
var isKPIHasSmallestHeight = getIsKPIHasSmallestHeight();
|
|
533
|
-
return
|
|
527
|
+
return isKPIHasSmallestHeight;
|
|
534
528
|
};
|
|
535
529
|
|
|
536
530
|
return isLoading || !widget.current ? React__default.createElement("div", {
|
|
@@ -545,7 +539,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
545
539
|
})) : !error && widget.current ? React__default.createElement("div", {
|
|
546
540
|
key: triggerId,
|
|
547
541
|
onClick: kpiClick,
|
|
548
|
-
className: ((_widget$
|
|
542
|
+
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"
|
|
549
543
|
}, React__default.createElement("div", {
|
|
550
544
|
className: isKPICustomSizeNeeded ? "dl-kpi-container kpi-custom-size" : "dl-kpi-container"
|
|
551
545
|
}, getLabel(), getValueComponent(), getPreviousValueComponent())) : React__default.createElement("div", {
|
|
@@ -872,6 +866,70 @@ var CustomChart = function CustomChart(props) {
|
|
|
872
866
|
}, project()));
|
|
873
867
|
};
|
|
874
868
|
|
|
869
|
+
var DateGroupCodes = {
|
|
870
|
+
Full_Date: 'Full Date',
|
|
871
|
+
Month: 'Month',
|
|
872
|
+
Quarter: 'Quarter',
|
|
873
|
+
Year: 'Year',
|
|
874
|
+
Month_Year: 'Month & Year',
|
|
875
|
+
Quarter_Year: 'Quarter & Year'
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
var getDateFormat = function getDateFormat(label, _format) {
|
|
879
|
+
if (!label) return label;
|
|
880
|
+
|
|
881
|
+
var _date = moment(label);
|
|
882
|
+
|
|
883
|
+
if (!_date || !_date.isValid()) return label;
|
|
884
|
+
return _date.format(_format);
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
var getQuarterYearFormat = function getQuarterYearFormat(label) {
|
|
888
|
+
if (!label) return label;
|
|
889
|
+
|
|
890
|
+
if (label.includes("/")) {
|
|
891
|
+
var result = label.split("/");
|
|
892
|
+
var quarterVal = result && result[1] ? result[1] : "";
|
|
893
|
+
var yearVal = result && result[0] ? result[0] : "";
|
|
894
|
+
return quarterVal + " " + yearVal;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
return label;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
var getLabelFormatByDateGroupType = function getLabelFormatByDateGroupType(label, widget, isSecondGrouping) {
|
|
901
|
+
if (isSecondGrouping === void 0) {
|
|
902
|
+
isSecondGrouping = false;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
if (!widget) return label;
|
|
906
|
+
var groupFieldDataType = isSecondGrouping ? widget.SecondaryDateGroupCode : widget.DateGroupCode;
|
|
907
|
+
if (!groupFieldDataType) return label;
|
|
908
|
+
|
|
909
|
+
switch (groupFieldDataType) {
|
|
910
|
+
case DateGroupCodes.Full_Date:
|
|
911
|
+
return getDateFormat(label, "DD MMM YYYY");
|
|
912
|
+
|
|
913
|
+
case DateGroupCodes.Month:
|
|
914
|
+
return getDateFormat(label, "MMM");
|
|
915
|
+
|
|
916
|
+
case DateGroupCodes.Quarter:
|
|
917
|
+
return label;
|
|
918
|
+
|
|
919
|
+
case DateGroupCodes.Year:
|
|
920
|
+
return getDateFormat(label, "YYYY");
|
|
921
|
+
|
|
922
|
+
case DateGroupCodes.Month_Year:
|
|
923
|
+
return getDateFormat(label, "MMM YYYY");
|
|
924
|
+
|
|
925
|
+
case DateGroupCodes.Quarter_Year:
|
|
926
|
+
return getQuarterYearFormat(label);
|
|
927
|
+
|
|
928
|
+
default:
|
|
929
|
+
return label;
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
|
|
875
933
|
function buildToolTip(widget, value, seriesName, label, index) {
|
|
876
934
|
var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
|
|
877
935
|
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 ";
|