@evergis/react 3.1.13 → 3.1.14

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
@@ -5265,7 +5265,7 @@ const getAttributeValue = (element, attributes) => {
5265
5265
  return jsxRuntime.jsx(DashboardCheckbox, { title: attribute.alias || attribute.name, checked: attribute.value });
5266
5266
  }
5267
5267
  if (Array.isArray(element?.attributeName)) {
5268
- const concatAttributes = element.attributeName.map((attributeName) => attributes.find(({ name }) => name === attributeName)?.value || "");
5268
+ const concatAttributes = element.attributeName.map((attributeName) => attributes?.find(({ name }) => name === attributeName)?.value || "");
5269
5269
  value = concatAttributes.join(separator || ", ");
5270
5270
  }
5271
5271
  else {
@@ -5604,7 +5604,7 @@ const ProgressContainer = react.memo(({ type, elementConfig, feature, maxValue,
5604
5604
  }), [renderElement]);
5605
5605
  const renderTooltip = react.useMemo(() => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ProgressTooltipAlias, { children: renderTooltipAlias }), jsxRuntime.jsxs(ProgressTooltipValueContainer, { children: [jsxRuntime.jsx(ProgressTooltipValue, { children: renderTooltipValue }), jsxRuntime.jsx(ProgressTooltipValueOf, { children: t("of", { ns: "dashboard" }) }), jsxRuntime.jsx("div", { children: formatAttributeValue({ t, type: valueType, value: currentMaxValue, stringFormat }) })] })] })), [currentMaxValue, renderTooltipAlias, renderTooltipValue, stringFormat, t, valueType]);
5606
5606
  const color = react.useMemo(() => colorAttribute
5607
- ? attributes.find(({ name }) => name === colorAttribute)?.value
5607
+ ? attributes?.find(({ name }) => name === colorAttribute)?.value
5608
5608
  : colors?.[index] || bgColor, [attributes, bgColor, colorAttribute, colors, index]);
5609
5609
  return (jsxRuntime.jsx(uilibGl.Tooltip, { content: renderTooltip, placement: "top", arrow: true, children: ref => (jsxRuntime.jsxs(ProgressContainerWrapper, { ref: ref, style: innerTemplateStyle || style, children: [renderIcon && jsxRuntime.jsx(ProgressIcon, { children: renderIcon }), jsxRuntime.jsxs(ProgressContent, { children: [!hideTitle && (jsxRuntime.jsxs(ProgressAlias, { children: [jsxRuntime.jsx("div", { children: renderAlias }), jsxRuntime.jsxs(ProgressValue, { children: [renderValue, unitsElement && jsxRuntime.jsx(ProgressUnits, { children: renderElement({ id: "units" }) })] })] })), jsxRuntime.jsxs(ProgressBarContainer, { innerValue: innerValue, children: [jsxRuntime.jsx(ProgressBarWrapper, { children: jsxRuntime.jsx(ProgressBar, { "$width": width, "$color": color }) }), !!(hideTitle || innerValue) && jsxRuntime.jsx(ProgressInnerValue, { children: renderValue })] })] })] })) }));
5610
5610
  });
