logitude-dashboard-library 3.2.23 → 3.2.24

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
@@ -736,14 +736,20 @@ var getGlobalNumberFormatting = function getGlobalNumberFormatting() {
736
736
 
737
737
  var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value, decimalDigitsCount) {
738
738
  if (decimalDigitsCount === void 0) {
739
- decimalDigitsCount = 20;
739
+ decimalDigitsCount = -1;
740
740
  }
741
741
 
742
742
  if (isNaN(value) || value == null || value == undefined) return value + "";
743
+ var decimalParts = value.toString().split(".");
744
+ var maxFractionDigits = decimalParts[1] ? decimalParts[1].length : 0;
745
+ decimalDigitsCount = decimalDigitsCount == -1 ? maxFractionDigits : decimalDigitsCount;
743
746
 
744
747
  var _numberSeparatorSettings = getGlobalNumberFormatting();
745
748
 
746
- var _val = value.toLocaleString('en-US', {
749
+ var factor = Math.pow(10, decimalDigitsCount);
750
+ var truncatedValue = Math.floor(value * factor) / factor;
751
+
752
+ var _val = truncatedValue.toLocaleString('en-US', {
747
753
  minimumFractionDigits: 0,
748
754
  maximumFractionDigits: decimalDigitsCount
749
755
  });
@@ -1822,11 +1828,29 @@ var PivotTable = React.forwardRef(function (props, comRef) {
1822
1828
  dataField: measure.PivotMeasureCode,
1823
1829
  area: 'data',
1824
1830
  dataType: 'number',
1825
- summaryType: 'sum',
1826
1831
  wordWrapEnabled: true,
1827
1832
  caption: measure.MeasureCode == 'Sum' && typeof measure.DisplayName == 'string' ? ConvertStringToPascalCaseHelper(measure.DisplayName.replace("Sum of ", "")) : ConvertStringToPascalCaseHelper(measure.DisplayName),
1833
+ summaryType: 'custom',
1834
+ calculateCustomSummary: function calculateCustomSummary(options) {
1835
+ if (options.summaryProcess == 'calculate') {
1836
+ var _value = !isNullOrUndefinedOrEmpty(options.value) ? options.value : 0;
1837
+
1838
+ var decimalParts = _value.toString().split(".");
1839
+
1840
+ var firstPart = decimalParts[0] ? decimalParts[0] : 0;
1841
+ var secondPart = decimalParts[1] ? decimalParts[1] : 0;
1842
+ secondPart = secondPart.toString().substr(0, 2);
1843
+
1844
+ var _finalVal = firstPart + "." + secondPart;
1845
+
1846
+ options.value = Number(_finalVal);
1847
+ options.totalValue = (!isNullOrUndefinedOrEmpty(options.totalValue) ? options.totalValue : 0) + options.value;
1848
+ }
1849
+ },
1828
1850
  format: function format(value) {
1829
- return getNumberInSystemLocalFormat(value);
1851
+ var _value = isNullOrUndefinedOrEmpty(value) ? 0 : value;
1852
+
1853
+ return getNumberInSystemLocalFormat(_value, 2);
1830
1854
  }
1831
1855
  };
1832
1856
  });