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