@evergis/react 4.0.113 → 4.0.114
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/components/Dashboard/types.d.ts +4 -3
- package/dist/components/Dashboard/utils/index.d.ts +0 -1
- package/dist/index.js +23 -21
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +23 -21
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/format.d.ts +9 -1
- package/dist/utils/index.d.ts +1 -0
- package/package.json +2 -2
- /package/dist/{components/Dashboard/utils → utils}/roundTotalSum.d.ts +0 -0
package/dist/react.esm.js
CHANGED
|
@@ -3804,6 +3804,22 @@ const debounce = (callback, delay) => {
|
|
|
3804
3804
|
};
|
|
3805
3805
|
};
|
|
3806
3806
|
|
|
3807
|
+
const MILLION = 1000000;
|
|
3808
|
+
const TEN_THOUSANDS = 10000;
|
|
3809
|
+
const THOUSAND = 1000;
|
|
3810
|
+
const FRACTION_DIGITS = 1;
|
|
3811
|
+
const roundTotalSum = (value) => {
|
|
3812
|
+
if (!value)
|
|
3813
|
+
return "";
|
|
3814
|
+
if (value >= MILLION) {
|
|
3815
|
+
return `${(value / MILLION).toFixed(FRACTION_DIGITS)}M`;
|
|
3816
|
+
}
|
|
3817
|
+
if (value >= TEN_THOUSANDS) {
|
|
3818
|
+
return `${(value / THOUSAND).toFixed(FRACTION_DIGITS)}K`;
|
|
3819
|
+
}
|
|
3820
|
+
return value;
|
|
3821
|
+
};
|
|
3822
|
+
|
|
3807
3823
|
const TIME_ZONE_FORMAT = ' "GMT"z'; // eslint-disable-line
|
|
3808
3824
|
var ScalingFactor;
|
|
3809
3825
|
(function (ScalingFactor) {
|
|
@@ -3932,8 +3948,9 @@ const formatDateValue = (stringFormat, dateValue) => {
|
|
|
3932
3948
|
const timeFormat = (timeOptionValue && format(value, showTimeZone ? `${timeOptionValue} zz` : timeOptionValue)) || "";
|
|
3933
3949
|
return dateFormat ? `${dateFormat} ${timeFormat}` : "";
|
|
3934
3950
|
};
|
|
3951
|
+
const appendUnitsLabel = (value, unitsLabel, noUnits) => (unitsLabel && !noUnits ? `${value} ${unitsLabel}` : value)?.toString() || "";
|
|
3935
3952
|
const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
|
|
3936
|
-
const { scalingFactor, rounding, splitDigitGroup, unitsLabel } = stringFormat || {};
|
|
3953
|
+
const { scalingFactor, rounding, splitDigitGroup, roundDigitGroup, unitsLabel } = stringFormat || {};
|
|
3937
3954
|
const isIntValue = [AttributeType.Int32, AttributeType.Int64].includes(type);
|
|
3938
3955
|
const isDefaultScaling = stringFormat && stringFormat.scalingFactor === +numberOptions[0].value;
|
|
3939
3956
|
let currentValue = value;
|
|
@@ -3943,6 +3960,10 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
|
|
|
3943
3960
|
if (scalingFactor) {
|
|
3944
3961
|
currentValue *= scalingFactor;
|
|
3945
3962
|
}
|
|
3963
|
+
const compactValue = roundDigitGroup ? roundTotalSum(Number(currentValue)) : null;
|
|
3964
|
+
if (typeof compactValue === "string" && compactValue) {
|
|
3965
|
+
return appendUnitsLabel(compactValue, unitsLabel, noUnits);
|
|
3966
|
+
}
|
|
3946
3967
|
if ((rounding || rounding === 0) && (!isIntValue || (isIntValue && !isDefaultScaling))) {
|
|
3947
3968
|
currentValue = currentValue && Number(currentValue).toFixed(rounding);
|
|
3948
3969
|
}
|
|
@@ -3952,10 +3973,7 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
|
|
|
3952
3973
|
if (currentValue) {
|
|
3953
3974
|
currentValue = currentValue.toString().replace(".", ",");
|
|
3954
3975
|
}
|
|
3955
|
-
|
|
3956
|
-
currentValue = `${currentValue} ${unitsLabel}`;
|
|
3957
|
-
}
|
|
3958
|
-
return currentValue?.toString() || "";
|
|
3976
|
+
return appendUnitsLabel(currentValue, unitsLabel, noUnits);
|
|
3959
3977
|
};
|
|
3960
3978
|
const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false }) => {
|
|
3961
3979
|
const isNilValue = isNil(value);
|
|
@@ -14175,22 +14193,6 @@ const removeDataSource = (dashboardConfiguration, name, pageIndex) => {
|
|
|
14175
14193
|
return newConfig;
|
|
14176
14194
|
};
|
|
14177
14195
|
|
|
14178
|
-
const BILLION = 1000000;
|
|
14179
|
-
const TEN_THOUSANDS = 10000;
|
|
14180
|
-
const THOUSAND = 1000;
|
|
14181
|
-
const FRACTION_DIGITS = 1;
|
|
14182
|
-
const roundTotalSum = (value) => {
|
|
14183
|
-
if (!value)
|
|
14184
|
-
return "";
|
|
14185
|
-
if (value >= BILLION) {
|
|
14186
|
-
return `${(value / BILLION).toFixed(FRACTION_DIGITS)}M`;
|
|
14187
|
-
}
|
|
14188
|
-
if (value >= TEN_THOUSANDS) {
|
|
14189
|
-
return `${(value / THOUSAND).toFixed(FRACTION_DIGITS)}K`;
|
|
14190
|
-
}
|
|
14191
|
-
return value;
|
|
14192
|
-
};
|
|
14193
|
-
|
|
14194
14196
|
const updateDataSource = (dashboardConfiguration, name, pageIndex, data) => {
|
|
14195
14197
|
const newConfig = JSON.parse(JSON.stringify(dashboardConfiguration));
|
|
14196
14198
|
if (newConfig.dataSources?.length) {
|