@evergis/react 3.1.129-alpha.2 → 3.1.129-alpha.4
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/utils/getAttributesConfiguration.d.ts +2 -2
- package/dist/components/Dashboard/utils/getLayerInfo.d.ts +2 -4
- package/dist/index.js +46 -35
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +46 -35
- package/dist/react.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/react.esm.js
CHANGED
|
@@ -3472,7 +3472,7 @@ const StackBarSection = styled.div `
|
|
|
3472
3472
|
margin: 0 0.5px;
|
|
3473
3473
|
background-color: ${({ $color }) => $color};
|
|
3474
3474
|
opacity: ${({ hasAnyFilter, isFiltered }) => (isFiltered ? 1 : hasAnyFilter ? FILTERED_VALUE_OPACITY / 100 : 1)};
|
|
3475
|
-
transition: opacity ${transition.release};
|
|
3475
|
+
transition: opacity ${transition.release}, background-color ${transition.release};
|
|
3476
3476
|
|
|
3477
3477
|
:first-child {
|
|
3478
3478
|
border-top-left-radius: ${({ cornerRadius }) => (cornerRadius ? `${cornerRadius}px` : "0.5rem")};
|
|
@@ -4424,7 +4424,7 @@ const getAttributesConfiguration = (layer) => {
|
|
|
4424
4424
|
const configuration = layer?.configuration ??
|
|
4425
4425
|
{};
|
|
4426
4426
|
const emptyAttributesConfiguration = {
|
|
4427
|
-
geometryAttribute: layer?.geometryType === OgcGeometryType.Unknown
|
|
4427
|
+
geometryAttribute: layer?.layerDefinition?.geometryType === OgcGeometryType.Unknown
|
|
4428
4428
|
? undefined
|
|
4429
4429
|
: GEOMETRY_ATTRIBUTE,
|
|
4430
4430
|
idAttribute: DEFAULT_ID_ATTRIBUTE_NAME,
|
|
@@ -4435,8 +4435,7 @@ const getAttributesConfiguration = (layer) => {
|
|
|
4435
4435
|
}
|
|
4436
4436
|
return {
|
|
4437
4437
|
...emptyAttributesConfiguration,
|
|
4438
|
-
...(configuration
|
|
4439
|
-
.attributesConfiguration || {}),
|
|
4438
|
+
...(configuration.attributesConfiguration || {}),
|
|
4440
4439
|
};
|
|
4441
4440
|
};
|
|
4442
4441
|
|
|
@@ -7809,8 +7808,8 @@ const HeaderTitle = ({ noFeature }) => {
|
|
|
7809
7808
|
const { t } = useGlobalContext();
|
|
7810
7809
|
const { attributes, layerInfo, feature } = useWidgetContext(WidgetType.FeatureCard);
|
|
7811
7810
|
const zoomToFeatures = useZoomToFeatures();
|
|
7812
|
-
const {
|
|
7813
|
-
const resultDescription = alias || name || "";
|
|
7811
|
+
const { configuration, layerDefinition } = layerInfo || {};
|
|
7812
|
+
const resultDescription = configuration?.alias || configuration?.name || "";
|
|
7814
7813
|
const resultTitle = useMemo(() => {
|
|
7815
7814
|
const layerDefinitionAttribute = layerDefinition && attributes?.length
|
|
7816
7815
|
? attributes.find(item => item.name === layerDefinition.titleAttribute)
|
|
@@ -7858,10 +7857,10 @@ var img = "data:image/svg+xml,%3csvg width='32' height='32' viewBox='0 0 32 32'
|
|
|
7858
7857
|
|
|
7859
7858
|
const LayerIcon = ({ layerInfo, error }) => {
|
|
7860
7859
|
const renderSymbol = useMemo(() => {
|
|
7861
|
-
if (!layerInfo
|
|
7860
|
+
if (!layerInfo?.layerDefinition?.geometryType || error) {
|
|
7862
7861
|
return (jsx(AlertIconContainer, { children: jsx(Icon, { kind: "warning" }) }));
|
|
7863
7862
|
}
|
|
7864
|
-
switch (layerInfo
|
|
7863
|
+
switch (layerInfo?.layerDefinition?.geometryType) {
|
|
7865
7864
|
case OgcGeometryType.MultiLineString:
|
|
7866
7865
|
return jsx("img", { src: img$1, alt: "" });
|
|
7867
7866
|
case OgcGeometryType.Polygon:
|
|
@@ -7871,7 +7870,7 @@ const LayerIcon = ({ layerInfo, error }) => {
|
|
|
7871
7870
|
default:
|
|
7872
7871
|
return jsx("img", { src: img$2, alt: "" });
|
|
7873
7872
|
}
|
|
7874
|
-
}, [layerInfo
|
|
7873
|
+
}, [layerInfo?.layerDefinition?.geometryType]);
|
|
7875
7874
|
return jsx(LayerIconContainer, { children: renderSymbol });
|
|
7876
7875
|
};
|
|
7877
7876
|
|
|
@@ -10172,21 +10171,21 @@ const getProxyService = (layer) => {
|
|
|
10172
10171
|
if (!isProxyService(layer))
|
|
10173
10172
|
return {
|
|
10174
10173
|
layers: [],
|
|
10175
|
-
sourceType: "",
|
|
10176
10174
|
sourceUrl: "",
|
|
10177
|
-
|
|
10175
|
+
sourceType: "",
|
|
10176
|
+
layerDefinition: layer?.layerDefinition,
|
|
10178
10177
|
legend: {
|
|
10179
10178
|
layers: [],
|
|
10180
10179
|
},
|
|
10181
10180
|
};
|
|
10182
|
-
const { layers, sourceType, sourceUrl, legend,
|
|
10181
|
+
const { layers, sourceType, sourceUrl, legend, layerDefinition } = layer;
|
|
10183
10182
|
return {
|
|
10184
10183
|
layers: layers || [],
|
|
10185
|
-
copyrightText: copyrightText || "",
|
|
10186
10184
|
sourceUrl: sourceUrl || "",
|
|
10187
10185
|
sourceType: sourceType || "",
|
|
10186
|
+
layerDefinition,
|
|
10188
10187
|
legend: {
|
|
10189
|
-
layers:
|
|
10188
|
+
layers: legend?.layers || [],
|
|
10190
10189
|
},
|
|
10191
10190
|
};
|
|
10192
10191
|
};
|
|
@@ -11088,8 +11087,9 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11088
11087
|
const isRelated = !!relatedAttributes?.length;
|
|
11089
11088
|
const { data, loading } = useChartData({ element, type });
|
|
11090
11089
|
const totalWidthFromBarWidth = (data[0]?.items?.length || 0) * (barWidth + padding);
|
|
11091
|
-
const width = options?.width
|
|
11092
|
-
|
|
11090
|
+
const width = options?.width
|
|
11091
|
+
? options.width
|
|
11092
|
+
: isStackBar
|
|
11093
11093
|
? "100%"
|
|
11094
11094
|
: isBarChart
|
|
11095
11095
|
? totalWidthFromBarWidth || MAX_CHART_WIDTH
|
|
@@ -11111,21 +11111,24 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11111
11111
|
? getTotalFromRelatedFeatures((data[0]?.items || []))
|
|
11112
11112
|
: getTotalFromAttributes(children, formattedAttributes), [data, children, formattedAttributes, isRelated]);
|
|
11113
11113
|
const totalWord = useMemo(() => totalAttribute
|
|
11114
|
-
? attributes?.find(({ name }) => name === totalAttribute)
|
|
11114
|
+
? attributes?.find(({ name }) => name === totalAttribute)
|
|
11115
|
+
?.value
|
|
11115
11116
|
: configTotalWord, [attributes, totalAttribute, configTotalWord]);
|
|
11116
11117
|
const renderPieChartTooltip = useCallback(item => isRelated
|
|
11117
11118
|
? pieChartTooltipFromRelatedFeatures(t, item, relatedAttributes, data[0]?.layerInfo)
|
|
11118
|
-
: pieChartTooltipFromAttributes(t, item, formattedAttributes), [data, formattedAttributes, isRelated, relatedAttributes]);
|
|
11119
|
+
: pieChartTooltipFromAttributes(t, item, formattedAttributes), [data, formattedAttributes, isRelated, relatedAttributes, t]);
|
|
11119
11120
|
const labels = useMemo(() => {
|
|
11120
11121
|
if (!isLineChart)
|
|
11121
11122
|
return [];
|
|
11122
|
-
const result = data
|
|
11123
|
+
const result = data
|
|
11124
|
+
?.map(item => item?.items?.map(({ name }) => name?.toString()))
|
|
11125
|
+
?.flat();
|
|
11123
11126
|
return result?.filter((name, index) => result.indexOf(name) === index);
|
|
11124
11127
|
}, [data, isLineChart]);
|
|
11125
11128
|
const renderLineChartTooltip = useCallback((items, { indexX }) => {
|
|
11126
11129
|
return (jsxs(Tooltip, { children: [jsx(ChartTooltipLabel, { children: labels[indexX] }), items
|
|
11127
11130
|
.filter(({ value }) => !isEmptyValue(value))
|
|
11128
|
-
?.map(({ layerName, attributeName, attributeUnits, dataSourceName, value, stroke }, index) => {
|
|
11131
|
+
?.map(({ layerName, attributeName, attributeUnits, dataSourceName, value, stroke, }, index) => {
|
|
11129
11132
|
const layerInfo = layerInfos?.find(({ name }) => name === layerName);
|
|
11130
11133
|
const attribute = layerInfo?.layerDefinition.attributes[attributeName];
|
|
11131
11134
|
const dataSource = getDataSource(dataSourceName, dataSources);
|
|
@@ -11133,12 +11136,20 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11133
11136
|
? dataSource?.features?.[0]?.properties?.[attributeUnits]
|
|
11134
11137
|
: attribute?.stringFormat?.unitsLabel;
|
|
11135
11138
|
const formatValue = attribute
|
|
11136
|
-
? formatAttributeValue({
|
|
11139
|
+
? formatAttributeValue({
|
|
11140
|
+
t,
|
|
11141
|
+
type: attribute.type,
|
|
11142
|
+
value,
|
|
11143
|
+
stringFormat: attribute.stringFormat,
|
|
11144
|
+
noUnits: true,
|
|
11145
|
+
})
|
|
11137
11146
|
: value;
|
|
11138
|
-
const resultValue = [formatValue, units]
|
|
11147
|
+
const resultValue = [formatValue, units]
|
|
11148
|
+
.filter(Boolean)
|
|
11149
|
+
.join(" ");
|
|
11139
11150
|
return (jsxs(ChartTooltipRow, { children: [jsx(ChartLegendColor$1, { "$color": stroke }), jsx(ChartLegendValue, { children: resultValue })] }, index));
|
|
11140
11151
|
})] }));
|
|
11141
|
-
}, [labels, layerInfos, dataSources,
|
|
11152
|
+
}, [labels, layerInfos, dataSources, t]);
|
|
11142
11153
|
const markers = useMemo(() => getChartMarkers(data[0]?.items, configMarkers, dataSources), [data, dataSources, configMarkers]);
|
|
11143
11154
|
const margin = useMemo(() => {
|
|
11144
11155
|
const markersMargin = showMarkers ? 10 : 0;
|
|
@@ -11146,23 +11157,23 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11146
11157
|
top: markersMargin,
|
|
11147
11158
|
right: markersMargin,
|
|
11148
11159
|
bottom: markers?.length ? 20 : markersMargin,
|
|
11149
|
-
left: markersMargin
|
|
11160
|
+
left: markersMargin,
|
|
11150
11161
|
};
|
|
11151
11162
|
}, [showMarkers, markers?.length]);
|
|
11152
|
-
const formatTooltipName = useCallback((name) =>
|
|
11163
|
+
const formatTooltipName = useCallback((name) => isRelated ? name : tooltipNameFromAttributes(name, formattedAttributes), [formattedAttributes, isRelated]);
|
|
11153
11164
|
const formatTooltipValue = useCallback((value, name) => isRelated
|
|
11154
11165
|
? tooltipValueFromRelatedFeatures(t, value, relatedAttributes, data[0]?.layerInfo)
|
|
11155
|
-
: tooltipValueFromAttributes(t, value, name, formattedAttributes), [data, formattedAttributes, isRelated, relatedAttributes]);
|
|
11166
|
+
: tooltipValueFromAttributes(t, value, name, formattedAttributes), [data, formattedAttributes, isRelated, relatedAttributes, t]);
|
|
11156
11167
|
const customYAxisLeft = useCallback(yAxisLeft => {
|
|
11157
11168
|
yAxisLeft.tickFormat((index) => index);
|
|
11158
11169
|
}, []);
|
|
11159
|
-
const customXAxisBottom = useCallback((xAxisBottom,
|
|
11170
|
+
const customXAxisBottom = useCallback((xAxisBottom, xAxisData) => {
|
|
11160
11171
|
xAxisBottom.tickFormat((index) => markers
|
|
11161
11172
|
? ""
|
|
11162
11173
|
: (showMarkers
|
|
11163
11174
|
? index % showMarkers === 0
|
|
11164
|
-
: index === 0 || index ===
|
|
11165
|
-
?
|
|
11175
|
+
: index === 0 || index === xAxisData.length - 1)
|
|
11176
|
+
? xAxisData[index]?.groupName || ""
|
|
11166
11177
|
: "");
|
|
11167
11178
|
}, [markers, showMarkers]);
|
|
11168
11179
|
const renderChart = useMemo(() => {
|
|
@@ -11177,7 +11188,7 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11177
11188
|
stroke: item.color || primaryColor,
|
|
11178
11189
|
values: item.items
|
|
11179
11190
|
?.filter(({ value }) => !isEmptyValue(value))
|
|
11180
|
-
?.map(({ value }) => Number(value))
|
|
11191
|
+
?.map(({ value }) => Number(value)),
|
|
11181
11192
|
}));
|
|
11182
11193
|
const isHidedY = axes.every(({ hideAxis }) => hideAxis);
|
|
11183
11194
|
const chartValues = lineChartData
|
|
@@ -11198,8 +11209,8 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11198
11209
|
?.filter(({ value }) => !isEmptyValue(value))
|
|
11199
11210
|
?.map(item => ({
|
|
11200
11211
|
...item,
|
|
11201
|
-
color: formatFilterColor(item.name, item.color, defaultColor)
|
|
11202
|
-
})) || []), width: +width, height: +width, padAngle: angle, outerRadius: radius, cornerRadius: cornerRadius, renderTooltip: renderPieChartTooltip, withTooltip: true, onClick: filterName ? item => onFilter(item.name) : undefined, children: showTotal && jsx(PieChartCenter, { children: totalWord || roundTotalSum(+totalSum) }) }) }));
|
|
11212
|
+
color: formatFilterColor(item.name, item.color, defaultColor),
|
|
11213
|
+
})) || []), width: +width, height: +width, padAngle: angle, outerRadius: radius, cornerRadius: cornerRadius, renderTooltip: renderPieChartTooltip, withTooltip: true, onClick: filterName ? item => onFilter(item.name) : undefined, children: showTotal && (jsx(PieChartCenter, { children: totalWord || roundTotalSum(+totalSum) })) }) }));
|
|
11203
11214
|
}
|
|
11204
11215
|
const barChartData = getDataFromFilterItems(data[0]?.items);
|
|
11205
11216
|
return (jsx(BarChartWrapper, { height: height + margin.bottom, children: jsx(BarChartContainer, { children: jsx(StyledBarChart, { data: barChartData, colors: getColorsFromFilterItems(data[0]?.items, defaultColor, formatFilterColor), minValue: getMinValueFromFilterItems(data[0]?.items), markers: markers, width: +width, height: height, barWidth: barWidth, barPadding: padding, customYAxisLeft: customYAxisLeft, customXAxisBottom: xAxisBottom => customXAxisBottom(xAxisBottom, barChartData), customYAxis: axis => !showLabels && axis.remove(), customBars: ({ bars }) => {
|
|
@@ -11243,7 +11254,7 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11243
11254
|
showTotal,
|
|
11244
11255
|
totalWord,
|
|
11245
11256
|
totalSum,
|
|
11246
|
-
onFilter
|
|
11257
|
+
onFilter,
|
|
11247
11258
|
]);
|
|
11248
11259
|
if (!isVisibleContainer(id, expandable, expanded, expandedContainers))
|
|
11249
11260
|
return null;
|
|
@@ -11342,8 +11353,8 @@ const FeatureCardHeader = () => {
|
|
|
11342
11353
|
const FeatureCardTitle = ({ title, description }) => {
|
|
11343
11354
|
const { t } = useGlobalContext();
|
|
11344
11355
|
const { attributes, layerInfo, feature } = useWidgetContext(WidgetType.FeatureCard);
|
|
11345
|
-
const {
|
|
11346
|
-
const resultDescription = description || alias || name || "";
|
|
11356
|
+
const { configuration, layerDefinition } = layerInfo || {};
|
|
11357
|
+
const resultDescription = description || configuration?.alias || configuration?.name || "";
|
|
11347
11358
|
const resultTitle = useMemo(() => {
|
|
11348
11359
|
const layerDefinitionAttribute = layerDefinition && attributes?.length
|
|
11349
11360
|
? attributes.find(item => item.name === layerDefinition.titleAttribute)
|