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