@evergis/react 4.0.114 → 4.0.115

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
@@ -3809,15 +3809,16 @@ const debounce = (callback, delay) => {
3809
3809
  const MILLION = 1000000;
3810
3810
  const TEN_THOUSANDS = 10000;
3811
3811
  const THOUSAND = 1000;
3812
- const FRACTION_DIGITS = 1;
3813
- const roundTotalSum = (value) => {
3812
+ const COMPACT_FRACTION_DIGITS = 1;
3813
+ const roundTotalSum = (value, fractionDigits) => {
3814
3814
  if (!value)
3815
3815
  return "";
3816
+ const digits = fractionDigits ?? COMPACT_FRACTION_DIGITS;
3816
3817
  if (value >= MILLION) {
3817
- return `${(value / MILLION).toFixed(FRACTION_DIGITS)}M`;
3818
+ return `${(value / MILLION).toFixed(digits)}M`;
3818
3819
  }
3819
3820
  if (value >= TEN_THOUSANDS) {
3820
- return `${(value / THOUSAND).toFixed(FRACTION_DIGITS)}K`;
3821
+ return `${(value / THOUSAND).toFixed(digits)}K`;
3821
3822
  }
3822
3823
  return value;
3823
3824
  };
@@ -3962,11 +3963,14 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
3962
3963
  if (scalingFactor) {
3963
3964
  currentValue *= scalingFactor;
3964
3965
  }
3965
- const compactValue = roundDigitGroup ? roundTotalSum(Number(currentValue)) : null;
3966
+ const hasRounding = !lodash.isNil(rounding);
3967
+ const compactValue = roundDigitGroup
3968
+ ? roundTotalSum(Number(currentValue), hasRounding ? rounding : undefined)
3969
+ : null;
3966
3970
  if (typeof compactValue === "string" && compactValue) {
3967
3971
  return appendUnitsLabel(compactValue, unitsLabel, noUnits);
3968
3972
  }
3969
- if ((rounding || rounding === 0) && (!isIntValue || (isIntValue && !isDefaultScaling))) {
3973
+ if (hasRounding && (!isIntValue || !isDefaultScaling)) {
3970
3974
  currentValue = currentValue && Number(currentValue).toFixed(rounding);
3971
3975
  }
3972
3976
  if (splitDigitGroup) {
@@ -15218,6 +15222,7 @@ exports.AttributeGalleryContainer = AttributeGalleryContainer;
15218
15222
  exports.AttributeLabel = AttributeLabel;
15219
15223
  exports.BASE_CONTAINER_STYLE = BASE_CONTAINER_STYLE;
15220
15224
  exports.CHART_TYPES = CHART_TYPES;
15225
+ exports.COMPACT_FRACTION_DIGITS = COMPACT_FRACTION_DIGITS;
15221
15226
  exports.CONFIG_PAGES_ID = CONFIG_PAGES_ID;
15222
15227
  exports.CONFIG_PAGE_ID = CONFIG_PAGE_ID;
15223
15228
  exports.CameraContainer = CameraContainer;