logitude-dashboard-library 3.1.12 → 3.1.13

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 CHANGED
@@ -322,7 +322,7 @@ var isNullOrUndefined = function isNullOrUndefined(val) {
322
322
  };
323
323
 
324
324
  var KpiChart = function KpiChart(props) {
325
- var _widget$current17;
325
+ var _widget$current18;
326
326
 
327
327
  var _useState = React.useState(true),
328
328
  isLoading = _useState[0],
@@ -413,8 +413,22 @@ var KpiChart = function KpiChart(props) {
413
413
  });
414
414
  };
415
415
 
416
+ var isComparisonIndicatorChecked = function isComparisonIndicatorChecked() {
417
+ var _widget$current5;
418
+
419
+ var _kpiSettings = (_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.KPIComparisonSettings;
420
+
421
+ if (_kpiSettings) {
422
+ var _kpiSettingsAsObj = JSON.parse(_kpiSettings);
423
+
424
+ return !isNullOrUndefined(_kpiSettingsAsObj.ComparisonIndicator) ? _kpiSettingsAsObj.ComparisonIndicator : false;
425
+ }
426
+
427
+ return false;
428
+ };
429
+
416
430
  function getRatioComponent() {
417
- if (!(data !== null && data !== void 0 && data.CompareWithPrevious)) return null;
431
+ if (!(data !== null && data !== void 0 && data.CompareWithPrevious) || !isComparisonIndicatorChecked()) return null;
418
432
  return React__default.createElement("div", {
419
433
  className: "dl-kpi-ratio-container"
420
434
  }, getArrowComponent(), React__default.createElement("div", {
@@ -423,7 +437,7 @@ var KpiChart = function KpiChart(props) {
423
437
  }
424
438
 
425
439
  function getArrowComponent() {
426
- var _widget$current5, _widget$current6, _widget$current7, _widget$current8, _widget$current9, _widget$current10, _widget$current11, _widget$current12;
440
+ var _widget$current6, _widget$current7, _widget$current8, _widget$current9, _widget$current10, _widget$current11, _widget$current12, _widget$current13;
427
441
 
428
442
  if (!data) return null;
429
443
  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", {
@@ -436,22 +450,22 @@ var KpiChart = function KpiChart(props) {
436
450
  marginTop: "2px"
437
451
  }
438
452
  }));
439
- 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", {
453
+ if ((data === null || data === void 0 ? void 0 : data.Ratio) > 1 && (_widget$current6 = widget.current) !== null && _widget$current6 !== void 0 && _widget$current6.Increase && ((_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.Increase) == "Positive") return React__default.createElement("div", {
440
454
  className: "dl-kpi-arrow-container"
441
455
  }, React__default.createElement("span", {
442
456
  className: "dl-kpi-arrow-pic dl-kpi-arrow-up-green"
443
457
  }));
444
- 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", {
458
+ if ((data === null || data === void 0 ? void 0 : data.Ratio) > 1 && (_widget$current8 = widget.current) !== null && _widget$current8 !== void 0 && _widget$current8.Increase && ((_widget$current9 = widget.current) === null || _widget$current9 === void 0 ? void 0 : _widget$current9.Increase) == "Negative") return React__default.createElement("div", {
445
459
  className: "dl-kpi-arrow-container"
446
460
  }, React__default.createElement("span", {
447
461
  className: "dl-kpi-arrow-pic dl-kpi-arrow-up-red"
448
462
  }));
449
- 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", {
463
+ if ((data === null || data === void 0 ? void 0 : data.Ratio) < 1 && (_widget$current10 = widget.current) !== null && _widget$current10 !== void 0 && _widget$current10.Increase && ((_widget$current11 = widget.current) === null || _widget$current11 === void 0 ? void 0 : _widget$current11.Increase) == "Positive") return React__default.createElement("div", {
450
464
  className: "dl-kpi-arrow-container"
451
465
  }, React__default.createElement("span", {
452
466
  className: "dl-kpi-arrow-pic dl-kpi-arrow-down-red"
453
467
  }));
454
- 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", {
468
+ if ((data === null || data === void 0 ? void 0 : data.Ratio) < 1 && (_widget$current12 = widget.current) !== null && _widget$current12 !== void 0 && _widget$current12.Increase && ((_widget$current13 = widget.current) === null || _widget$current13 === void 0 ? void 0 : _widget$current13.Increase) == "Negative") return React__default.createElement("div", {
455
469
  className: "dl-kpi-arrow-container"
456
470
  }, React__default.createElement("span", {
457
471
  className: "dl-kpi-arrow-pic dl-kpi-arrow-down-green"
@@ -508,11 +522,11 @@ var KpiChart = function KpiChart(props) {
508
522
  };
509
523
 
510
524
  var isKPICustomResizeNeeded = function isKPICustomResizeNeeded() {
511
- var _widget$current13, _widget$current14, _widget$current15, _widget$current16;
525
+ var _widget$current14, _widget$current15, _widget$current16, _widget$current17;
512
526
 
513
527
  if (!widget || !widget.current) return;
514
- 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;
515
- 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;
528
+ 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;
529
+ 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;
516
530
  var isKPIHasSmallestHeight = getIsKPIHasSmallestHeight();
517
531
  return isThereTitle && isThereSubTitle && isKPIHasSmallestHeight;
518
532
  };
@@ -529,7 +543,7 @@ var KpiChart = function KpiChart(props) {
529
543
  })) : !error && widget.current ? React__default.createElement("div", {
530
544
  key: triggerId,
531
545
  onClick: kpiClick,
532
- 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"
546
+ className: ((_widget$current18 = widget.current) === null || _widget$current18 === void 0 ? void 0 : _widget$current18.Alighnment) == "Left" ? "dl-kpi-container-click db-justify-content-flex-start" : "dl-kpi-container-click"
533
547
  }, React__default.createElement("div", {
534
548
  className: isKPICustomSizeNeeded ? "dl-kpi-container kpi-custom-size" : "dl-kpi-container"
535
549
  }, getLabel(), getValueComponent(), getPreviousValueComponent())) : React__default.createElement("div", {