@evergis/react 4.0.72 → 4.0.74

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
@@ -8964,6 +8964,11 @@ const OverlayHeaderMixin = (overlay) => css `
8964
8964
  }
8965
8965
  }
8966
8966
  `;
8967
+ const NoFeatureHeaderMixin = css `
8968
+ &&& {
8969
+ min-height: 5.5rem;
8970
+ }
8971
+ `;
8967
8972
  const Header = styled(Flex) `
8968
8973
  z-index: 1;
8969
8974
  position: relative;
@@ -8976,6 +8981,8 @@ const Header = styled(Flex) `
8976
8981
  ${({ $isRow }) => $isRow && RowHeaderMixin};
8977
8982
 
8978
8983
  ${({ $overlay }) => $overlay && OverlayHeaderMixin($overlay)};
8984
+
8985
+ ${({ $noFeature }) => $noFeature && NoFeatureHeaderMixin};
8979
8986
  `;
8980
8987
  const DefaultHeaderWrapper = styled.div `
8981
8988
  width: ${({ withPadding }) => (withPadding ? "100%" : "calc(100% + 1rem)")};
@@ -8984,6 +8991,12 @@ const DefaultHeaderWrapper = styled.div `
8984
8991
  background: url(${img$4}) 50% -2rem no-repeat;
8985
8992
  border-radius: ${({ theme: { borderRadius } }) => borderRadius.medium};
8986
8993
 
8994
+ ${({ $noFeature }) => $noFeature &&
8995
+ css `
8996
+ background-position: center;
8997
+ background-size: cover;
8998
+ `};
8999
+
8987
9000
  ${({ fontColor }) => !!fontColor && HeaderFontColorMixin};
8988
9001
  `;
8989
9002
 
@@ -8992,7 +9005,9 @@ const HeaderTitle = ({ noFeature }) => {
8992
9005
  const { attributes, layerInfo, feature } = useWidgetContext(WidgetType.FeatureCard);
8993
9006
  const zoomToFeatures = useZoomToFeatures();
8994
9007
  const { configuration } = layerInfo || {};
8995
- const resultDescription = configuration?.alias || configuration?.name || "";
9008
+ const resultDescription = noFeature
9009
+ ? t("allLayers", { ns: "dashboard", defaultValue: "Все слои" })
9010
+ : configuration?.alias || configuration?.name || "";
8996
9011
  const resultTitle = useMemo(() => {
8997
9012
  const layerDefinitionAttribute = configuration && attributes?.length
8998
9013
  ? attributes.find(item => item.attributeName === configuration?.attributesConfiguration?.titleAttribute)
@@ -9073,14 +9088,32 @@ const LayerIconClickable = styled.div `
9073
9088
  align-items: center;
9074
9089
  cursor: pointer;
9075
9090
  `;
9091
+ const NoFeatureIcon = styled.div `
9092
+ display: flex;
9093
+ align-items: center;
9094
+ justify-content: center;
9095
+ min-width: 1.5rem;
9096
+ height: 1.5rem;
9097
+ margin-top: 0.25rem;
9098
+ margin-right: 1rem;
9099
+ margin-left: 0.25rem;
9100
+
9101
+ ${Icon}::after {
9102
+ font-size: 1.5rem;
9103
+ color: ${({ theme: { palette } }) => palette.iconDisabled};
9104
+ }
9105
+ `;
9076
9106
 
9077
- const HeaderLayerIcon = () => {
9107
+ const HeaderLayerIcon = ({ noFeature }) => {
9078
9108
  const { t } = useGlobalContext();
9079
9109
  const { layerInfo, feature } = useWidgetContext(WidgetType.FeatureCard);
9080
9110
  const zoomToFeatures = useZoomToFeatures();
9081
9111
  const getMaxZoomTo = useMaxZoomTo();
9082
9112
  const [optionsMaxZoomTo, layerMaxZoomTo] = useMemo(() => getMaxZoomTo(layerInfo?.name), [layerInfo?.name, getMaxZoomTo]);
9083
9113
  const handleIconClick = useCallback(() => zoomToFeatures([feature], { maxZoom: layerMaxZoomTo ?? optionsMaxZoomTo }), [zoomToFeatures, feature, layerMaxZoomTo, optionsMaxZoomTo]);
9114
+ if (noFeature) {
9115
+ return (jsx(NoFeatureIcon, { children: jsx(Icon, { kind: "no_geom" }) }));
9116
+ }
9084
9117
  return (jsx(LayerIconClickable, { onClick: handleIconClick, children: jsx(Tooltip$1, { arrow: true, placement: "top", content: t("zoomToFeature", { ns: "dashboard", defaultValue: "Приблизить к объекту" }), delay: [600, 0], children: ref => (jsx(LayerIcon, { innerRef: ref, layerInfo: layerInfo })) }) }));
9085
9118
  };
9086
9119
 
@@ -9089,7 +9122,7 @@ const FeatureCardDefaultHeader = ({ noFeature }) => {
9089
9122
  const { header } = config || {};
9090
9123
  const { options } = header || {};
9091
9124
  const { themeName, withPadding, column, height, overlay } = options || {};
9092
- return (jsx(DefaultHeaderWrapper, { withPadding: withPadding, height: height, children: jsx(ThemeProvider, { theme: getThemeByName(themeName), children: jsx(Header, { "$overlay": overlay, "$isRow": !column, children: jsxs(HeaderFrontView, { isDefault: !column, children: [jsxs(HeaderContainer, { children: [jsx(HeaderLayerIcon, {}), jsx(HeaderTitle, { noFeature: noFeature })] }), jsx(FeatureCardButtons, {})] }) }) }) }));
9125
+ return (jsx(DefaultHeaderWrapper, { withPadding: withPadding, height: height, "$noFeature": noFeature, children: jsx(ThemeProvider, { theme: getThemeByName(themeName), children: jsx(Header, { "$overlay": overlay, "$isRow": !column, "$noFeature": noFeature, children: jsxs(HeaderFrontView, { isDefault: !column, children: [jsxs(HeaderContainer, { children: [jsx(HeaderLayerIcon, { noFeature: noFeature }), jsx(HeaderTitle, { noFeature: noFeature })] }), jsx(FeatureCardButtons, {})] }) }) }) }));
9093
9126
  };
9094
9127
 
9095
9128
  const ImageContainerButton = styled(FlatButton) `
@@ -12183,12 +12216,16 @@ const useChartData = ({ element, type }) => {
12183
12216
  layerInfos,
12184
12217
  dataSources,
12185
12218
  ]);
12219
+ const isResolved = useMemo(() => !relatedAttributes?.length ||
12220
+ relatedAttributes
12221
+ .filter(({ chartAxis }) => chartAxis === "y")
12222
+ .every(({ dataSourceName }) => Array.isArray(getDataSource(dataSourceName, dataSources)?.features)), [relatedAttributes, dataSources]);
12186
12223
  const [data, setData] = useState(fetchedData);
12187
12224
  useEffect(() => {
12188
- if (!loading) {
12225
+ if (!loading && (fetchedData?.length || isResolved)) {
12189
12226
  setData(fetchedData);
12190
12227
  }
12191
- }, [loading, fetchedData]);
12228
+ }, [loading, fetchedData, isResolved]);
12192
12229
  return { data, loading };
12193
12230
  };
12194
12231