@@ -6342,7 +6342,7 @@ const RoundedBackgroundContainer = react.memo(({ type, elementConfig, feature, r
6342
6342
  const unitsElement = children?.find(({ id }) => id === "units");
6343
6343
  const valueElement = children?.find(({ id }) => id === "value");
6344
6344
  const value = renderElement({ id: "value" });
6345
- const color = react.useMemo(() => attributes.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6345
+ const color = react.useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6346
6346
  if (!value && hideEmpty)
6347
6347
  return null;
6348
6348
  return (jsxRuntime.jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$bigIcon": bigIcon, children: [renderElement({ id: "icon", wrap: false }), jsxRuntime.jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsxRuntime.jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] }), jsxRuntime.jsx(ContainerAlias, { style: aliasElement?.style, children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })] }));
@@ -6531,7 +6531,7 @@ const ElementImage = react.memo(({ type, elementConfig }) => {
6531
6531
  if (!attributeName || Array.isArray(attributeName)) {
6532
6532
  return null;
6533
6533
  }
6534
- const attribute = attributes.find(item => item.name === attributeName);
6534
+ const attribute = attributes?.find(item => item.name === attributeName);
6535
6535
  return attribute?.value?.split(";")?.[0];
6536
6536
  }, [attributeName, attributes, value]);
6537
6537
  return firstImage ? jsxRuntime.jsx("img", { src: firstImage, alt: firstImage, width: width }) : null;
@@ -6733,7 +6733,7 @@ const ElementSlideshow = ({ elementConfig, type, renderElement }) => {
6733
6733
  ? dataSource.features.map(feature => feature.attributes[attributeName])
6734
6734
  : getSlideshowImages({
6735
6735
  element: elementConfig,
6736
- attribute: attributes.find(({ name }) => name === attributeName),
6736
+ attribute: attributes?.find(({ name }) => name === attributeName),
6737
6737
  });
6738
6738
  return (array?.map(image => ({
6739
6739
  src: image,
@@ -6774,7 +6774,7 @@ const ElementIcon = react.memo(({ type, elementConfig }) => {
6774
6774
  const { attributes } = useWidgetContext(type);
6775
6775
  const { value, attributeName, options } = elementConfig || {};
6776
6776
  const { fontSize, fontColor } = options || {};
6777
- const iconValue = react.useMemo(() => (attributeName ? attributes.find(item => item.name === attributeName)?.value : value), [attributeName, attributes, value]);
6777
+ const iconValue = react.useMemo(() => (attributeName ? attributes?.find(item => item.name === attributeName)?.value : value), [attributeName, attributes, value]);
6778
6778
  return jsxRuntime.jsx(StyledIcon, { kind: iconValue, fontSize: fontSize, fontColor: fontColor });
6779
6779
  });
6780
6780
 
@@ -7708,7 +7708,7 @@ const getFilterValue = ({ selectedFilters, configFilters, filterName, newValue,
7708
7708
  const getFormattedAttributes = (t, data, attributes, config) => {
7709
7709
  const showOtherItems = config?.options?.otherItems < data?.length;
7710
7710
  const otherIndex = config?.options?.otherItems + 1;
7711
- const otherAttribute = showOtherItems && config?.children?.[otherIndex]
7711
+ const otherAttribute = showOtherItems && config?.children?.[otherIndex] && attributes?.length
7712
7712
  ? attributes.find(({ name }) => name === config?.children?.[otherIndex]?.attributeName)
7713
7713
  : null;
7714
7714
  return otherAttribute
@@ -7819,7 +7819,7 @@ const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
7819
7819
  }
7820
7820
  else {
7821
7821
  url = elementConfig.attributeName
7822
- ? attributes.find(item => item.name === elementConfig.attributeName)?.value?.toString()
7822
+ ? attributes?.find(item => item.name === elementConfig.attributeName)?.value?.toString()
7823
7823
  : elementConfig.value?.toString();
7824
7824
  }
7825
7825
  if (!url || typeof url !== "string")
@@ -7829,7 +7829,7 @@ const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
7829
7829
 
7830
7830
  const getTotalFromAttributes = (children, attributes) => {
7831
7831
  const total = children?.reduce((result, { attributeName }) => {
7832
- const value = attributes.find(({ name }) => name === attributeName)?.value || 0;
7832
+ const value = attributes?.find(({ name }) => name === attributeName)?.value || 0;
7833
7833
  return result + value;
7834
7834
  }, 0);
7835
7835
  return typeof total === "number" ? total.toFixed(0) : "";
@@ -7840,7 +7840,7 @@ const getTotalFromRelatedFeatures = (data) => {
7840
7840
  };
7841
7841
 
7842
7842
  const pieChartTooltipFromAttributes = (t, data, attributes) => {
7843
- const attribute = attributes.find(({ name }) => name === data[0].name);
7843
+ const attribute = attributes?.find(({ name }) => name === data[0].name);
7844
7844
  const renderValue = attribute
7845
7845
  ? formatAttributeValue({ t, type: attribute.type, value: data[0].value, stringFormat: attribute.stringFormat })
7846
7846
  : data[0].value;
@@ -7894,7 +7894,7 @@ const sliceShownOtherItems = (data, options = {}, showMore) => {
7894
7894
  };
7895
7895
 
7896
7896
  const tooltipNameFromAttributes = (name, attributes) => {
7897
- const attribute = attributes.find(item => item.name === name);
7897
+ const attribute = attributes?.find(item => item.name === name);
7898
7898
  return attribute?.alias || name;
7899
7899
  };
7900
7900
 
@@ -8472,7 +8472,7 @@ const Chart = react.memo(({ config, element, elementConfig, type, renderElement
8472
8472
  ? getTotalFromRelatedFeatures((data[0]?.items || []))
8473
8473
  : getTotalFromAttributes(children, formattedAttributes), [data, children, formattedAttributes, isRelated]);
8474
8474
  const totalWord = react.useMemo(() => options?.totalAttribute
8475
- ? attributes.find(({ name }) => name === options.totalAttribute)?.value
8475
+ ? attributes?.find(({ name }) => name === options.totalAttribute)?.value
8476
8476
  : options?.totalWord, [attributes, options.totalAttribute, options?.totalWord]);
8477
8477
  const renderPieChartTooltip = react.useCallback(item => isRelated
8478
8478
  ? pieChartTooltipFromRelatedFeatures(t, item, relatedAttributes, data[0]?.layerInfo)
package/dist/react.esm.js CHANGED
@@ -5263,7 +5263,7 @@ const getAttributeValue = (element, attributes) => {
5263
5263
  return jsx(DashboardCheckbox, { title: attribute.alias || attribute.name, checked: attribute.value });
5264
5264
  }
5265
5265
  if (Array.isArray(element?.attributeName)) {
5266
- const concatAttributes = element.attributeName.map((attributeName) => attributes.find(({ name }) => name === attributeName)?.value || "");
5266
+ const concatAttributes = element.attributeName.map((attributeName) => attributes?.find(({ name }) => name === attributeName)?.value || "");
5267
5267
  value = concatAttributes.join(separator || ", ");
5268
5268
  }
5269
5269
  else {
@@ -5602,7 +5602,7 @@ const ProgressContainer = memo(({ type, elementConfig, feature, maxValue, index,
5602
5602
  }), [renderElement]);
5603
5603
  const renderTooltip = useMemo(() => (jsxs(Fragment$1, { children: [jsx(ProgressTooltipAlias, { children: renderTooltipAlias }), jsxs(ProgressTooltipValueContainer, { children: [jsx(ProgressTooltipValue, { children: renderTooltipValue }), jsx(ProgressTooltipValueOf, { children: t("of", { ns: "dashboard" }) }), jsx("div", { children: formatAttributeValue({ t, type: valueType, value: currentMaxValue, stringFormat }) })] })] })), [currentMaxValue, renderTooltipAlias, renderTooltipValue, stringFormat, t, valueType]);
5604
5604
  const color = useMemo(() => colorAttribute
5605
- ? attributes.find(({ name }) => name === colorAttribute)?.value
5605
+ ? attributes?.find(({ name }) => name === colorAttribute)?.value
5606
5606
  : colors?.[index] || bgColor, [attributes, bgColor, colorAttribute, colors, index]);
5607
5607
  return (jsx(Tooltip, { content: renderTooltip, placement: "top", arrow: true, children: ref => (jsxs(ProgressContainerWrapper, { ref: ref, style: innerTemplateStyle || style, children: [renderIcon && jsx(ProgressIcon, { children: renderIcon }), jsxs(ProgressContent, { children: [!hideTitle && (jsxs(ProgressAlias, { children: [jsx("div", { children: renderAlias }), jsxs(ProgressValue, { children: [renderValue, unitsElement && jsx(ProgressUnits, { children: renderElement({ id: "units" }) })] })] })), jsxs(ProgressBarContainer, { innerValue: innerValue, children: [jsx(ProgressBarWrapper, { children: jsx(ProgressBar, { "$width": width, "$color": color }) }), !!(hideTitle || innerValue) && jsx(ProgressInnerValue, { children: renderValue })] })] })] })) }));
5608
5608
  });
@@ -6340,7 +6340,7 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
6340
6340
  const unitsElement = children?.find(({ id }) => id === "units");
6341
6341
  const valueElement = children?.find(({ id }) => id === "value");
6342
6342
  const value = renderElement({ id: "value" });
6343
- const color = useMemo(() => attributes.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6343
+ const color = useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6344
6344
  if (!value && hideEmpty)
6345
6345
  return null;
6346
6346
  return (jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$bigIcon": bigIcon, children: [renderElement({ id: "icon", wrap: false }), jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] }), jsx(ContainerAlias, { style: aliasElement?.style, children: jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })] }));
@@ -6529,7 +6529,7 @@ const ElementImage = memo(({ type, elementConfig }) => {
6529
6529
  if (!attributeName || Array.isArray(attributeName)) {
6530
6530
  return null;
6531
6531
  }
6532
- const attribute = attributes.find(item => item.name === attributeName);
6532
+ const attribute = attributes?.find(item => item.name === attributeName);
6533
6533
  return attribute?.value?.split(";")?.[0];
6534
6534
  }, [attributeName, attributes, value]);
6535
6535
  return firstImage ? jsx("img", { src: firstImage, alt: firstImage, width: width }) : null;
@@ -6731,7 +6731,7 @@ const ElementSlideshow = ({ elementConfig, type, renderElement }) => {
6731
6731
  ? dataSource.features.map(feature => feature.attributes[attributeName])
6732
6732
  : getSlideshowImages({
6733
6733
  element: elementConfig,
6734
- attribute: attributes.find(({ name }) => name === attributeName),
6734
+ attribute: attributes?.find(({ name }) => name === attributeName),
6735
6735
  });
6736
6736
  return (array?.map(image => ({
6737
6737
  src: image,
@@ -6772,7 +6772,7 @@ const ElementIcon = memo(({ type, elementConfig }) => {
6772
6772
  const { attributes } = useWidgetContext(type);
6773
6773
  const { value, attributeName, options } = elementConfig || {};
6774
6774
  const { fontSize, fontColor } = options || {};
6775
- const iconValue = useMemo(() => (attributeName ? attributes.find(item => item.name === attributeName)?.value : value), [attributeName, attributes, value]);
6775
+ const iconValue = useMemo(() => (attributeName ? attributes?.find(item => item.name === attributeName)?.value : value), [attributeName, attributes, value]);
6776
6776
  return jsx(StyledIcon, { kind: iconValue, fontSize: fontSize, fontColor: fontColor });
6777
6777
  });
6778
6778
 
@@ -7706,7 +7706,7 @@ const getFilterValue = ({ selectedFilters, configFilters, filterName, newValue,
7706
7706
  const getFormattedAttributes = (t, data, attributes, config) => {
7707
7707
  const showOtherItems = config?.options?.otherItems < data?.length;
7708
7708
  const otherIndex = config?.options?.otherItems + 1;
7709
- const otherAttribute = showOtherItems && config?.children?.[otherIndex]
7709
+ const otherAttribute = showOtherItems && config?.children?.[otherIndex] && attributes?.length
7710
7710
  ? attributes.find(({ name }) => name === config?.children?.[otherIndex]?.attributeName)
7711
7711
  : null;
7712
7712
  return otherAttribute
@@ -7817,7 +7817,7 @@ const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
7817
7817
  }
7818
7818
  else {
7819
7819
  url = elementConfig.attributeName
7820
- ? attributes.find(item => item.name === elementConfig.attributeName)?.value?.toString()
7820
+ ? attributes?.find(item => item.name === elementConfig.attributeName)?.value?.toString()
7821
7821
  : elementConfig.value?.toString();
7822
7822
  }
7823
7823
  if (!url || typeof url !== "string")
@@ -7827,7 +7827,7 @@ const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
7827
7827
 
7828
7828
  const getTotalFromAttributes = (children, attributes) => {
7829
7829
  const total = children?.reduce((result, { attributeName }) => {
7830
- const value = attributes.find(({ name }) => name === attributeName)?.value || 0;
7830
+ const value = attributes?.find(({ name }) => name === attributeName)?.value || 0;
7831
7831
  return result + value;
7832
7832
  }, 0);
7833
7833
  return typeof total === "number" ? total.toFixed(0) : "";
@@ -7838,7 +7838,7 @@ const getTotalFromRelatedFeatures = (data) => {
7838
7838
  };
7839
7839
 
7840
7840
  const pieChartTooltipFromAttributes = (t, data, attributes) => {
7841
- const attribute = attributes.find(({ name }) => name === data[0].name);
7841
+ const attribute = attributes?.find(({ name }) => name === data[0].name);
7842
7842
  const renderValue = attribute
7843
7843
  ? formatAttributeValue({ t, type: attribute.type, value: data[0].value, stringFormat: attribute.stringFormat })
7844
7844
  : data[0].value;
@@ -7892,7 +7892,7 @@ const sliceShownOtherItems = (data, options = {}, showMore) => {
7892
7892
  };
7893
7893
 
7894
7894
  const tooltipNameFromAttributes = (name, attributes) => {
7895
- const attribute = attributes.find(item => item.name === name);
7895
+ const attribute = attributes?.find(item => item.name === name);
7896
7896
  return attribute?.alias || name;
7897
7897
  };
7898
7898
 
@@ -8470,7 +8470,7 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
8470
8470
  ? getTotalFromRelatedFeatures((data[0]?.items || []))
8471
8471
  : getTotalFromAttributes(children, formattedAttributes), [data, children, formattedAttributes, isRelated]);
8472
8472
  const totalWord = useMemo(() => options?.totalAttribute
8473
- ? attributes.find(({ name }) => name === options.totalAttribute)?.value
8473
+ ? attributes?.find(({ name }) => name === options.totalAttribute)?.value
8474
8474
  : options?.totalWord, [attributes, options.totalAttribute, options?.totalWord]);
8475
8475
  const renderPieChartTooltip = useCallback(item => isRelated
8476
8476
  ? pieChartTooltipFromRelatedFeatures(t, item, relatedAttributes, data[0]?.layerInfo)
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.1.13",
2
+ "version": "3.1.14",
3
3
  "name": "@evergis/react",
4
4
  "author": "Everpoint",
5
5
  "license": "MIT",
@@ -75,5 +75,5 @@
75
75
  "swiper": "^8.3.2",
76
76
  "wkt": "^0.1.1"
77
77
  },
78
- "gitHead": "6c2eaf73a5d2ff6efdd174e50235d5733842d7ad"
78
+ "gitHead": "bfdac339ad7a29bb88ad02ecc65dc82fa749233b"
79
79
  }