logitude-dashboard-library 3.1.32 → 3.1.33

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.
@@ -85,6 +85,8 @@ export interface ChartInfo {
85
85
  drawCrossLine: string;
86
86
  palettecolors: string;
87
87
  plotHoverEffect: string;
88
+ numberSuffix: string | null;
89
+ sNumberSuffix: string | null;
88
90
  }
89
91
  export declare function getSeriesPositionColor(position: number): string | null;
90
92
  export declare function getSeriesHoverPositionColor(position: number): string | null;
package/dist/index.js CHANGED
@@ -429,7 +429,7 @@ var KpiChart = function KpiChart(props) {
429
429
  fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
430
430
  },
431
431
  className: "dl-kpi-prev-text"
432
- }, comparisonValue), (data === null || data === void 0 ? void 0 : data.ComparisonAbbreviationSymbol) && React__default.createElement("div", {
432
+ }, "" + comparisonValue + (isPercentageMeasureField() ? "%" : "")), (data === null || data === void 0 ? void 0 : data.ComparisonAbbreviationSymbol) && React__default.createElement("div", {
433
433
  style: {
434
434
  color: getKPIFormattingPropertyValue("ComparisonValueFontColor"),
435
435
  fontSize: getKPIFormattingPropertyValue("ComparisonValueFontSize", "px")
@@ -444,6 +444,10 @@ var KpiChart = function KpiChart(props) {
444
444
  }, data === null || data === void 0 ? void 0 : data.Unit));
445
445
  }
446
446
 
447
+ var isPercentageMeasureField = function isPercentageMeasureField() {
448
+ return (widget === null || widget === void 0 ? void 0 : widget.current) && (widget === null || widget === void 0 ? void 0 : widget.current.WidgetMeasures) && (widget === null || widget === void 0 ? void 0 : widget.current.WidgetMeasures[0]) && (widget === null || widget === void 0 ? void 0 : widget.current.WidgetMeasures[0].MeasureFieldDataType) && (widget === null || widget === void 0 ? void 0 : widget.current.WidgetMeasures[0].MeasureFieldDataType) == 'Percentage';
449
+ };
450
+
447
451
  function getValueData() {
448
452
  if ((data === null || data === void 0 ? void 0 : data.Value) == null) return React__default.createElement("div", {
449
453
  className: "dl-kpi-no-data"
@@ -454,7 +458,7 @@ var KpiChart = function KpiChart(props) {
454
458
  fontSize: getKPIFormattingPropertyValue("MainValueFontSize", "px")
455
459
  },
456
460
  className: "dl-kpi-value dl-kpi-textTrimming"
457
- }, data === null || data === void 0 ? void 0 : data.Value);
461
+ }, "" + (data === null || data === void 0 ? void 0 : data.Value) + (isPercentageMeasureField() ? "%" : ""));
458
462
  }
459
463
 
