@evergis/react 3.1.28 → 3.1.29

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/react.esm.js CHANGED
@@ -3729,7 +3729,7 @@ const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false })
3729
3729
  return formatDateValue(stringFormat, value);
3730
3730
  }
3731
3731
  if (numberFormatTypes.includes(type) && !isNaN(value)) {
3732
- if (!stringFormat?.format)
3732
+ if (!stringFormat)
3733
3733
  return value.toString();
3734
3734
  return formatNumberValue(stringFormat, value, type, noUnits);
3735
3735
  }
@@ -6485,6 +6485,7 @@ const RoundedBackgroundContainerWrapper = styled(Flex) `
6485
6485
 
6486
6486
  const ALIAS_DEFAULT_MAX_LENGTH = 28;
6487
6487
  const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderElement }) => {
6488
+ const { t } = useGlobalContext();
6488
6489
  const { dataSources } = useWidgetContext(type);
6489
6490
  const { attributes } = useRelatedDataSourceAttributes({
6490
6491
  type,
@@ -6498,7 +6499,14 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
6498
6499
  const aliasElement = children?.find(({ id }) => id === "alias");
6499
6500
  const unitsElement = children?.find(({ id }) => id === "units");
6500
6501
  const valueElement = children?.find(({ id }) => id === "value");
6501
- const value = renderElement({ id: "value" });
6502
+ const attribute = useMemo(() => attributes.find(({ name }) => name === valueElement.attributeName), [attributes, valueElement.attributeName]);
6503
+ const value = useMemo(() => formatAttributeValue({
6504
+ t,
6505
+ type: attribute.type,
6506
+ value: attribute.value,
6507
+ stringFormat: attribute.stringFormat,
6508
+ noUnits: valueElement.options?.noUnits,
6509
+ }), [t, attribute, valueElement.options?.noUnits]);
6502
6510
  const color = useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6503
6511
  const renderIcon = useMemo(() => {
6504
6512
  if (!iconElement)