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