@evergis/react 3.1.27 → 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
  }
@@ -4512,7 +4512,7 @@ const Container = styled(Flex) `
4512
4512
  ${({ isMain, isColumn }) => (isMain || isColumn) &&
4513
4513
  css `
4514
4514
  > :not(:last-child) {
4515
- margin-bottom: 0.5rem;
4515
+ margin-bottom: 1.5rem;
4516
4516
  }
4517
4517
  `}
4518
4518
 
@@ -4526,8 +4526,7 @@ const Container = styled(Flex) `
4526
4526
  ${({ noBorders }) => noBorders && css `
4527
4527
  ${ContainerWrapper} {
4528
4528
  box-shadow: none;
4529
- padding-left: 0;
4530
- padding-right: 0;
4529
+ padding: 0;
4531
4530
  }
4532
4531
  `}
4533
4532
  `;
@@ -5959,7 +5958,7 @@ const ChartContainer = memo(({ elementConfig, isVisible, type, renderElement })
5959
5958
  const hasItems = !!data[0]?.items?.length;
5960
5959
  if (!loading && !hasItems && hideEmpty)
5961
5960
  return null;
5962
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxs(Container, { isColumn: true, children: [aliasElement && jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsx(ContainerValue, { column: !twoColumns, alignItems: "center", children: hasItems ? (jsxs(Fragment$1, { children: [jsx(ContainerChart, { children: renderElement({ id: "chart" }) }), jsx(ContainerLegend, { children: renderElement({ id: "legend" }) })] })) : (jsx(Fragment$1, { children: "\u2014" })) })] }))] }));
5961
+ return (jsxs(FlexSpan, { flexDirection: "column", children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxs(Container, { isColumn: true, children: [aliasElement && jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsx(ContainerValue, { column: !twoColumns, alignItems: "center", children: hasItems ? (jsxs(Fragment$1, { children: [jsx(ContainerChart, { children: renderElement({ id: "chart" }) }), jsx(ContainerLegend, { children: renderElement({ id: "legend" }) })] })) : (jsx(Fragment$1, { children: "\u2014" })) })] }))] }));
5963
5962
  });
5964
5963
 
5965
5964
  const PagesContainer = memo(({ type = WidgetType.Dashboard, noBorders }) => {
@@ -6470,7 +6469,7 @@ const RoundedBackgroundContainerWrapper = styled(Flex) `
6470
6469
 
6471
6470
  ${ContainerValue} {
6472
6471
  flex-direction: ${({ $inlineUnits }) => ($inlineUnits ? "row" : "column")};
6473
- justify-content: ${({ $big }) => ($big ? "flex-start" : "flex-end")};
6472
+ justify-content: ${({ $big }) => ($big ? "flex-start" : "center")};
6474
6473
  align-items: ${({ $inlineUnits }) => ($inlineUnits ? "center" : "flex-start")};
6475
6474
  line-height: 1;
6476
6475
  }
@@ -6486,6 +6485,7 @@ const RoundedBackgroundContainerWrapper = styled(Flex) `
6486
6485
 
6487
6486
  const ALIAS_DEFAULT_MAX_LENGTH = 28;
6488
6487
  const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderElement }) => {
6488
+ const { t } = useGlobalContext();
6489
6489
  const { dataSources } = useWidgetContext(type);
6490
6490
  const { attributes } = useRelatedDataSourceAttributes({
6491
6491
  type,
@@ -6499,7 +6499,14 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
6499
6499
  const aliasElement = children?.find(({ id }) => id === "alias");
6500
6500
  const unitsElement = children?.find(({ id }) => id === "units");
6501
6501
  const valueElement = children?.find(({ id }) => id === "value");
6502
- 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]);
6503
6510
  const color = useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6504
6511
  const renderIcon = useMemo(() => {
6505
6512
  if (!iconElement)
@@ -6767,6 +6774,7 @@ const Header = styled(Flex) `
6767
6774
  top: 0;
6768
6775
  flex-shrink: 0;
6769
6776
  overflow: hidden;
6777
+ width: 100%;
6770
6778
  padding: 0.5rem;
6771
6779
 
6772
6780
  ${HeaderContainer} {
@@ -6854,8 +6862,6 @@ const HeaderFontColorMixin$1 = css `
6854
6862
  }
6855
6863
  `;
6856
6864
  const HeaderWrapperMixin$1 = css `
6857
- padding: 0.5rem 0.5rem 0;
6858
-
6859
6865
  ${Header} {
6860
6866
  min-height: 5.25rem;
6861
6867
  }
@@ -6920,8 +6926,6 @@ const HeaderFontColorMixin = css `
6920
6926
  }
6921
6927
  `;
6922
6928
  const HeaderWrapperMixin = css `
6923
- padding: 0.5rem 0.5rem 0;
6924
-
6925
6929
  ${Header} {
6926
6930
  min-height: 5.25rem;
6927
6931
  }
@@ -6979,7 +6983,7 @@ const BigIconHeaderMixin = css `
6979
6983
  `;
6980
6984
  const IconHeaderWrapper = styled.div `
6981
6985
  ${Header} {
6982
- width: calc(100% + 3rem);
6986
+ width: calc(100% + 1.5rem);
6983
6987
  margin: -1.5rem -1.5rem 0 -1.5rem;
6984
6988
  padding: 1.5rem;
6985
6989
  border-top-left-radius: 0.5rem;