460
464
  function getValueComponent() {
@@ -832,8 +836,9 @@ var TableChart = function TableChart(props) {
832
836
  }
833
837
 
834
838
  var tableFormattingData = getTableConditionalRulesData();
839
+ var columnType = column.IsCalculatedColumn ? "CalculatedColumn" : "Field";
835
840
  var columnData = tableFormattingData.find(function (el) {
836
- return el.FieldId == column.Id;
841
+ return el.FieldId == column.Id && el.FieldType == columnType;
837
842
  });
838
843
 
839
844
  if (!columnData || !columnData.FieldRules || columnData.FieldRules.length == 0) {
@@ -851,7 +856,7 @@ var TableChart = function TableChart(props) {
851
856
  };
852
857
 
853
858
  var getCellFloatAlignment = function getCellFloatAlignment(column) {
854
- if (column.DataTypeCode == 'Decimal' || column.DataTypeCode == 'Integer' || column.DataTypeCode == 'Double' || column.DataTypeCode == 'SigDouble') {
859
+ if (column.DataTypeCode == 'Decimal' || column.DataTypeCode == 'Percentage' || column.DataTypeCode == 'Integer' || column.DataTypeCode == 'Double' || column.DataTypeCode == 'SigDouble') {
855
860
  return "right";
856
861
  }
857
862
 
@@ -859,7 +864,7 @@ var TableChart = function TableChart(props) {
859
864
  };
860
865
 
861
866
  var cellTemplateBody = function cellTemplateBody(data, column) {
862
- var _data$column$FieldCod, _data$column$FieldCod2, _data$column$FieldCod3, _data$column$FieldCod4, _data$column$FieldCod5;
867
+ var _data$column$FieldCod, _data$column$FieldCod2, _data$column$FieldCod3, _data$column$FieldCod4, _data$column$FieldCod5, _data$column$FieldCod6, _data$column$FieldCod7;
863
868
 
864
869
  if (!column || !column.FieldCode) return "";
865
870
  return column.DataTypeCode == "DateTime" || column.DataTypeCode == "Date" ? React__default.createElement("span", {
@@ -878,7 +883,7 @@ var TableChart = function TableChart(props) {
878
883
  fontSize: getTableFormattingPropertyValue("TableCellFontSize", "px"),
879
884
  "float": getCellFloatAlignment(column)
880
885
  }
881
- }, (_data$column$FieldCod5 = data[column.FieldCode]) === null || _data$column$FieldCod5 === void 0 ? void 0 : _data$column$FieldCod5.Label);
886
+ }, column.DataTypeCode == "Percentage" ? (_data$column$FieldCod5 = data[column.FieldCode]) !== null && _data$column$FieldCod5 !== void 0 && _data$column$FieldCod5.Label ? ((_data$column$FieldCod6 = data[column.FieldCode]) === null || _data$column$FieldCod6 === void 0 ? void 0 : _data$column$FieldCod6.Label) + "%" : 0 + '%' : (_data$column$FieldCod7 = data[column.FieldCode]) === null || _data$column$FieldCod7 === void 0 ? void 0 : _data$column$FieldCod7.Label);
882
887
  };
883
888
 
884
889
  var headerTemplate = function headerTemplate(column) {
@@ -1048,7 +1053,7 @@ var getLabelFormatByDateGroupType = function getLabelFormatByDateGroupType(label
1048
1053
 
1049
1054
  function buildToolTip(widget, value, seriesName, label, index) {
1050
1055
  var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
1051
- 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 ";
1056
+ 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, seriesName) + "</p>\n " + getTooltipPercentage(widget) + " </div>\n </div>\n ";
1052
1057
  }
1053
1058
 
1054
1059
  function getTooltipPercentage(widget) {
@@ -1062,8 +1067,8 @@ function getTooltiplabel(value, seriesMeasure) {
1062
1067
  return '$label';
1063
1068
  }
1064
1069
 
1065
- function getTooltipValue(value) {
1066
- if (value) return value;
1070
+ function getTooltipValue(value, seriesMeasure) {
1071
+ if (!isNullOrUndefined(value)) return seriesMeasure && seriesMeasure.MeasureFieldDataType == 'Percentage' ? value + "%" : value;
1067
1072
  return '$dataValue';
1068
1073
  }
1069
1074
 
@@ -1465,6 +1470,14 @@ var isGroupByFieldDateTime = function isGroupByFieldDateTime(GroupByFieldDataTyp
1465
1470
  return GroupByFieldDataType == "DateTime" || GroupByFieldDataType == "Date";
1466
1471
  };
1467
1472
 
1473
+ var isFirstMeasureTypePercentage = function isFirstMeasureTypePercentage(widget) {
1474
+ return widget && widget.WidgetMeasures && widget.WidgetMeasures[0] && widget.WidgetMeasures[0].MeasureFieldDataType && widget.WidgetMeasures[0].MeasureFieldDataType == 'Percentage';
1475
+ };
1476
+
1477
+ var isSecondMeasureTypePercentage = function isSecondMeasureTypePercentage(widget) {
1478
+ return widget && widget.WidgetMeasures && widget.WidgetMeasures[1] && widget.WidgetMeasures[1].MeasureFieldDataType && widget.WidgetMeasures[1].MeasureFieldDataType == 'Percentage';
1479
+ };
1480
+
1468
1481
  function getColumnObject(seriesMeasures, widget) {
1469
1482
  var chart = getDefaultChartobject();
1470
1483
  chart.type = isGroupByFieldDateTime(widget.GroupByFieldDataType) ? "mscombi2D" : "scrollcombidy2d";
@@ -1551,6 +1564,7 @@ function getDefaultChartInfo(widget) {
1551
1564
  chart.minAngleForValue = "27";
1552
1565
  }
1553
1566
 
1567
+ chart.numberSuffix = isFirstMeasureTypePercentage(widget) ? "%" : null;
1554
1568
  chart.palettecolors = "#369CFB,#4AC76F,#F6CF33,#32C7C7,#935BE0,#FAAD14,#EE5F77,#5D62B5, #29C3BE, #F2726F, #FFC533, #62B58F, #BC95DF, #67CDF2";
1555
1569
  chart.enableSlicing = "0";
1556
1570
  chart.enableRotation = "0";
@@ -1621,6 +1635,7 @@ function setDualyAxis(chartInfo, widget, seriesMeasures) {
1621
1635
  chartInfo.showDivLineSecondaryValue = "1";
1622
1636
  chartInfo.pYAxisNameBorderPadding = 0;
1623
1637
  chartInfo.sYAxisNameBorderPadding = 0;
1638
+ chartInfo.sNumberSuffix = isSecondMeasureTypePercentage(widget) ? "%" : null;
1624
1639
  var textLength = Math.max(seriesMeasures[0].Name.length, seriesMeasures[1].Name.length);
1625
1640
  chartInfo.pYAxisName = getTitle((_seriesMeasures$ = seriesMeasures[0]) === null || _seriesMeasures$ === void 0 ? void 0 : _seriesMeasures$.Name, textLength);
1626
1641
  chartInfo.sYAxisname = getTitle((_seriesMeasures$2 = seriesMeasures[1]) === null || _seriesMeasures$2 === void 0 ? void 0 : _seriesMeasures$2.Name, textLength);