@evergis/react 3.1.133 → 4.0.0
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/components/AddFeatureButton/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/ChartContainer/types.d.ts +2 -2
- package/dist/components/Dashboard/hooks/useDataSources.d.ts +2 -2
- package/dist/components/Dashboard/hooks/useRelatedDataSourceAttributes.d.ts +2 -3
- package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +2 -2
- package/dist/components/Dashboard/types.d.ts +4 -4
- package/dist/components/Dashboard/utils/formatChartRelatedValue.d.ts +2 -2
- package/dist/components/Dashboard/utils/getAttributesConfiguration.d.ts +2 -2
- package/dist/components/Dashboard/utils/getDataFromRelatedFeatures.d.ts +2 -2
- package/dist/components/Dashboard/utils/getElementValue.d.ts +2 -2
- package/dist/components/Dashboard/utils/getFeatureAttributes.d.ts +2 -3
- package/dist/components/Dashboard/utils/getLayerDefinition.d.ts +2 -3
- package/dist/components/Dashboard/utils/getLayerInfo.d.ts +4 -6
- package/dist/components/Dashboard/utils/getLayerInfoFromDataSources.d.ts +2 -2
- package/dist/components/Dashboard/utils/getRelatedAttribute.d.ts +2 -2
- package/dist/components/Dashboard/utils/getSvgUrl.d.ts +3 -2
- package/dist/components/Dashboard/utils/pieChartTooltipFromRelatedFeatures.d.ts +2 -2
- package/dist/components/Dashboard/utils/tooltipValueFromRelatedFeatures.d.ts +2 -2
- package/dist/components/Layer/types.d.ts +2 -2
- package/dist/components/Layer/utils/getClientStyleItemPrefixSuffix.d.ts +2 -2
- package/dist/components/LayerIcon/index.d.ts +2 -2
- package/dist/contexts/DashboardContext/types.d.ts +2 -3
- package/dist/contexts/FeatureCardContext/types.d.ts +3 -3
- package/dist/core/index.d.ts +0 -1
- package/dist/hooks/map/useLayerParams.d.ts +2 -3
- package/dist/index.js +171 -173
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +173 -175
- package/dist/react.esm.js.map +1 -1
- package/dist/types/attribute.d.ts +0 -10
- package/dist/types/layer.d.ts +1 -30
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/metersPerPixel.d.ts +1 -0
- package/package.json +5 -5
- package/dist/core/feature/convertSpToTurfFeature.d.ts +0 -3
- package/dist/core/feature/index.d.ts +0 -1
package/dist/react.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { IconButton, Flex, transition, Chip, Icon, Description, FlexSpan, IconTo
|
|
|
3
3
|
import { useState, useMemo, useCallback, useRef, useEffect, createContext, memo, useContext, Fragment } from 'react';
|
|
4
4
|
import styled, { createGlobalStyle, css, useTheme } from 'styled-components';
|
|
5
5
|
import { lineChartClassNames, BarChart as BarChart$1, barChartClassNames, LineChart, PieChart } from '@evergis/charts';
|
|
6
|
-
import { AttributeType, STORAGE_TOKEN_KEY, generateId, parseJwt, STORAGE_REFRESH_TOKEN_KEY,
|
|
6
|
+
import { AttributeType, STORAGE_TOKEN_KEY, generateId, parseJwt, STORAGE_REFRESH_TOKEN_KEY, OgcGeometryType, RemoteTaskStatus } from '@evergis/api';
|
|
7
7
|
import Gradient from 'javascript-color-gradient';
|
|
8
8
|
import { Color as Color$1 } from '@evergis/color';
|
|
9
9
|
import { isValid, format, parseJSON, parseISO, toDate } from 'date-fns';
|
|
@@ -15,7 +15,7 @@ import { changeProps, returnFound } from 'find-and';
|
|
|
15
15
|
import { jsPDF } from 'jspdf';
|
|
16
16
|
import html2canvas from 'html2canvas';
|
|
17
17
|
import MapboxDraw from '@mapbox/mapbox-gl-draw';
|
|
18
|
-
import {
|
|
18
|
+
import { bbox } from '@turf/turf';
|
|
19
19
|
import MapGL, { Source, Layer as Layer$1 } from 'react-map-gl/maplibre';
|
|
20
20
|
import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
|
|
21
21
|
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
@@ -3631,8 +3631,9 @@ var DateFormat;
|
|
|
3631
3631
|
})(DateFormat || (DateFormat = {}));
|
|
3632
3632
|
const stringDateParsers = [parseJSON, parseISO, rawDate => new Date(rawDate)];
|
|
3633
3633
|
const getDate = (rawDate) => {
|
|
3634
|
-
if (!rawDate)
|
|
3634
|
+
if (!rawDate) {
|
|
3635
3635
|
return null;
|
|
3636
|
+
}
|
|
3636
3637
|
if (typeof rawDate === "string") {
|
|
3637
3638
|
for (const parser of stringDateParsers) {
|
|
3638
3639
|
const date = parser(rawDate);
|
|
@@ -3650,7 +3651,7 @@ const formatDate$1 = (date, { dateFormat = DateFormat.ClientDefaultFormat, defau
|
|
|
3650
3651
|
if (isValid(dateValue)) {
|
|
3651
3652
|
return format(dateValue, dateFormat);
|
|
3652
3653
|
}
|
|
3653
|
-
return defaultValue
|
|
3654
|
+
return `${defaultValue}`;
|
|
3654
3655
|
};
|
|
3655
3656
|
|
|
3656
3657
|
const debounce = (callback, delay) => {
|
|
@@ -3666,13 +3667,6 @@ const debounce = (callback, delay) => {
|
|
|
3666
3667
|
};
|
|
3667
3668
|
|
|
3668
3669
|
const TIME_ZONE_FORMAT = ' "GMT"z'; // eslint-disable-line
|
|
3669
|
-
const numberFormatTypes = [
|
|
3670
|
-
AttributeType.Int32,
|
|
3671
|
-
AttributeType.Int64,
|
|
3672
|
-
AttributeType.Double,
|
|
3673
|
-
AttributeType.MultiPolygon,
|
|
3674
|
-
AttributeType.Polyline,
|
|
3675
|
-
];
|
|
3676
3670
|
var ScalingFactor;
|
|
3677
3671
|
(function (ScalingFactor) {
|
|
3678
3672
|
ScalingFactor[ScalingFactor["Default"] = 1] = "Default";
|
|
@@ -3827,8 +3821,9 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
|
|
|
3827
3821
|
};
|
|
3828
3822
|
const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false }) => {
|
|
3829
3823
|
if (type === AttributeType.Point) {
|
|
3830
|
-
if (!stringFormat?.format || !value)
|
|
3824
|
+
if (!stringFormat?.format || !value) {
|
|
3831
3825
|
return null;
|
|
3826
|
+
}
|
|
3832
3827
|
const { coordinates } = value;
|
|
3833
3828
|
return formatPointValue({ t, stringFormat, value: coordinates });
|
|
3834
3829
|
}
|
|
@@ -3837,9 +3832,20 @@ const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false })
|
|
|
3837
3832
|
return null;
|
|
3838
3833
|
return formatDateValue(stringFormat, value);
|
|
3839
3834
|
}
|
|
3840
|
-
if (
|
|
3841
|
-
|
|
3835
|
+
if ([
|
|
3836
|
+
AttributeType.Int32,
|
|
3837
|
+
AttributeType.Int64,
|
|
3838
|
+
AttributeType.Double,
|
|
3839
|
+
AttributeType.Polygon,
|
|
3840
|
+
AttributeType.LineString,
|
|
3841
|
+
AttributeType.MultiPoint,
|
|
3842
|
+
AttributeType.MultiPolygon,
|
|
3843
|
+
AttributeType.MultiLineString,
|
|
3844
|
+
].includes(type) &&
|
|
3845
|
+
!isNaN(value)) {
|
|
3846
|
+
if (!stringFormat) {
|
|
3842
3847
|
return value.toString();
|
|
3848
|
+
}
|
|
3843
3849
|
return formatNumberValue(stringFormat, value, type, noUnits);
|
|
3844
3850
|
}
|
|
3845
3851
|
if (type === AttributeType.Json) {
|
|
@@ -3905,6 +3911,10 @@ const isLayerService = (value) => isObject(value) && "name" in value;
|
|
|
3905
3911
|
|
|
3906
3912
|
const isNumeric = (number) => !isNaN(parseFloat(number)) && isFinite(number);
|
|
3907
3913
|
|
|
3914
|
+
const metersPerPixel = (zoom, lat) => {
|
|
3915
|
+
return (156543.03 * Math.cos(lat * (Math.PI / 180))) / 2 ** zoom;
|
|
3916
|
+
};
|
|
3917
|
+
|
|
3908
3918
|
const useAutoCompleteControl = (items) => {
|
|
3909
3919
|
const [value, setValue] = useState("");
|
|
3910
3920
|
const [options, setOptions] = useState([]);
|
|
@@ -4347,11 +4357,11 @@ const getDataSource = (dataSourceName, dataSources) => dataSources?.find(({ name
|
|
|
4347
4357
|
const getDataSourceFilterValue = ({ filterName, filterProp, attributeAlias, dataSource, selectedFilters, }) => {
|
|
4348
4358
|
if (isNil(selectedFilters[filterName]))
|
|
4349
4359
|
return null;
|
|
4350
|
-
const feature = dataSource?.features?.find(({
|
|
4360
|
+
const feature = dataSource?.features?.find(({ properties }) => properties[attributeAlias] ===
|
|
4351
4361
|
(Array.isArray(selectedFilters[filterName].value)
|
|
4352
4362
|
? selectedFilters[filterName].value[0]
|
|
4353
4363
|
: selectedFilters[filterName].value));
|
|
4354
|
-
return feature?.
|
|
4364
|
+
return feature?.properties?.[filterProp];
|
|
4355
4365
|
};
|
|
4356
4366
|
|
|
4357
4367
|
const getSelectedFilterValue = (filterName, selectedFilters, defaultValue) => {
|
|
@@ -4469,9 +4479,12 @@ const createConfigPage = (props) => {
|
|
|
4469
4479
|
};
|
|
4470
4480
|
|
|
4471
4481
|
const getAttributesConfiguration = (layer) => {
|
|
4472
|
-
const configuration = layer?.configuration ??
|
|
4482
|
+
const configuration = layer?.configuration ??
|
|
4483
|
+
{};
|
|
4473
4484
|
const emptyAttributesConfiguration = {
|
|
4474
|
-
geometryAttribute: layer?.geometryType ===
|
|
4485
|
+
geometryAttribute: layer?.layerDefinition?.geometryType === OgcGeometryType.Unknown
|
|
4486
|
+
? undefined
|
|
4487
|
+
: GEOMETRY_ATTRIBUTE,
|
|
4475
4488
|
idAttribute: DEFAULT_ID_ATTRIBUTE_NAME,
|
|
4476
4489
|
tableName: "",
|
|
4477
4490
|
};
|
|
@@ -4490,7 +4503,7 @@ const getLayerDefinition = (layer) => {
|
|
|
4490
4503
|
attributes: {},
|
|
4491
4504
|
geometryAttribute,
|
|
4492
4505
|
idAttribute,
|
|
4493
|
-
geometryType:
|
|
4506
|
+
geometryType: OgcGeometryType.Unknown,
|
|
4494
4507
|
titleAttribute: "",
|
|
4495
4508
|
};
|
|
4496
4509
|
if (!isLayerService(layer) || !("layerDefinition" in layer)) {
|
|
@@ -4499,7 +4512,8 @@ const getLayerDefinition = (layer) => {
|
|
|
4499
4512
|
return {
|
|
4500
4513
|
...emptyLayerDefinition,
|
|
4501
4514
|
...(layer.layerDefinition || {}),
|
|
4502
|
-
attributes: layer.layerDefinition.attributes ||
|
|
4515
|
+
attributes: layer.layerDefinition.attributes ||
|
|
4516
|
+
emptyLayerDefinition.attributes,
|
|
4503
4517
|
};
|
|
4504
4518
|
};
|
|
4505
4519
|
|
|
@@ -5268,73 +5282,6 @@ const useRedrawLayer = () => {
|
|
|
5268
5282
|
}, [map]);
|
|
5269
5283
|
};
|
|
5270
5284
|
|
|
5271
|
-
const findAttributeInExpression = (expression) => {
|
|
5272
|
-
if (Array.isArray(expression) && expression.length === 2 && expression[0] === "get") {
|
|
5273
|
-
return [expression[1]];
|
|
5274
|
-
}
|
|
5275
|
-
return expression.reduce((acc, curr) => {
|
|
5276
|
-
if (!Array.isArray(curr)) {
|
|
5277
|
-
return acc;
|
|
5278
|
-
}
|
|
5279
|
-
if (curr[0] === "get") {
|
|
5280
|
-
return [...new Set([...acc, curr[1]])];
|
|
5281
|
-
}
|
|
5282
|
-
return [...new Set([...acc, ...findAttributeInExpression(curr)])];
|
|
5283
|
-
}, []);
|
|
5284
|
-
};
|
|
5285
|
-
|
|
5286
|
-
const getActualExtrusionHeight = (paint) => {
|
|
5287
|
-
return Array.isArray(paint?.["fill-extrusion-height"]) && paint?.["fill-extrusion-height"][0] === "+"
|
|
5288
|
-
? paint?.["fill-extrusion-height"][1]
|
|
5289
|
-
: paint?.["fill-extrusion-height"];
|
|
5290
|
-
};
|
|
5291
|
-
|
|
5292
|
-
const extractAttributesFromObject = (obj) => {
|
|
5293
|
-
if (!obj || isEmpty(obj)) {
|
|
5294
|
-
return [];
|
|
5295
|
-
}
|
|
5296
|
-
return Object.entries(obj).reduce((acc, [, value]) => {
|
|
5297
|
-
if (!Array.isArray(value)) {
|
|
5298
|
-
return acc;
|
|
5299
|
-
}
|
|
5300
|
-
return [...new Set([...acc, ...findAttributeInExpression(value)])];
|
|
5301
|
-
}, []);
|
|
5302
|
-
};
|
|
5303
|
-
const parseClientStyle = (style) => {
|
|
5304
|
-
if (!style) {
|
|
5305
|
-
return [];
|
|
5306
|
-
}
|
|
5307
|
-
return style?.items?.reduce((acc, curr) => {
|
|
5308
|
-
const paintAttributes = extractAttributesFromObject(curr.paint);
|
|
5309
|
-
const layoutAttributes = extractAttributesFromObject(curr.layout);
|
|
5310
|
-
const filterAttributes = curr.filter
|
|
5311
|
-
? findAttributeInExpression(curr.filter)
|
|
5312
|
-
: [];
|
|
5313
|
-
return [...new Set([...acc, ...paintAttributes, ...layoutAttributes, ...filterAttributes])];
|
|
5314
|
-
}, []);
|
|
5315
|
-
};
|
|
5316
|
-
|
|
5317
|
-
const convertSpToTurfFeature = (geometry) => {
|
|
5318
|
-
if (!geometry) {
|
|
5319
|
-
return;
|
|
5320
|
-
}
|
|
5321
|
-
switch (geometry.type) {
|
|
5322
|
-
case GeometryType.Point:
|
|
5323
|
-
return point$1(geometry.coordinates);
|
|
5324
|
-
case GeometryType.Multipoint:
|
|
5325
|
-
return multiPoint(geometry.coordinates);
|
|
5326
|
-
case GeometryType.Polyline:
|
|
5327
|
-
return multiLineString(geometry.coordinates);
|
|
5328
|
-
case GeometryType.Polygon:
|
|
5329
|
-
case GeometryType.Envelope:
|
|
5330
|
-
return polygon(geometry.coordinates);
|
|
5331
|
-
case GeometryType.MultiPolygon:
|
|
5332
|
-
return multiPolygon(geometry.coordinates);
|
|
5333
|
-
case GeometryType.GeometryCollection:
|
|
5334
|
-
return geometryCollection(geometry.geometries);
|
|
5335
|
-
}
|
|
5336
|
-
};
|
|
5337
|
-
|
|
5338
5285
|
const useZoomToFeatures = () => {
|
|
5339
5286
|
const { map } = useMapContext();
|
|
5340
5287
|
return useCallback((features, padding) => {
|
|
@@ -5343,7 +5290,7 @@ const useZoomToFeatures = () => {
|
|
|
5343
5290
|
}
|
|
5344
5291
|
const currentFeatureCenter = bbox({
|
|
5345
5292
|
type: "FeatureCollection",
|
|
5346
|
-
features: features
|
|
5293
|
+
features: features,
|
|
5347
5294
|
});
|
|
5348
5295
|
map.current.fitBounds(currentFeatureCenter, { padding: padding ?? 150 });
|
|
5349
5296
|
}, [map]);
|
|
@@ -6006,9 +5953,9 @@ function getValueIndex(items, attributes) {
|
|
|
6006
5953
|
const getChartMarkers = (items, markers, dataSources) => {
|
|
6007
5954
|
if (typeof markers === "string") {
|
|
6008
5955
|
const dataSource = getDataSource(markers, dataSources);
|
|
6009
|
-
return dataSource?.features?.map(({
|
|
6010
|
-
...
|
|
6011
|
-
value: getValueIndex(items,
|
|
5956
|
+
return dataSource?.features?.map(({ properties }) => ({
|
|
5957
|
+
...properties,
|
|
5958
|
+
value: getValueIndex(items, properties),
|
|
6012
5959
|
})) || [];
|
|
6013
5960
|
}
|
|
6014
5961
|
return (markers?.map(marker => ({
|
|
@@ -6186,7 +6133,7 @@ const useRenderContainerItem = (type, renderElement) => {
|
|
|
6186
6133
|
options: { noUnits: hasUnits, ...child.options },
|
|
6187
6134
|
}));
|
|
6188
6135
|
const attr = attribute
|
|
6189
|
-
? layerInfo?.
|
|
6136
|
+
? layerInfo?.configuration?.attributesConfiguration?.attributes?.find(({ attributeName }) => attributeName === attribute)
|
|
6190
6137
|
: null;
|
|
6191
6138
|
if (hasIcon) {
|
|
6192
6139
|
elementChildren[iconIndex] = {
|
|
@@ -6431,7 +6378,7 @@ const DataSourceProgressContainer = memo(({ config, elementConfig, type, innerCo
|
|
|
6431
6378
|
const { dataSource, layerInfo } = useRelatedDataSourceAttributes({
|
|
6432
6379
|
type,
|
|
6433
6380
|
elementConfig,
|
|
6434
|
-
dataSources
|
|
6381
|
+
dataSources,
|
|
6435
6382
|
});
|
|
6436
6383
|
const { attributes } = layerInfo?.configuration?.attributesConfiguration || {};
|
|
6437
6384
|
const { id, options, children, style } = elementConfig || {};
|
|
@@ -6442,19 +6389,25 @@ const DataSourceProgressContainer = memo(({ config, elementConfig, type, innerCo
|
|
|
6442
6389
|
const totalUnits = useMemo(() => unitsElement?.type === "attributeUnits"
|
|
6443
6390
|
? attributes?.find(({ attributeName }) => attributeName === unitsElement.attributeName)?.stringFormat
|
|
6444
6391
|
?.unitsLabel
|
|
6445
|
-
: dataSource?.features?.[0]?.
|
|
6392
|
+
: dataSource?.features?.[0]?.properties[unitsElement?.attributeName], [attributes, dataSource?.features, unitsElement?.attributeName, unitsElement?.type]);
|
|
6446
6393
|
const totalValue = useMemo(() => {
|
|
6447
6394
|
const attribute = attributes?.find(({ attributeName }) => attributeName === valueElement?.attributeName);
|
|
6448
6395
|
const { type: attributeType, stringFormat } = attribute || {};
|
|
6449
|
-
const result = dataSource?.features?.reduce((total, feature) => total + feature.
|
|
6450
|
-
return formatAttributeValue({
|
|
6396
|
+
const result = dataSource?.features?.reduce((total, feature) => total + feature.properties[valueElement?.attributeName], 0);
|
|
6397
|
+
return formatAttributeValue({
|
|
6398
|
+
t,
|
|
6399
|
+
type: attributeType,
|
|
6400
|
+
value: result,
|
|
6401
|
+
stringFormat,
|
|
6402
|
+
noUnits: !!unitsElement?.type,
|
|
6403
|
+
});
|
|
6451
6404
|
}, [attributes, dataSource?.features, unitsElement?.type, valueElement?.attributeName]);
|
|
6452
6405
|
const currentMaxValue = useMemo(() => {
|
|
6453
6406
|
if (typeof maxValue === "string") {
|
|
6454
|
-
return dataSource?.features?.[0]?.
|
|
6407
|
+
return dataSource?.features?.[0]?.properties[maxValue];
|
|
6455
6408
|
}
|
|
6456
6409
|
return (maxValue ||
|
|
6457
|
-
dataSource?.features?.reduce((result, item) => Math.max(result, item.
|
|
6410
|
+
dataSource?.features?.reduce((result, item) => Math.max(result, item.properties[valueElement?.attributeName]), 0));
|
|
6458
6411
|
}, [dataSource?.features, maxValue, valueElement?.attributeName]);
|
|
6459
6412
|
if (!relatedDataSource)
|
|
6460
6413
|
return null;
|
|
@@ -6462,7 +6415,10 @@ const DataSourceProgressContainer = memo(({ config, elementConfig, type, innerCo
|
|
|
6462
6415
|
return jsx(DataSourceError, { name: elementConfig.templateName });
|
|
6463
6416
|
}
|
|
6464
6417
|
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
6465
|
-
return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxs(DataSourceProgressContainerWrapper, { id: id, style: style, children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
|
|
6418
|
+
return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxs(DataSourceProgressContainerWrapper, { id: id, style: style, children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
|
|
6419
|
+
ns: "dashboard",
|
|
6420
|
+
defaultValue: "Показать все",
|
|
6421
|
+
}) })), showTotal && (jsxs(Fragment$1, { children: [jsx(Divider, {}), jsxs(ProgressTotal, { children: [jsx(ProgressTotalTitle, { children: t("total", { ns: "dashboard", defaultValue: "Итого" }) }), jsxs(ProgressValue, { children: [totalValue, jsx(ProgressUnits, { children: totalUnits })] })] })] }))] })) : (jsx(ContainerLoading, {})), jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type })] }));
|
|
6466
6422
|
});
|
|
6467
6423
|
|
|
6468
6424
|
const ProgressContainer = memo(({ type, elementConfig, feature, maxValue, index, renderElement }) => {
|
|
@@ -7398,12 +7354,6 @@ var ThemeName;
|
|
|
7398
7354
|
ThemeName["Dark"] = "dark";
|
|
7399
7355
|
})(ThemeName || (ThemeName = {}));
|
|
7400
7356
|
|
|
7401
|
-
var TmsType;
|
|
7402
|
-
(function (TmsType) {
|
|
7403
|
-
TmsType["WMS"] = "WMS";
|
|
7404
|
-
TmsType["TMS"] = "TMS";
|
|
7405
|
-
TmsType["ArcGIS"] = "ArcGIS";
|
|
7406
|
-
})(TmsType || (TmsType = {}));
|
|
7407
7357
|
var EditGeometryType;
|
|
7408
7358
|
(function (EditGeometryType) {
|
|
7409
7359
|
EditGeometryType["Raster"] = "raster";
|
|
@@ -7545,7 +7495,7 @@ const useEditControl = (type, elementConfig) => {
|
|
|
7545
7495
|
attributes,
|
|
7546
7496
|
]);
|
|
7547
7497
|
const dataSource = useMemo(() => dataSources?.find(({ name }) => name === control.relatedDataSource), [control.relatedDataSource, dataSources]);
|
|
7548
|
-
const items = useMemo(() => dataSource?.features.map(item => item.
|
|
7498
|
+
const items = useMemo(() => dataSource?.features.map(item => item.properties[control?.attributeName] || null) || [], [dataSource?.features, control?.attributeName]);
|
|
7549
7499
|
const onChange = useCallback((newValue) => {
|
|
7550
7500
|
changeControls({
|
|
7551
7501
|
[control?.targetAttributeName]: newValue,
|
|
@@ -7916,8 +7866,8 @@ const HeaderTitle = ({ noFeature }) => {
|
|
|
7916
7866
|
const { t } = useGlobalContext();
|
|
7917
7867
|
const { attributes, layerInfo, feature } = useWidgetContext(WidgetType.FeatureCard);
|
|
7918
7868
|
const zoomToFeatures = useZoomToFeatures();
|
|
7919
|
-
const {
|
|
7920
|
-
const resultDescription = alias || name || "";
|
|
7869
|
+
const { configuration, layerDefinition } = layerInfo || {};
|
|
7870
|
+
const resultDescription = configuration?.alias || configuration?.name || "";
|
|
7921
7871
|
const resultTitle = useMemo(() => {
|
|
7922
7872
|
const layerDefinitionAttribute = layerDefinition && attributes?.length
|
|
7923
7873
|
? attributes.find(item => item.name === layerDefinition.titleAttribute)
|
|
@@ -7965,20 +7915,20 @@ var img = "data:image/svg+xml,%3csvg width='32' height='32' viewBox='0 0 32 32'
|
|
|
7965
7915
|
|
|
7966
7916
|
const LayerIcon = ({ layerInfo, error }) => {
|
|
7967
7917
|
const renderSymbol = useMemo(() => {
|
|
7968
|
-
if (!layerInfo
|
|
7918
|
+
if (!layerInfo?.layerDefinition?.geometryType || error) {
|
|
7969
7919
|
return (jsx(AlertIconContainer, { children: jsx(Icon, { kind: "warning" }) }));
|
|
7970
7920
|
}
|
|
7971
|
-
switch (layerInfo
|
|
7972
|
-
case
|
|
7921
|
+
switch (layerInfo?.layerDefinition?.geometryType) {
|
|
7922
|
+
case OgcGeometryType.MultiLineString:
|
|
7973
7923
|
return jsx("img", { src: img$1, alt: "" });
|
|
7974
|
-
case
|
|
7975
|
-
case
|
|
7924
|
+
case OgcGeometryType.Polygon:
|
|
7925
|
+
case OgcGeometryType.MultiPolygon:
|
|
7976
7926
|
return jsx("img", { src: img, alt: "" });
|
|
7977
|
-
case
|
|
7927
|
+
case OgcGeometryType.Point:
|
|
7978
7928
|
default:
|
|
7979
7929
|
return jsx("img", { src: img$2, alt: "" });
|
|
7980
7930
|
}
|
|
7981
|
-
}, [layerInfo
|
|
7931
|
+
}, [layerInfo?.layerDefinition?.geometryType]);
|
|
7982
7932
|
return jsx(LayerIconContainer, { children: renderSymbol });
|
|
7983
7933
|
};
|
|
7984
7934
|
|
|
@@ -8522,8 +8472,8 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
8522
8472
|
return [];
|
|
8523
8473
|
}
|
|
8524
8474
|
return dataSource.features.map(item => ({
|
|
8525
|
-
value: item.
|
|
8526
|
-
text: item.
|
|
8475
|
+
value: item.properties?.[attributeName] || "",
|
|
8476
|
+
text: item.properties?.[control?.attributeName || attributeName] || "",
|
|
8527
8477
|
}));
|
|
8528
8478
|
}, [control?.attributeName, dataSource?.features, attributeName]);
|
|
8529
8479
|
const isDisabled = useMemo(() => {
|
|
@@ -8859,7 +8809,7 @@ const ElementSlideshow = ({ elementConfig, type, renderElement }) => {
|
|
|
8859
8809
|
const images = useMemo(() => {
|
|
8860
8810
|
const dataSource = relatedDataSource ? dataSources?.find(({ name }) => name === relatedDataSource) : null;
|
|
8861
8811
|
const array = dataSource
|
|
8862
|
-
? dataSource.features.map(feature => feature.
|
|
8812
|
+
? dataSource.features.map(feature => feature.properties[attributeName])
|
|
8863
8813
|
: getSlideshowImages({
|
|
8864
8814
|
element: elementConfig,
|
|
8865
8815
|
attribute: attributes?.find(({ name }) => name === attributeName),
|
|
@@ -9042,20 +8992,20 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
|
|
|
9042
8992
|
}
|
|
9043
8993
|
const { colors } = config.options;
|
|
9044
8994
|
const layerDefinition = getLayerDefinition(layerInfo);
|
|
9045
|
-
let data =
|
|
8995
|
+
let data = [...dataSource?.features];
|
|
9046
8996
|
const sortAttribute = config?.options?.orderByValue
|
|
9047
8997
|
? relatedConfig.attributeName
|
|
9048
8998
|
: config?.options?.orderByTitle
|
|
9049
8999
|
? relatedConfig.attributeTitle
|
|
9050
9000
|
: null;
|
|
9051
9001
|
if (sortAttribute) {
|
|
9052
|
-
data.sort((a, b) => b.
|
|
9002
|
+
data.sort((a, b) => b.properties[sortAttribute] - a.properties[sortAttribute]);
|
|
9053
9003
|
}
|
|
9054
9004
|
const isOtherSliced = config?.options?.otherItems && config.options.otherItems < data.length;
|
|
9055
9005
|
const otherValue = isOtherSliced
|
|
9056
9006
|
? data
|
|
9057
9007
|
.slice(config.options.otherItems)
|
|
9058
|
-
.reduce((prev, {
|
|
9008
|
+
.reduce((prev, { properties }) => prev + properties[relatedConfig.attributeName], 0)
|
|
9059
9009
|
: null;
|
|
9060
9010
|
if (isOtherSliced) {
|
|
9061
9011
|
data = data.slice(0, config?.options?.otherItems);
|
|
@@ -9071,9 +9021,9 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
|
|
|
9071
9021
|
if (relatedConfig?.filterName && !filter) {
|
|
9072
9022
|
return acc;
|
|
9073
9023
|
}
|
|
9074
|
-
const attributeName = feature.
|
|
9075
|
-
const attributeTitle = feature.
|
|
9076
|
-
const attributeColor = feature.
|
|
9024
|
+
const attributeName = feature.properties[relatedConfig.attributeName];
|
|
9025
|
+
const attributeTitle = feature.properties[relatedConfig.attributeTitle];
|
|
9026
|
+
const attributeColor = feature.properties[relatedConfig.attributeColor];
|
|
9077
9027
|
return [
|
|
9078
9028
|
...acc,
|
|
9079
9029
|
{
|
|
@@ -9085,8 +9035,8 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
|
|
|
9085
9035
|
}),
|
|
9086
9036
|
value: attributeName === null ? null : Number(attributeName),
|
|
9087
9037
|
color: attributeColor || gradientArray?.[index] || FEATURE_CARD_OTHER_COLOR,
|
|
9088
|
-
min: filter?.attributeMin ? feature.
|
|
9089
|
-
max: filter?.attributeMin ? feature.
|
|
9038
|
+
min: filter?.attributeMin ? feature.properties[filter.attributeMin] : null,
|
|
9039
|
+
max: filter?.attributeMin ? feature.properties[filter.attributeMax] : null
|
|
9090
9040
|
}
|
|
9091
9041
|
];
|
|
9092
9042
|
}, []);
|
|
@@ -9381,7 +9331,7 @@ function getFeatureAttributes(feature = {}, layer, dataSource) {
|
|
|
9381
9331
|
if (!layerDefinition) {
|
|
9382
9332
|
return [];
|
|
9383
9333
|
}
|
|
9384
|
-
const currentAttributes = !feature && dataSource ? dataSource.features[0].
|
|
9334
|
+
const currentAttributes = !feature && dataSource ? dataSource.features[0].properties : feature?.properties;
|
|
9385
9335
|
const { id: idValue } = feature || {};
|
|
9386
9336
|
const { idAttribute, attributes } = layerDefinition || {};
|
|
9387
9337
|
const layerAttributes = idAttribute
|
|
@@ -9398,10 +9348,10 @@ function getFeatureAttributes(feature = {}, layer, dataSource) {
|
|
|
9398
9348
|
readOnly: true,
|
|
9399
9349
|
}
|
|
9400
9350
|
: {
|
|
9401
|
-
value: currentAttributes?.[attributeName] || dataSource?.features?.[0]?.
|
|
9351
|
+
value: currentAttributes?.[attributeName] || dataSource?.features?.[0]?.properties?.[attributeName],
|
|
9402
9352
|
readOnly: isCalculated || !isEditable,
|
|
9403
9353
|
};
|
|
9404
|
-
const clientData = layer
|
|
9354
|
+
const clientData = layer?.configuration?.attributesConfiguration?.attributes?.find(layerAttribute => layerAttribute.attributeName === attributeName)?.clientData;
|
|
9405
9355
|
return {
|
|
9406
9356
|
id: attributeName,
|
|
9407
9357
|
name: attributeName,
|
|
@@ -9572,10 +9522,10 @@ const getListOptions = (items, filterName, configFilters) => {
|
|
|
9572
9522
|
if (!filter)
|
|
9573
9523
|
return [];
|
|
9574
9524
|
return (items?.map(item => ({
|
|
9575
|
-
text: item.
|
|
9576
|
-
value: item.
|
|
9577
|
-
min: filter.attributeMin ? item.
|
|
9578
|
-
max: filter.attributeMax ? item.
|
|
9525
|
+
text: item.properties[filter.attributeAlias || DEFAULT_ATTRIBUTE_NAME],
|
|
9526
|
+
value: item.properties[filter.attributeValue || DEFAULT_ATTRIBUTE_NAME],
|
|
9527
|
+
min: filter.attributeMin ? item.properties[filter.attributeMin] : null,
|
|
9528
|
+
max: filter.attributeMax ? item.properties[filter.attributeMax] : null,
|
|
9579
9529
|
})) || []);
|
|
9580
9530
|
};
|
|
9581
9531
|
|
|
@@ -9700,7 +9650,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9700
9650
|
const [selectedPixels, setSelectedPixels] = useState(null);
|
|
9701
9651
|
const { filterName } = filter.options;
|
|
9702
9652
|
const { options } = elementConfig;
|
|
9703
|
-
const { barHeight, barWidth = DEFAULT_BAR_WIDTH, padding = DEFAULT_BAR_PADDING, height = DEFAULT_BAR_CHART_HEIGHT, radius = DEFAULT_BARCHART_RADIUS, width: configWidth, markers: configMarkers, colors: configColors, colorAttribute, defaultColor, primaryColor, drawMinMax } = options || {};
|
|
9653
|
+
const { barHeight, barWidth = DEFAULT_BAR_WIDTH, padding = DEFAULT_BAR_PADDING, height = DEFAULT_BAR_CHART_HEIGHT, radius = DEFAULT_BARCHART_RADIUS, width: configWidth, markers: configMarkers, colors: configColors, colorAttribute, defaultColor, primaryColor, drawMinMax, } = options || {};
|
|
9704
9654
|
const barFullWidth = barWidth + padding;
|
|
9705
9655
|
const { filters: configFilters } = currentPage;
|
|
9706
9656
|
const configFilter = useMemo(() => getConfigFilter(filterName, configFilters), [configFilters, filterName]);
|
|
@@ -9715,9 +9665,9 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9715
9665
|
dataSourceName: configFilter?.relatedDataSource,
|
|
9716
9666
|
attributeName: configFilter?.attributeValue,
|
|
9717
9667
|
attributeTitle: configFilter?.attributeAlias,
|
|
9718
|
-
attributeColor: colorAttribute
|
|
9668
|
+
attributeColor: colorAttribute,
|
|
9719
9669
|
},
|
|
9720
|
-
layerInfo: { layerDefinition: { attributes: dataSource?.attributeDefinition } }
|
|
9670
|
+
layerInfo: { layerDefinition: { attributes: dataSource?.attributeDefinition } },
|
|
9721
9671
|
}), [
|
|
9722
9672
|
colorAttribute,
|
|
9723
9673
|
configFilter?.attributeAlias,
|
|
@@ -9726,7 +9676,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9726
9676
|
configFilters,
|
|
9727
9677
|
dataSource,
|
|
9728
9678
|
elementConfig,
|
|
9729
|
-
t
|
|
9679
|
+
t,
|
|
9730
9680
|
]);
|
|
9731
9681
|
const amount = useMemo(() => filterItems?.length || 0, [filterItems?.length]);
|
|
9732
9682
|
const width = useMemo(() => configWidth || amount * barFullWidth, [amount, barFullWidth, configWidth]);
|
|
@@ -9762,8 +9712,8 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9762
9712
|
...item,
|
|
9763
9713
|
color: selectedRange && index >= selectedRange[0] && index <= selectedRange[1]
|
|
9764
9714
|
? primaryColor || theme.palette.primary
|
|
9765
|
-
: defaultColor || theme.palette.elementDeep
|
|
9766
|
-
}
|
|
9715
|
+
: defaultColor || theme.palette.elementDeep,
|
|
9716
|
+
},
|
|
9767
9717
|
];
|
|
9768
9718
|
});
|
|
9769
9719
|
}, [defaultColor, hasDefinedColors, primaryColor, selectedRange, theme.palette.elementDeep, theme.palette.primary]);
|
|
@@ -9791,8 +9741,8 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9791
9741
|
[filterName]: {
|
|
9792
9742
|
value: valueRange,
|
|
9793
9743
|
min: valueRange[0],
|
|
9794
|
-
max: valueRange[1]
|
|
9795
|
-
}
|
|
9744
|
+
max: valueRange[1],
|
|
9745
|
+
},
|
|
9796
9746
|
}, configFilter?.resetFilters);
|
|
9797
9747
|
}, [changeFilters, configFilter?.resetFilters, filterName, getValueRange]);
|
|
9798
9748
|
const prevDisabled = useMemo(() => loading || !selectedPixels || selectedPixels?.[0] - barFullWidth < 0, [barFullWidth, loading, selectedPixels]);
|
|
@@ -9850,7 +9800,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9850
9800
|
onPrev,
|
|
9851
9801
|
onNext,
|
|
9852
9802
|
onSelect,
|
|
9853
|
-
onBarClick
|
|
9803
|
+
onBarClick,
|
|
9854
9804
|
};
|
|
9855
9805
|
};
|
|
9856
9806
|
const BarChartFilter = ({ type, config, elementConfig, filter }) => {
|
|
@@ -9858,7 +9808,7 @@ const BarChartFilter = ({ type, config, elementConfig, filter }) => {
|
|
|
9858
9808
|
const { configFilters, loading, height, data, barWidth, barHeight, attributeValue, padding, selectedRange, prevDisabled, nextDisabled, onPrev, onNext, ...rest } = useBarChartFilter({
|
|
9859
9809
|
type,
|
|
9860
9810
|
elementConfig,
|
|
9861
|
-
filter
|
|
9811
|
+
filter,
|
|
9862
9812
|
});
|
|
9863
9813
|
const renderSelectedRange = useMemo(() => {
|
|
9864
9814
|
if (!selectedRange)
|
|
@@ -9887,8 +9837,8 @@ const RangeDateFilter = ({ type, filter }) => {
|
|
|
9887
9837
|
const { filterName, label, minValue, maxValue, withTime } = filter.options;
|
|
9888
9838
|
const configFilter = useMemo(() => getConfigFilter(filterName, configFilters), [configFilters, filterName]);
|
|
9889
9839
|
const dataSource = useMemo(() => getDataSource(configFilter?.relatedDataSource, dataSources), [configFilter?.relatedDataSource, dataSources]);
|
|
9890
|
-
const { minFromData, maxFromData } = useMemo(() => dataSource?.features?.reduce((prev, {
|
|
9891
|
-
const date = getDate(
|
|
9840
|
+
const { minFromData, maxFromData } = useMemo(() => dataSource?.features?.reduce((prev, { properties }) => {
|
|
9841
|
+
const date = getDate(properties[configFilter?.attributeValue]);
|
|
9892
9842
|
return {
|
|
9893
9843
|
minFromData: !prev.minFromData ? date : date < prev.minFromData ? date : prev.minFromData,
|
|
9894
9844
|
maxFromData: !prev.maxFromData ? date : date > prev.maxFromData ? date : prev.maxFromData
|
|
@@ -10109,7 +10059,7 @@ const ChipsFilter = ({ type, filter, elementConfig, }) => {
|
|
|
10109
10059
|
return [];
|
|
10110
10060
|
const features = dataSource.features;
|
|
10111
10061
|
return features.map(feature => {
|
|
10112
|
-
const attrs = feature.
|
|
10062
|
+
const attrs = feature.properties;
|
|
10113
10063
|
const text = attrs[configFilter.attributeAlias || DEFAULT_ATTRIBUTE_NAME];
|
|
10114
10064
|
const value = attrs[configFilter.attributeValue || DEFAULT_ATTRIBUTE_NAME];
|
|
10115
10065
|
const chipIcon = iconAttribute
|
|
@@ -10282,21 +10232,21 @@ const getProxyService = (layer) => {
|
|
|
10282
10232
|
if (!isProxyService(layer))
|
|
10283
10233
|
return {
|
|
10284
10234
|
layers: [],
|
|
10285
|
-
sourceType: "",
|
|
10286
10235
|
sourceUrl: "",
|
|
10287
|
-
|
|
10236
|
+
sourceType: "",
|
|
10237
|
+
layerDefinition: layer?.layerDefinition,
|
|
10288
10238
|
legend: {
|
|
10289
10239
|
layers: [],
|
|
10290
10240
|
},
|
|
10291
10241
|
};
|
|
10292
|
-
const { layers, sourceType, sourceUrl, legend,
|
|
10242
|
+
const { layers, sourceType, sourceUrl, legend, layerDefinition } = layer;
|
|
10293
10243
|
return {
|
|
10294
10244
|
layers: layers || [],
|
|
10295
|
-
copyrightText: copyrightText || "",
|
|
10296
10245
|
sourceUrl: sourceUrl || "",
|
|
10297
10246
|
sourceType: sourceType || "",
|
|
10247
|
+
layerDefinition,
|
|
10298
10248
|
legend: {
|
|
10299
|
-
layers:
|
|
10249
|
+
layers: legend?.layers || [],
|
|
10300
10250
|
},
|
|
10301
10251
|
};
|
|
10302
10252
|
};
|
|
@@ -10311,10 +10261,12 @@ function getLayerInfo(layer) {
|
|
|
10311
10261
|
name: layer?.name || "",
|
|
10312
10262
|
configuration: {
|
|
10313
10263
|
...configuration,
|
|
10264
|
+
name: layer?.name || "",
|
|
10314
10265
|
layers: configLayers.filter(isCompositeLayerConfiguration),
|
|
10315
10266
|
attributesConfiguration,
|
|
10316
10267
|
},
|
|
10317
|
-
acl:
|
|
10268
|
+
acl: layer?.acl,
|
|
10269
|
+
layerDefinition,
|
|
10318
10270
|
condition: ("condition" in configuration && configuration.condition) || undefined,
|
|
10319
10271
|
tableName: attributesConfiguration.tableName,
|
|
10320
10272
|
idAttribute: attributesConfiguration.idAttribute,
|
|
@@ -10355,8 +10307,8 @@ const getSlideshowImages = ({ element, attribute, }) => {
|
|
|
10355
10307
|
|
|
10356
10308
|
const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
|
|
10357
10309
|
let url = "";
|
|
10358
|
-
if (elementConfig.attributeIcon && layerInfo
|
|
10359
|
-
const iconAttribute = layerInfo.
|
|
10310
|
+
if (elementConfig.attributeIcon && layerInfo?.configuration?.attributesConfiguration?.attributes) {
|
|
10311
|
+
const iconAttribute = layerInfo?.configuration?.attributesConfiguration?.attributes.find(({ attributeName }) => attributeName === elementConfig.attributeIcon)?.icon;
|
|
10360
10312
|
url = iconAttribute?.resourceId || iconAttribute?.url;
|
|
10361
10313
|
}
|
|
10362
10314
|
else {
|
|
@@ -10638,7 +10590,7 @@ const useChartData = ({ element, type }) => {
|
|
|
10638
10590
|
relatedConfig: relatedAxis,
|
|
10639
10591
|
dataSource: featureDataSource,
|
|
10640
10592
|
layerInfo: layerInfo ||
|
|
10641
|
-
{ layerDefinition: { attributes: featureDataSource.attributeDefinition } }
|
|
10593
|
+
{ layerDefinition: { attributes: featureDataSource.attributeDefinition } },
|
|
10642
10594
|
})
|
|
10643
10595
|
: null,
|
|
10644
10596
|
color: axisColor,
|
|
@@ -10657,8 +10609,8 @@ const useChartData = ({ element, type }) => {
|
|
|
10657
10609
|
attributeName: null,
|
|
10658
10610
|
attributeUnits: null,
|
|
10659
10611
|
dataSourceName: null,
|
|
10660
|
-
color: null
|
|
10661
|
-
}
|
|
10612
|
+
color: null,
|
|
10613
|
+
},
|
|
10662
10614
|
];
|
|
10663
10615
|
}, [
|
|
10664
10616
|
currentPage?.dataSources,
|
|
@@ -10668,7 +10620,7 @@ const useChartData = ({ element, type }) => {
|
|
|
10668
10620
|
t,
|
|
10669
10621
|
attributes,
|
|
10670
10622
|
layerInfos,
|
|
10671
|
-
dataSources
|
|
10623
|
+
dataSources,
|
|
10672
10624
|
]);
|
|
10673
10625
|
const [data, setData] = useState(fetchedData);
|
|
10674
10626
|
useEffect(() => {
|
|
@@ -10777,7 +10729,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10777
10729
|
const queryResponse = await api.eql.getPagedQueryResult({ saveInHistory: false }, getProps);
|
|
10778
10730
|
const descriptionResponse = await api.eql.getQueryDescription(getProps);
|
|
10779
10731
|
return {
|
|
10780
|
-
items: queryResponse.
|
|
10732
|
+
items: queryResponse.features,
|
|
10781
10733
|
attributeDefinition: descriptionResponse,
|
|
10782
10734
|
};
|
|
10783
10735
|
}
|
|
@@ -10825,7 +10777,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10825
10777
|
!!currentDataSources[index].url ||
|
|
10826
10778
|
!!currentDataSources[index].resourceId;
|
|
10827
10779
|
newDataSources[index].layerName = currentDataSources[index].layerName;
|
|
10828
|
-
const items = response.status === "rejected" ? null : response.value?.
|
|
10780
|
+
const items = response.status === "rejected" ? null : response.value?.features || response.items;
|
|
10829
10781
|
newDataSources[index].features =
|
|
10830
10782
|
response.status === "rejected"
|
|
10831
10783
|
? null
|
|
@@ -11260,7 +11212,7 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
11260
11212
|
const attribute = layerInfo?.layerDefinition.attributes[attributeName];
|
|
11261
11213
|
const dataSource = getDataSource(dataSourceName, dataSources);
|
|
11262
11214
|
const units = attributeUnits
|
|
11263
|
-
? dataSource?.features?.[0]?.
|
|
11215
|
+
? dataSource?.features?.[0]?.properties?.[attributeUnits]
|
|
11264
11216
|
: attribute?.stringFormat?.unitsLabel;
|
|
11265
11217
|
const formatValue = attribute
|
|
11266
11218
|
? formatAttributeValue({
|
|
@@ -11480,8 +11432,8 @@ const FeatureCardHeader = () => {
|
|
|
11480
11432
|
const FeatureCardTitle = ({ title, description }) => {
|
|
11481
11433
|
const { t } = useGlobalContext();
|
|
11482
11434
|
const { attributes, layerInfo, feature } = useWidgetContext(WidgetType.FeatureCard);
|
|
11483
|
-
const {
|
|
11484
|
-
const resultDescription = description || alias || name || "";
|
|
11435
|
+
const { configuration, layerDefinition } = layerInfo || {};
|
|
11436
|
+
const resultDescription = description || configuration?.alias || configuration?.name || "";
|
|
11485
11437
|
const resultTitle = useMemo(() => {
|
|
11486
11438
|
const layerDefinitionAttribute = layerDefinition && attributes?.length
|
|
11487
11439
|
? attributes.find(item => item.name === layerDefinition.titleAttribute)
|
|
@@ -11489,8 +11441,8 @@ const FeatureCardTitle = ({ title, description }) => {
|
|
|
11489
11441
|
const layerDefinitionTitle = layerDefinition?.titleAttribute && layerDefinitionAttribute?.value
|
|
11490
11442
|
? layerDefinitionAttribute.value
|
|
11491
11443
|
: null;
|
|
11492
|
-
const sourceTitleAttribute = titleAttribute && attributes?.length ? attributes.find(item => item.name === titleAttribute) : null;
|
|
11493
|
-
const sourceTitle = titleAttribute && sourceTitleAttribute?.value ? sourceTitleAttribute.value : null;
|
|
11444
|
+
const sourceTitleAttribute = layerDefinition?.titleAttribute && attributes?.length ? attributes.find(item => item.name === layerDefinition?.titleAttribute) : null;
|
|
11445
|
+
const sourceTitle = layerDefinition?.titleAttribute && sourceTitleAttribute?.value ? sourceTitleAttribute.value : null;
|
|
11494
11446
|
return (title ||
|
|
11495
11447
|
(!!sourceTitle &&
|
|
11496
11448
|
formatAttributeValue({ t, type: sourceTitleAttribute.type, value: sourceTitle, stringFormat: sourceTitleAttribute.stringFormat })) ||
|
|
@@ -11502,7 +11454,7 @@ const FeatureCardTitle = ({ title, description }) => {
|
|
|
11502
11454
|
stringFormat: layerDefinitionAttribute.stringFormat,
|
|
11503
11455
|
})) ||
|
|
11504
11456
|
feature?.id);
|
|
11505
|
-
}, [attributes, feature?.id, layerDefinition, title
|
|
11457
|
+
}, [attributes, feature?.id, layerDefinition, title]);
|
|
11506
11458
|
return (jsxs(HeaderTitleContainer, { children: [jsx(FeatureTitleContainer, { children: jsx(FlexSpan, { children: resultTitle }) }), jsx(LayerDescription, { title: resultDescription, children: resultDescription })] }));
|
|
11507
11459
|
};
|
|
11508
11460
|
|
|
@@ -11820,22 +11772,22 @@ const RasterLayer = ({ layer, tileUrl, visible, beforeId, filterVersion, }) => {
|
|
|
11820
11772
|
|
|
11821
11773
|
const getClientStyleItemPrefixSuffix = (geometryType, itemType) => {
|
|
11822
11774
|
switch (geometryType) {
|
|
11823
|
-
case
|
|
11775
|
+
case OgcGeometryType.Point:
|
|
11824
11776
|
switch (itemType) {
|
|
11825
11777
|
case "symbol":
|
|
11826
11778
|
return ["point-label-layer-", "-label"];
|
|
11827
11779
|
default:
|
|
11828
11780
|
return ["point-layer-", ""];
|
|
11829
11781
|
}
|
|
11830
|
-
case
|
|
11782
|
+
case OgcGeometryType.MultiLineString:
|
|
11831
11783
|
switch (itemType) {
|
|
11832
11784
|
case "symbol":
|
|
11833
11785
|
return ["polyline-label-layer-", "-label"];
|
|
11834
11786
|
default:
|
|
11835
11787
|
return ["polyline-layer-", ""];
|
|
11836
11788
|
}
|
|
11837
|
-
case
|
|
11838
|
-
case
|
|
11789
|
+
case OgcGeometryType.Polygon:
|
|
11790
|
+
case OgcGeometryType.MultiPolygon:
|
|
11839
11791
|
switch (itemType) {
|
|
11840
11792
|
case "line":
|
|
11841
11793
|
return ["polygon-stroke-layer-", "-stroke"];
|
|
@@ -11851,6 +11803,52 @@ const getClientStyleItemPrefixSuffix = (geometryType, itemType) => {
|
|
|
11851
11803
|
}
|
|
11852
11804
|
};
|
|
11853
11805
|
|
|
11806
|
+
const findAttributeInExpression = (expression) => {
|
|
11807
|
+
if (Array.isArray(expression) && expression.length === 2 && expression[0] === "get") {
|
|
11808
|
+
return [expression[1]];
|
|
11809
|
+
}
|
|
11810
|
+
return expression.reduce((acc, curr) => {
|
|
11811
|
+
if (!Array.isArray(curr)) {
|
|
11812
|
+
return acc;
|
|
11813
|
+
}
|
|
11814
|
+
if (curr[0] === "get") {
|
|
11815
|
+
return [...new Set([...acc, curr[1]])];
|
|
11816
|
+
}
|
|
11817
|
+
return [...new Set([...acc, ...findAttributeInExpression(curr)])];
|
|
11818
|
+
}, []);
|
|
11819
|
+
};
|
|
11820
|
+
|
|
11821
|
+
const getActualExtrusionHeight = (paint) => {
|
|
11822
|
+
return Array.isArray(paint?.["fill-extrusion-height"]) && paint?.["fill-extrusion-height"][0] === "+"
|
|
11823
|
+
? paint?.["fill-extrusion-height"][1]
|
|
11824
|
+
: paint?.["fill-extrusion-height"];
|
|
11825
|
+
};
|
|
11826
|
+
|
|
11827
|
+
const extractAttributesFromObject = (obj) => {
|
|
11828
|
+
if (!obj || isEmpty(obj)) {
|
|
11829
|
+
return [];
|
|
11830
|
+
}
|
|
11831
|
+
return Object.entries(obj).reduce((acc, [, value]) => {
|
|
11832
|
+
if (!Array.isArray(value)) {
|
|
11833
|
+
return acc;
|
|
11834
|
+
}
|
|
11835
|
+
return [...new Set([...acc, ...findAttributeInExpression(value)])];
|
|
11836
|
+
}, []);
|
|
11837
|
+
};
|
|
11838
|
+
const parseClientStyle = (style) => {
|
|
11839
|
+
if (!style) {
|
|
11840
|
+
return [];
|
|
11841
|
+
}
|
|
11842
|
+
return style?.items?.reduce((acc, curr) => {
|
|
11843
|
+
const paintAttributes = extractAttributesFromObject(curr.paint);
|
|
11844
|
+
const layoutAttributes = extractAttributesFromObject(curr.layout);
|
|
11845
|
+
const filterAttributes = curr.filter
|
|
11846
|
+
? findAttributeInExpression(curr.filter)
|
|
11847
|
+
: [];
|
|
11848
|
+
return [...new Set([...acc, ...paintAttributes, ...layoutAttributes, ...filterAttributes])];
|
|
11849
|
+
}, []);
|
|
11850
|
+
};
|
|
11851
|
+
|
|
11854
11852
|
const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, filterVersion, }) => {
|
|
11855
11853
|
const clientStyle = layer?.configuration?.clientStyle;
|
|
11856
11854
|
const { idAttribute, geometryType } = layer.layerDefinition || {};
|
|
@@ -11882,7 +11880,7 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
|
|
|
11882
11880
|
const renderLayerByGeometryType = useCallback(() => {
|
|
11883
11881
|
const visibility = visible ? "visible" : "none";
|
|
11884
11882
|
switch (geometryType) {
|
|
11885
|
-
case
|
|
11883
|
+
case OgcGeometryType.Point:
|
|
11886
11884
|
return (jsx(Layer$1, { id: layer.name, type: "circle", "source-layer": "default", beforeId: beforeId, layout: {
|
|
11887
11885
|
...getLayerTempStyle?.(layer.name, "circle")?.layout,
|
|
11888
11886
|
visibility,
|
|
@@ -11890,8 +11888,8 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
|
|
|
11890
11888
|
...DEFAULT_CIRCLE_PAINT,
|
|
11891
11889
|
...getLayerTempStyle?.(layer.name, "circle")?.paint,
|
|
11892
11890
|
} }));
|
|
11893
|
-
case
|
|
11894
|
-
case
|
|
11891
|
+
case OgcGeometryType.Polygon:
|
|
11892
|
+
case OgcGeometryType.MultiPolygon:
|
|
11895
11893
|
return [
|
|
11896
11894
|
jsx(Layer$1, { id: layer.name, type: "fill", "source-layer": "default", beforeId: beforeId, layout: {
|
|
11897
11895
|
...getLayerTempStyle?.(layer.name, "fill")?.layout,
|
|
@@ -11929,7 +11927,7 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
|
|
|
11929
11927
|
...getLayerTempStyle?.(layer.name, "fill-extrusion")?.paint,
|
|
11930
11928
|
} }, `polygon-extrusion-layer-${layer.name}`),
|
|
11931
11929
|
];
|
|
11932
|
-
case
|
|
11930
|
+
case OgcGeometryType.MultiLineString:
|
|
11933
11931
|
return (jsx(Layer$1, { id: layer.name, type: "line", "source-layer": "default", beforeId: beforeId, layout: {
|
|
11934
11932
|
...getLayerTempStyle?.(layer.name, "line")?.layout,
|
|
11935
11933
|
visibility,
|
|
@@ -12038,5 +12036,5 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
|
|
|
12038
12036
|
}, children: children }), upperSiblings] }));
|
|
12039
12037
|
};
|
|
12040
12038
|
|
|
12041
|
-
export { AddFeatureButton, AddFeatureContainer, AlertIconContainer, AttributeGalleryContainer, AttributeLabel, BASE_CONTAINER_STYLE, BaseMapTheme, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, Container, ContainerChildren, ContainerLoading, ContainerTemplate, ContainerWrapper, ContainersGroupContainer, DEFAULT_ATTRIBUTE_NAME, DEFAULT_BARCHART_RADIUS, DEFAULT_BASE_MAP, DEFAULT_CHART_ANGLE, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, DEFAULT_CIRCLE_PAINT, DEFAULT_DASHBOARD_CONFIG, DEFAULT_DATA_SOURCE_LIMIT, DEFAULT_DROPDOWN_WIDTH, DEFAULT_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, DEFAULT_FILTER_PADDING, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LAT, DEFAULT_LINE_PAINT, DEFAULT_LNG, DEFAULT_PAGES_CONFIG, DEFAULT_PIECHART_RADIUS, DEFAULT_ZOOM, Dashboard, DashboardCheckbox, DashboardChip, DashboardContent, DashboardContext, DashboardDefaultHeader, DashboardHeader, DashboardLoading, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DefaultHeaderWrapper, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementControl, ElementIcon, ElementImage, ElementLegend, ElementLink, ElementMarkdown, ElementSlideshow, ElementSvg, ElementTooltip, ElementValueWrapper, ExpandableTitle, FEATURE_CARD_DEFAULT_COLORS, FEATURE_CARD_OTHER_COLOR, FILTERED_VALUE_OPACITY, FILTER_PREFIX, FeatureCardButtons, FeatureCardContext, FeatureCardDefaultHeader, FeatureCardGradientHeader, FeatureCardHeader, FeatureCardIconHeader, FeatureCardProvider, FeatureCardSlideshowHeader, FeatureCardTitle, FeatureControls, FeatureTitleContainer, FiltersContainer, GEOMETRY_ATTRIBUTE, GlobalContext, GlobalProvider, Header, HeaderContainer, HeaderFrontView, HeaderTemplate, HeaderTitleContainer, HiddenTitleItems, IconContainer, ImageContainer, LEFT_PANEL_HEADER_HEIGHT, Layer, LayerDescription, LayerGroup, LayerGroupList, LayerIcon, LayerIconContainer, LayerListContainer, LayerTree, LayersContainer, LayersListWrapper, LinearProgressContainer, LogTerminal, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, PageNavigator, PageTitle, PageTitleContainer, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, RoundedBackgroundContainer, SERVER_NOTIFICATION_EVENT, ScalingFactor, ServerNotificationsContext, ServerNotificationsProvider, SlideshowContainer, SmallPreviewContainer$1 as SmallPreviewContainer, SmallPreviewControl, SmallPreviewCounter, SmallPreviewImages, SmallPreviewLeft, SmallPreviewRight, StackBar, SvgImage, TIME_ZONE_FORMAT, TabsContainer, TextTrim, ThemeName, TitleContainer,
|
|
12039
|
+
export { AddFeatureButton, AddFeatureContainer, AlertIconContainer, AttributeGalleryContainer, AttributeLabel, BASE_CONTAINER_STYLE, BaseMapTheme, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, Container, ContainerChildren, ContainerLoading, ContainerTemplate, ContainerWrapper, ContainersGroupContainer, DEFAULT_ATTRIBUTE_NAME, DEFAULT_BARCHART_RADIUS, DEFAULT_BASE_MAP, DEFAULT_CHART_ANGLE, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, DEFAULT_CIRCLE_PAINT, DEFAULT_DASHBOARD_CONFIG, DEFAULT_DATA_SOURCE_LIMIT, DEFAULT_DROPDOWN_WIDTH, DEFAULT_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, DEFAULT_FILTER_PADDING, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LAT, DEFAULT_LINE_PAINT, DEFAULT_LNG, DEFAULT_PAGES_CONFIG, DEFAULT_PIECHART_RADIUS, DEFAULT_ZOOM, Dashboard, DashboardCheckbox, DashboardChip, DashboardContent, DashboardContext, DashboardDefaultHeader, DashboardHeader, DashboardLoading, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DefaultHeaderWrapper, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementControl, ElementIcon, ElementImage, ElementLegend, ElementLink, ElementMarkdown, ElementSlideshow, ElementSvg, ElementTooltip, ElementValueWrapper, ExpandableTitle, FEATURE_CARD_DEFAULT_COLORS, FEATURE_CARD_OTHER_COLOR, FILTERED_VALUE_OPACITY, FILTER_PREFIX, FeatureCardButtons, FeatureCardContext, FeatureCardDefaultHeader, FeatureCardGradientHeader, FeatureCardHeader, FeatureCardIconHeader, FeatureCardProvider, FeatureCardSlideshowHeader, FeatureCardTitle, FeatureControls, FeatureTitleContainer, FiltersContainer, GEOMETRY_ATTRIBUTE, GlobalContext, GlobalProvider, Header, HeaderContainer, HeaderFrontView, HeaderTemplate, HeaderTitleContainer, HiddenTitleItems, IconContainer, ImageContainer, LEFT_PANEL_HEADER_HEIGHT, Layer, LayerDescription, LayerGroup, LayerGroupList, LayerIcon, LayerIconContainer, LayerListContainer, LayerTree, LayersContainer, LayersListWrapper, LinearProgressContainer, LogTerminal, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, PageNavigator, PageTitle, PageTitleContainer, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, RoundedBackgroundContainer, SERVER_NOTIFICATION_EVENT, ScalingFactor, ServerNotificationsContext, ServerNotificationsProvider, SlideshowContainer, SmallPreviewContainer$1 as SmallPreviewContainer, SmallPreviewControl, SmallPreviewCounter, SmallPreviewImages, SmallPreviewLeft, SmallPreviewRight, StackBar, SvgImage, TIME_ZONE_FORMAT, TabsContainer, TextTrim, ThemeName, TitleContainer, TopContainer, TopContainerButtons, TwoColumnContainer, UploadContainer, WidgetType, addDataSource, addDataSources, adjustColor, applyFiltersToCondition, applyQueryFilters, applyVarsToCondition, checkEqualOrIncludes, checkIsLoading, createConfigLayer, createConfigPage, createNewPageId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, getActualExtrusionHeight, getAttributeByName, getAttributeValue, getAttributesConfiguration, getChartAxes, getChartFilterName, getChartMarkers, getConfigFilter, getContainerComponent, getDashboardHeader, getDataFromAttributes, getDataFromRelatedFeatures, getDataSource, getDataSourceFilterValue, getDate, getDefaultConfig, getElementValue, getFeatureAttributes, getFeatureCardHeader, getFilterComponent, getFilterSelectedItems, getFilterValue, getFormattedAttributes, getGradientColors, getLayerDefinition, getLayerInfo, getLayerInfoFromDataSources, getPagesFromConfig, getPagesFromProjectInfo, getProxyService, getRelatedAttribute, getRenderElement, getResourceUrl, getRootElementId, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTemplateNameFromAttribute, getTotalFromAttributes, getTotalFromRelatedFeatures, hexToRgba, isCompositeLayerConfiguration, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isVisibleContainer, metersPerPixel, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, updateDataSource, useAppHeight, useAutoCompleteControl, useChartChange, useChartData, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useExpandableContainers, useExportPdf, useFetchImageWithAuth, useFetchWithAuth, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerParams, useMapContext, useMapDraw, useMapImages, useProjectDashboardInit, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
|
|
12042
12040
|
//# sourceMappingURL=react.esm.js.map
|