@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/index.js
CHANGED
|
@@ -3633,8 +3633,9 @@ exports.DateFormat = void 0;
|
|
|
3633
3633
|
})(exports.DateFormat || (exports.DateFormat = {}));
|
|
3634
3634
|
const stringDateParsers = [dateFns.parseJSON, dateFns.parseISO, rawDate => new Date(rawDate)];
|
|
3635
3635
|
const getDate = (rawDate) => {
|
|
3636
|
-
if (!rawDate)
|
|
3636
|
+
if (!rawDate) {
|
|
3637
3637
|
return null;
|
|
3638
|
+
}
|
|
3638
3639
|
if (typeof rawDate === "string") {
|
|
3639
3640
|
for (const parser of stringDateParsers) {
|
|
3640
3641
|
const date = parser(rawDate);
|
|
@@ -3652,7 +3653,7 @@ const formatDate$1 = (date, { dateFormat = exports.DateFormat.ClientDefaultForma
|
|
|
3652
3653
|
if (dateFns.isValid(dateValue)) {
|
|
3653
3654
|
return dateFns.format(dateValue, dateFormat);
|
|
3654
3655
|
}
|
|
3655
|
-
return defaultValue
|
|
3656
|
+
return `${defaultValue}`;
|
|
3656
3657
|
};
|
|
3657
3658
|
|
|
3658
3659
|
const debounce = (callback, delay) => {
|
|
@@ -3668,13 +3669,6 @@ const debounce = (callback, delay) => {
|
|
|
3668
3669
|
};
|
|
3669
3670
|
|
|
3670
3671
|
const TIME_ZONE_FORMAT = ' "GMT"z'; // eslint-disable-line
|
|
3671
|
-
const numberFormatTypes = [
|
|
3672
|
-
api.AttributeType.Int32,
|
|
3673
|
-
api.AttributeType.Int64,
|
|
3674
|
-
api.AttributeType.Double,
|
|
3675
|
-
api.AttributeType.MultiPolygon,
|
|
3676
|
-
api.AttributeType.Polyline,
|
|
3677
|
-
];
|
|
3678
3672
|
exports.ScalingFactor = void 0;
|
|
3679
3673
|
(function (ScalingFactor) {
|
|
3680
3674
|
ScalingFactor[ScalingFactor["Default"] = 1] = "Default";
|
|
@@ -3829,8 +3823,9 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
|
|
|
3829
3823
|
};
|
|
3830
3824
|
const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false }) => {
|
|
3831
3825
|
if (type === api.AttributeType.Point) {
|
|
3832
|
-
if (!stringFormat?.format || !value)
|
|
3826
|
+
if (!stringFormat?.format || !value) {
|
|
3833
3827
|
return null;
|
|
3828
|
+
}
|
|
3834
3829
|
const { coordinates } = value;
|
|
3835
3830
|
return formatPointValue({ t, stringFormat, value: coordinates });
|
|
3836
3831
|
}
|
|
@@ -3839,9 +3834,20 @@ const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false })
|
|
|
3839
3834
|
return null;
|
|
3840
3835
|
return formatDateValue(stringFormat, value);
|
|
3841
3836
|
}
|
|
3842
|
-
if (
|
|
3843
|
-
|
|
3837
|
+
if ([
|
|
3838
|
+
api.AttributeType.Int32,
|
|
3839
|
+
api.AttributeType.Int64,
|
|
3840
|
+
api.AttributeType.Double,
|
|
3841
|
+
api.AttributeType.Polygon,
|
|
3842
|
+
api.AttributeType.LineString,
|
|
3843
|
+
api.AttributeType.MultiPoint,
|
|
3844
|
+
api.AttributeType.MultiPolygon,
|
|
3845
|
+
api.AttributeType.MultiLineString,
|
|
3846
|
+
].includes(type) &&
|
|
3847
|
+
!isNaN(value)) {
|
|
3848
|
+
if (!stringFormat) {
|
|
3844
3849
|
return value.toString();
|
|
3850
|
+
}
|
|
3845
3851
|
return formatNumberValue(stringFormat, value, type, noUnits);
|
|
3846
3852
|
}
|
|
3847
3853
|
if (type === api.AttributeType.Json) {
|
|
@@ -3907,6 +3913,10 @@ const isLayerService = (value) => isObject(value) && "name" in value;
|
|
|
3907
3913
|
|
|
3908
3914
|
const isNumeric = (number) => !isNaN(parseFloat(number)) && isFinite(number);
|
|
3909
3915
|
|
|
3916
|
+
const metersPerPixel = (zoom, lat) => {
|
|
3917
|
+
return (156543.03 * Math.cos(lat * (Math.PI / 180))) / 2 ** zoom;
|
|
3918
|
+
};
|
|
3919
|
+
|
|
3910
3920
|
const useAutoCompleteControl = (items) => {
|
|
3911
3921
|
const [value, setValue] = React.useState("");
|
|
3912
3922
|
const [options, setOptions] = React.useState([]);
|
|
@@ -4349,11 +4359,11 @@ const getDataSource = (dataSourceName, dataSources) => dataSources?.find(({ name
|
|
|
4349
4359
|
const getDataSourceFilterValue = ({ filterName, filterProp, attributeAlias, dataSource, selectedFilters, }) => {
|
|
4350
4360
|
if (lodash.isNil(selectedFilters[filterName]))
|
|
4351
4361
|
return null;
|
|
4352
|
-
const feature = dataSource?.features?.find(({
|
|
4362
|
+
const feature = dataSource?.features?.find(({ properties }) => properties[attributeAlias] ===
|
|
4353
4363
|
(Array.isArray(selectedFilters[filterName].value)
|
|
4354
4364
|
? selectedFilters[filterName].value[0]
|
|
4355
4365
|
: selectedFilters[filterName].value));
|
|
4356
|
-
return feature?.
|
|
4366
|
+
return feature?.properties?.[filterProp];
|
|
4357
4367
|
};
|
|
4358
4368
|
|
|
4359
4369
|
const getSelectedFilterValue = (filterName, selectedFilters, defaultValue) => {
|
|
@@ -4471,9 +4481,12 @@ const createConfigPage = (props) => {
|
|
|
4471
4481
|
};
|
|
4472
4482
|
|
|
4473
4483
|
const getAttributesConfiguration = (layer) => {
|
|
4474
|
-
const configuration = layer?.configuration ??
|
|
4484
|
+
const configuration = layer?.configuration ??
|
|
4485
|
+
{};
|
|
4475
4486
|
const emptyAttributesConfiguration = {
|
|
4476
|
-
geometryAttribute: layer?.geometryType === api.
|
|
4487
|
+
geometryAttribute: layer?.layerDefinition?.geometryType === api.OgcGeometryType.Unknown
|
|
4488
|
+
? undefined
|
|
4489
|
+
: GEOMETRY_ATTRIBUTE,
|
|
4477
4490
|
idAttribute: DEFAULT_ID_ATTRIBUTE_NAME,
|
|
4478
4491
|
tableName: "",
|
|
4479
4492
|
};
|
|
@@ -4492,7 +4505,7 @@ const getLayerDefinition = (layer) => {
|
|
|
4492
4505
|
attributes: {},
|
|
4493
4506
|
geometryAttribute,
|
|
4494
4507
|
idAttribute,
|
|
4495
|
-
geometryType: api.
|
|
4508
|
+
geometryType: api.OgcGeometryType.Unknown,
|
|
4496
4509
|
titleAttribute: "",
|
|
4497
4510
|
};
|
|
4498
4511
|
if (!isLayerService(layer) || !("layerDefinition" in layer)) {
|
|
@@ -4501,7 +4514,8 @@ const getLayerDefinition = (layer) => {
|
|
|
4501
4514
|
return {
|
|
4502
4515
|
...emptyLayerDefinition,
|
|
4503
4516
|
...(layer.layerDefinition || {}),
|
|
4504
|
-
attributes: layer.layerDefinition.attributes ||
|
|
4517
|
+
attributes: layer.layerDefinition.attributes ||
|
|
4518
|
+
emptyLayerDefinition.attributes,
|
|
4505
4519
|
};
|
|
4506
4520
|
};
|
|
4507
4521
|
|
|
@@ -5270,73 +5284,6 @@ const useRedrawLayer = () => {
|
|
|
5270
5284
|
}, [map]);
|
|
5271
5285
|
};
|
|
5272
5286
|
|
|
5273
|
-
const findAttributeInExpression = (expression) => {
|
|
5274
|
-
if (Array.isArray(expression) && expression.length === 2 && expression[0] === "get") {
|
|
5275
|
-
return [expression[1]];
|
|
5276
|
-
}
|
|
5277
|
-
return expression.reduce((acc, curr) => {
|
|
5278
|
-
if (!Array.isArray(curr)) {
|
|
5279
|
-
return acc;
|
|
5280
|
-
}
|
|
5281
|
-
if (curr[0] === "get") {
|
|
5282
|
-
return [...new Set([...acc, curr[1]])];
|
|
5283
|
-
}
|
|
5284
|
-
return [...new Set([...acc, ...findAttributeInExpression(curr)])];
|
|
5285
|
-
}, []);
|
|
5286
|
-
};
|
|
5287
|
-
|
|
5288
|
-
const getActualExtrusionHeight = (paint) => {
|
|
5289
|
-
return Array.isArray(paint?.["fill-extrusion-height"]) && paint?.["fill-extrusion-height"][0] === "+"
|
|
5290
|
-
? paint?.["fill-extrusion-height"][1]
|
|
5291
|
-
: paint?.["fill-extrusion-height"];
|
|
5292
|
-
};
|
|
5293
|
-
|
|
5294
|
-
const extractAttributesFromObject = (obj) => {
|
|
5295
|
-
if (!obj || lodash.isEmpty(obj)) {
|
|
5296
|
-
return [];
|
|
5297
|
-
}
|
|
5298
|
-
return Object.entries(obj).reduce((acc, [, value]) => {
|
|
5299
|
-
if (!Array.isArray(value)) {
|
|
5300
|
-
return acc;
|
|
5301
|
-
}
|
|
5302
|
-
return [...new Set([...acc, ...findAttributeInExpression(value)])];
|
|
5303
|
-
}, []);
|
|
5304
|
-
};
|
|
5305
|
-
const parseClientStyle = (style) => {
|
|
5306
|
-
if (!style) {
|
|
5307
|
-
return [];
|
|
5308
|
-
}
|
|
5309
|
-
return style?.items?.reduce((acc, curr) => {
|
|
5310
|
-
const paintAttributes = extractAttributesFromObject(curr.paint);
|
|
5311
|
-
const layoutAttributes = extractAttributesFromObject(curr.layout);
|
|
5312
|
-
const filterAttributes = curr.filter
|
|
5313
|
-
? findAttributeInExpression(curr.filter)
|
|
5314
|
-
: [];
|
|
5315
|
-
return [...new Set([...acc, ...paintAttributes, ...layoutAttributes, ...filterAttributes])];
|
|
5316
|
-
}, []);
|
|
5317
|
-
};
|
|
5318
|
-
|
|
5319
|
-
const convertSpToTurfFeature = (geometry) => {
|
|
5320
|
-
if (!geometry) {
|
|
5321
|
-
return;
|
|
5322
|
-
}
|
|
5323
|
-
switch (geometry.type) {
|
|
5324
|
-
case api.GeometryType.Point:
|
|
5325
|
-
return turf.point(geometry.coordinates);
|
|
5326
|
-
case api.GeometryType.Multipoint:
|
|
5327
|
-
return turf.multiPoint(geometry.coordinates);
|
|
5328
|
-
case api.GeometryType.Polyline:
|
|
5329
|
-
return turf.multiLineString(geometry.coordinates);
|
|
5330
|
-
case api.GeometryType.Polygon:
|
|
5331
|
-
case api.GeometryType.Envelope:
|
|
5332
|
-
return turf.polygon(geometry.coordinates);
|
|
5333
|
-
case api.GeometryType.MultiPolygon:
|
|
5334
|
-
return turf.multiPolygon(geometry.coordinates);
|
|
5335
|
-
case api.GeometryType.GeometryCollection:
|
|
5336
|
-
return turf.geometryCollection(geometry.geometries);
|
|
5337
|
-
}
|
|
5338
|
-
};
|
|
5339
|
-
|
|
5340
5287
|
const useZoomToFeatures = () => {
|
|
5341
5288
|
const { map } = useMapContext();
|
|
5342
5289
|
return React.useCallback((features, padding) => {
|
|
@@ -5345,7 +5292,7 @@ const useZoomToFeatures = () => {
|
|
|
5345
5292
|
}
|
|
5346
5293
|
const currentFeatureCenter = turf.bbox({
|
|
5347
5294
|
type: "FeatureCollection",
|
|
5348
|
-
features: features
|
|
5295
|
+
features: features,
|
|
5349
5296
|
});
|
|
5350
5297
|
map.current.fitBounds(currentFeatureCenter, { padding: padding ?? 150 });
|
|
5351
5298
|
}, [map]);
|
|
@@ -6008,9 +5955,9 @@ function getValueIndex(items, attributes) {
|
|
|
6008
5955
|
const getChartMarkers = (items, markers, dataSources) => {
|
|
6009
5956
|
if (typeof markers === "string") {
|
|
6010
5957
|
const dataSource = getDataSource(markers, dataSources);
|
|
6011
|
-
return dataSource?.features?.map(({
|
|
6012
|
-
...
|
|
6013
|
-
value: getValueIndex(items,
|
|
5958
|
+
return dataSource?.features?.map(({ properties }) => ({
|
|
5959
|
+
...properties,
|
|
5960
|
+
value: getValueIndex(items, properties),
|
|
6014
5961
|
})) || [];
|
|
6015
5962
|
}
|
|
6016
5963
|
return (markers?.map(marker => ({
|
|
@@ -6188,7 +6135,7 @@ const useRenderContainerItem = (type, renderElement) => {
|
|
|
6188
6135
|
options: { noUnits: hasUnits, ...child.options },
|
|
6189
6136
|
}));
|
|
6190
6137
|
const attr = attribute
|
|
6191
|
-
? layerInfo?.
|
|
6138
|
+
? layerInfo?.configuration?.attributesConfiguration?.attributes?.find(({ attributeName }) => attributeName === attribute)
|
|
6192
6139
|
: null;
|
|
6193
6140
|
if (hasIcon) {
|
|
6194
6141
|
elementChildren[iconIndex] = {
|
|
@@ -6433,7 +6380,7 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
|
|
|
6433
6380
|
const { dataSource, layerInfo } = useRelatedDataSourceAttributes({
|
|
6434
6381
|
type,
|
|
6435
6382
|
elementConfig,
|
|
6436
|
-
dataSources
|
|
6383
|
+
dataSources,
|
|
6437
6384
|
});
|
|
6438
6385
|
const { attributes } = layerInfo?.configuration?.attributesConfiguration || {};
|
|
6439
6386
|
const { id, options, children, style } = elementConfig || {};
|
|
@@ -6444,19 +6391,25 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
|
|
|
6444
6391
|
const totalUnits = React.useMemo(() => unitsElement?.type === "attributeUnits"
|
|
6445
6392
|
? attributes?.find(({ attributeName }) => attributeName === unitsElement.attributeName)?.stringFormat
|
|
6446
6393
|
?.unitsLabel
|
|
6447
|
-
: dataSource?.features?.[0]?.
|
|
6394
|
+
: dataSource?.features?.[0]?.properties[unitsElement?.attributeName], [attributes, dataSource?.features, unitsElement?.attributeName, unitsElement?.type]);
|
|
6448
6395
|
const totalValue = React.useMemo(() => {
|
|
6449
6396
|
const attribute = attributes?.find(({ attributeName }) => attributeName === valueElement?.attributeName);
|
|
6450
6397
|
const { type: attributeType, stringFormat } = attribute || {};
|
|
6451
|
-
const result = dataSource?.features?.reduce((total, feature) => total + feature.
|
|
6452
|
-
return formatAttributeValue({
|
|
6398
|
+
const result = dataSource?.features?.reduce((total, feature) => total + feature.properties[valueElement?.attributeName], 0);
|
|
6399
|
+
return formatAttributeValue({
|
|
6400
|
+
t,
|
|
6401
|
+
type: attributeType,
|
|
6402
|
+
value: result,
|
|
6403
|
+
stringFormat,
|
|
6404
|
+
noUnits: !!unitsElement?.type,
|
|
6405
|
+
});
|
|
6453
6406
|
}, [attributes, dataSource?.features, unitsElement?.type, valueElement?.attributeName]);
|
|
6454
6407
|
const currentMaxValue = React.useMemo(() => {
|
|
6455
6408
|
if (typeof maxValue === "string") {
|
|
6456
|
-
return dataSource?.features?.[0]?.
|
|
6409
|
+
return dataSource?.features?.[0]?.properties[maxValue];
|
|
6457
6410
|
}
|
|
6458
6411
|
return (maxValue ||
|
|
6459
|
-
dataSource?.features?.reduce((result, item) => Math.max(result, item.
|
|
6412
|
+
dataSource?.features?.reduce((result, item) => Math.max(result, item.properties[valueElement?.attributeName]), 0));
|
|
6460
6413
|
}, [dataSource?.features, maxValue, valueElement?.attributeName]);
|
|
6461
6414
|
if (!relatedDataSource)
|
|
6462
6415
|
return null;
|
|
@@ -6464,7 +6417,10 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
|
|
|
6464
6417
|
return jsxRuntime.jsx(DataSourceError, { name: elementConfig.templateName });
|
|
6465
6418
|
}
|
|
6466
6419
|
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
6467
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxRuntime.jsxs(DataSourceProgressContainerWrapper, { id: id, style: style, children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsxRuntime.jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsxRuntime.jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
|
|
6420
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxRuntime.jsxs(DataSourceProgressContainerWrapper, { id: id, style: style, children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsxRuntime.jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsxRuntime.jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
|
|
6421
|
+
ns: "dashboard",
|
|
6422
|
+
defaultValue: "Показать все",
|
|
6423
|
+
}) })), showTotal && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.Divider, {}), jsxRuntime.jsxs(ProgressTotal, { children: [jsxRuntime.jsx(ProgressTotalTitle, { children: t("total", { ns: "dashboard", defaultValue: "Итого" }) }), jsxRuntime.jsxs(ProgressValue, { children: [totalValue, jsxRuntime.jsx(ProgressUnits, { children: totalUnits })] })] })] }))] })) : (jsxRuntime.jsx(ContainerLoading, {})), jsxRuntime.jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type })] }));
|
|
6468
6424
|
});
|
|
6469
6425
|
|
|
6470
6426
|
const ProgressContainer = React.memo(({ type, elementConfig, feature, maxValue, index, renderElement }) => {
|
|
@@ -7400,12 +7356,6 @@ exports.ThemeName = void 0;
|
|
|
7400
7356
|
ThemeName["Dark"] = "dark";
|
|
7401
7357
|
})(exports.ThemeName || (exports.ThemeName = {}));
|
|
7402
7358
|
|
|
7403
|
-
exports.TmsType = void 0;
|
|
7404
|
-
(function (TmsType) {
|
|
7405
|
-
TmsType["WMS"] = "WMS";
|
|
7406
|
-
TmsType["TMS"] = "TMS";
|
|
7407
|
-
TmsType["ArcGIS"] = "ArcGIS";
|
|
7408
|
-
})(exports.TmsType || (exports.TmsType = {}));
|
|
7409
7359
|
exports.EditGeometryType = void 0;
|
|
7410
7360
|
(function (EditGeometryType) {
|
|
7411
7361
|
EditGeometryType["Raster"] = "raster";
|
|
@@ -7547,7 +7497,7 @@ const useEditControl = (type, elementConfig) => {
|
|
|
7547
7497
|
attributes,
|
|
7548
7498
|
]);
|
|
7549
7499
|
const dataSource = React.useMemo(() => dataSources?.find(({ name }) => name === control.relatedDataSource), [control.relatedDataSource, dataSources]);
|
|
7550
|
-
const items = React.useMemo(() => dataSource?.features.map(item => item.
|
|
7500
|
+
const items = React.useMemo(() => dataSource?.features.map(item => item.properties[control?.attributeName] || null) || [], [dataSource?.features, control?.attributeName]);
|
|
7551
7501
|
const onChange = React.useCallback((newValue) => {
|
|
7552
7502
|
changeControls({
|
|
7553
7503
|
[control?.targetAttributeName]: newValue,
|
|
@@ -7918,8 +7868,8 @@ const HeaderTitle = ({ noFeature }) => {
|
|
|
7918
7868
|
const { t } = useGlobalContext();
|
|
7919
7869
|
const { attributes, layerInfo, feature } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
7920
7870
|
const zoomToFeatures = useZoomToFeatures();
|
|
7921
|
-
const {
|
|
7922
|
-
const resultDescription = alias || name || "";
|
|
7871
|
+
const { configuration, layerDefinition } = layerInfo || {};
|
|
7872
|
+
const resultDescription = configuration?.alias || configuration?.name || "";
|
|
7923
7873
|
const resultTitle = React.useMemo(() => {
|
|
7924
7874
|
const layerDefinitionAttribute = layerDefinition && attributes?.length
|
|
7925
7875
|
? attributes.find(item => item.name === layerDefinition.titleAttribute)
|
|
@@ -7967,20 +7917,20 @@ var img = "data:image/svg+xml,%3csvg width='32' height='32' viewBox='0 0 32 32'
|
|
|
7967
7917
|
|
|
7968
7918
|
const LayerIcon = ({ layerInfo, error }) => {
|
|
7969
7919
|
const renderSymbol = React.useMemo(() => {
|
|
7970
|
-
if (!layerInfo
|
|
7920
|
+
if (!layerInfo?.layerDefinition?.geometryType || error) {
|
|
7971
7921
|
return (jsxRuntime.jsx(AlertIconContainer, { children: jsxRuntime.jsx(uilibGl.Icon, { kind: "warning" }) }));
|
|
7972
7922
|
}
|
|
7973
|
-
switch (layerInfo
|
|
7974
|
-
case api.
|
|
7923
|
+
switch (layerInfo?.layerDefinition?.geometryType) {
|
|
7924
|
+
case api.OgcGeometryType.MultiLineString:
|
|
7975
7925
|
return jsxRuntime.jsx("img", { src: img$1, alt: "" });
|
|
7976
|
-
case api.
|
|
7977
|
-
case api.
|
|
7926
|
+
case api.OgcGeometryType.Polygon:
|
|
7927
|
+
case api.OgcGeometryType.MultiPolygon:
|
|
7978
7928
|
return jsxRuntime.jsx("img", { src: img, alt: "" });
|
|
7979
|
-
case api.
|
|
7929
|
+
case api.OgcGeometryType.Point:
|
|
7980
7930
|
default:
|
|
7981
7931
|
return jsxRuntime.jsx("img", { src: img$2, alt: "" });
|
|
7982
7932
|
}
|
|
7983
|
-
}, [layerInfo
|
|
7933
|
+
}, [layerInfo?.layerDefinition?.geometryType]);
|
|
7984
7934
|
return jsxRuntime.jsx(LayerIconContainer, { children: renderSymbol });
|
|
7985
7935
|
};
|
|
7986
7936
|
|
|
@@ -8524,8 +8474,8 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
8524
8474
|
return [];
|
|
8525
8475
|
}
|
|
8526
8476
|
return dataSource.features.map(item => ({
|
|
8527
|
-
value: item.
|
|
8528
|
-
text: item.
|
|
8477
|
+
value: item.properties?.[attributeName] || "",
|
|
8478
|
+
text: item.properties?.[control?.attributeName || attributeName] || "",
|
|
8529
8479
|
}));
|
|
8530
8480
|
}, [control?.attributeName, dataSource?.features, attributeName]);
|
|
8531
8481
|
const isDisabled = React.useMemo(() => {
|
|
@@ -8861,7 +8811,7 @@ const ElementSlideshow = ({ elementConfig, type, renderElement }) => {
|
|
|
8861
8811
|
const images = React.useMemo(() => {
|
|
8862
8812
|
const dataSource = relatedDataSource ? dataSources?.find(({ name }) => name === relatedDataSource) : null;
|
|
8863
8813
|
const array = dataSource
|
|
8864
|
-
? dataSource.features.map(feature => feature.
|
|
8814
|
+
? dataSource.features.map(feature => feature.properties[attributeName])
|
|
8865
8815
|
: getSlideshowImages({
|
|
8866
8816
|
element: elementConfig,
|
|
8867
8817
|
attribute: attributes?.find(({ name }) => name === attributeName),
|
|
@@ -9044,20 +8994,20 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
|
|
|
9044
8994
|
}
|
|
9045
8995
|
const { colors } = config.options;
|
|
9046
8996
|
const layerDefinition = getLayerDefinition(layerInfo);
|
|
9047
|
-
let data =
|
|
8997
|
+
let data = [...dataSource?.features];
|
|
9048
8998
|
const sortAttribute = config?.options?.orderByValue
|
|
9049
8999
|
? relatedConfig.attributeName
|
|
9050
9000
|
: config?.options?.orderByTitle
|
|
9051
9001
|
? relatedConfig.attributeTitle
|
|
9052
9002
|
: null;
|
|
9053
9003
|
if (sortAttribute) {
|
|
9054
|
-
data.sort((a, b) => b.
|
|
9004
|
+
data.sort((a, b) => b.properties[sortAttribute] - a.properties[sortAttribute]);
|
|
9055
9005
|
}
|
|
9056
9006
|
const isOtherSliced = config?.options?.otherItems && config.options.otherItems < data.length;
|
|
9057
9007
|
const otherValue = isOtherSliced
|
|
9058
9008
|
? data
|
|
9059
9009
|
.slice(config.options.otherItems)
|
|
9060
|
-
.reduce((prev, {
|
|
9010
|
+
.reduce((prev, { properties }) => prev + properties[relatedConfig.attributeName], 0)
|
|
9061
9011
|
: null;
|
|
9062
9012
|
if (isOtherSliced) {
|
|
9063
9013
|
data = data.slice(0, config?.options?.otherItems);
|
|
@@ -9073,9 +9023,9 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
|
|
|
9073
9023
|
if (relatedConfig?.filterName && !filter) {
|
|
9074
9024
|
return acc;
|
|
9075
9025
|
}
|
|
9076
|
-
const attributeName = feature.
|
|
9077
|
-
const attributeTitle = feature.
|
|
9078
|
-
const attributeColor = feature.
|
|
9026
|
+
const attributeName = feature.properties[relatedConfig.attributeName];
|
|
9027
|
+
const attributeTitle = feature.properties[relatedConfig.attributeTitle];
|
|
9028
|
+
const attributeColor = feature.properties[relatedConfig.attributeColor];
|
|
9079
9029
|
return [
|
|
9080
9030
|
...acc,
|
|
9081
9031
|
{
|
|
@@ -9087,8 +9037,8 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
|
|
|
9087
9037
|
}),
|
|
9088
9038
|
value: attributeName === null ? null : Number(attributeName),
|
|
9089
9039
|
color: attributeColor || gradientArray?.[index] || FEATURE_CARD_OTHER_COLOR,
|
|
9090
|
-
min: filter?.attributeMin ? feature.
|
|
9091
|
-
max: filter?.attributeMin ? feature.
|
|
9040
|
+
min: filter?.attributeMin ? feature.properties[filter.attributeMin] : null,
|
|
9041
|
+
max: filter?.attributeMin ? feature.properties[filter.attributeMax] : null
|
|
9092
9042
|
}
|
|
9093
9043
|
];
|
|
9094
9044
|
}, []);
|
|
@@ -9383,7 +9333,7 @@ function getFeatureAttributes(feature = {}, layer, dataSource) {
|
|
|
9383
9333
|
if (!layerDefinition) {
|
|
9384
9334
|
return [];
|
|
9385
9335
|
}
|
|
9386
|
-
const currentAttributes = !feature && dataSource ? dataSource.features[0].
|
|
9336
|
+
const currentAttributes = !feature && dataSource ? dataSource.features[0].properties : feature?.properties;
|
|
9387
9337
|
const { id: idValue } = feature || {};
|
|
9388
9338
|
const { idAttribute, attributes } = layerDefinition || {};
|
|
9389
9339
|
const layerAttributes = idAttribute
|
|
@@ -9400,10 +9350,10 @@ function getFeatureAttributes(feature = {}, layer, dataSource) {
|
|
|
9400
9350
|
readOnly: true,
|
|
9401
9351
|
}
|
|
9402
9352
|
: {
|
|
9403
|
-
value: currentAttributes?.[attributeName] || dataSource?.features?.[0]?.
|
|
9353
|
+
value: currentAttributes?.[attributeName] || dataSource?.features?.[0]?.properties?.[attributeName],
|
|
9404
9354
|
readOnly: isCalculated || !isEditable,
|
|
9405
9355
|
};
|
|
9406
|
-
const clientData = layer
|
|
9356
|
+
const clientData = layer?.configuration?.attributesConfiguration?.attributes?.find(layerAttribute => layerAttribute.attributeName === attributeName)?.clientData;
|
|
9407
9357
|
return {
|
|
9408
9358
|
id: attributeName,
|
|
9409
9359
|
name: attributeName,
|
|
@@ -9574,10 +9524,10 @@ const getListOptions = (items, filterName, configFilters) => {
|
|
|
9574
9524
|
if (!filter)
|
|
9575
9525
|
return [];
|
|
9576
9526
|
return (items?.map(item => ({
|
|
9577
|
-
text: item.
|
|
9578
|
-
value: item.
|
|
9579
|
-
min: filter.attributeMin ? item.
|
|
9580
|
-
max: filter.attributeMax ? item.
|
|
9527
|
+
text: item.properties[filter.attributeAlias || DEFAULT_ATTRIBUTE_NAME],
|
|
9528
|
+
value: item.properties[filter.attributeValue || DEFAULT_ATTRIBUTE_NAME],
|
|
9529
|
+
min: filter.attributeMin ? item.properties[filter.attributeMin] : null,
|
|
9530
|
+
max: filter.attributeMax ? item.properties[filter.attributeMax] : null,
|
|
9581
9531
|
})) || []);
|
|
9582
9532
|
};
|
|
9583
9533
|
|
|
@@ -9702,7 +9652,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9702
9652
|
const [selectedPixels, setSelectedPixels] = React.useState(null);
|
|
9703
9653
|
const { filterName } = filter.options;
|
|
9704
9654
|
const { options } = elementConfig;
|
|
9705
|
-
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 || {};
|
|
9655
|
+
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 || {};
|
|
9706
9656
|
const barFullWidth = barWidth + padding;
|
|
9707
9657
|
const { filters: configFilters } = currentPage;
|
|
9708
9658
|
const configFilter = React.useMemo(() => getConfigFilter(filterName, configFilters), [configFilters, filterName]);
|
|
@@ -9717,9 +9667,9 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9717
9667
|
dataSourceName: configFilter?.relatedDataSource,
|
|
9718
9668
|
attributeName: configFilter?.attributeValue,
|
|
9719
9669
|
attributeTitle: configFilter?.attributeAlias,
|
|
9720
|
-
attributeColor: colorAttribute
|
|
9670
|
+
attributeColor: colorAttribute,
|
|
9721
9671
|
},
|
|
9722
|
-
layerInfo: { layerDefinition: { attributes: dataSource?.attributeDefinition } }
|
|
9672
|
+
layerInfo: { layerDefinition: { attributes: dataSource?.attributeDefinition } },
|
|
9723
9673
|
}), [
|
|
9724
9674
|
colorAttribute,
|
|
9725
9675
|
configFilter?.attributeAlias,
|
|
@@ -9728,7 +9678,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9728
9678
|
configFilters,
|
|
9729
9679
|
dataSource,
|
|
9730
9680
|
elementConfig,
|
|
9731
|
-
t
|
|
9681
|
+
t,
|
|
9732
9682
|
]);
|
|
9733
9683
|
const amount = React.useMemo(() => filterItems?.length || 0, [filterItems?.length]);
|
|
9734
9684
|
const width = React.useMemo(() => configWidth || amount * barFullWidth, [amount, barFullWidth, configWidth]);
|
|
@@ -9764,8 +9714,8 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9764
9714
|
...item,
|
|
9765
9715
|
color: selectedRange && index >= selectedRange[0] && index <= selectedRange[1]
|
|
9766
9716
|
? primaryColor || theme.palette.primary
|
|
9767
|
-
: defaultColor || theme.palette.elementDeep
|
|
9768
|
-
}
|
|
9717
|
+
: defaultColor || theme.palette.elementDeep,
|
|
9718
|
+
},
|
|
9769
9719
|
];
|
|
9770
9720
|
});
|
|
9771
9721
|
}, [defaultColor, hasDefinedColors, primaryColor, selectedRange, theme.palette.elementDeep, theme.palette.primary]);
|
|
@@ -9793,8 +9743,8 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9793
9743
|
[filterName]: {
|
|
9794
9744
|
value: valueRange,
|
|
9795
9745
|
min: valueRange[0],
|
|
9796
|
-
max: valueRange[1]
|
|
9797
|
-
}
|
|
9746
|
+
max: valueRange[1],
|
|
9747
|
+
},
|
|
9798
9748
|
}, configFilter?.resetFilters);
|
|
9799
9749
|
}, [changeFilters, configFilter?.resetFilters, filterName, getValueRange]);
|
|
9800
9750
|
const prevDisabled = React.useMemo(() => loading || !selectedPixels || selectedPixels?.[0] - barFullWidth < 0, [barFullWidth, loading, selectedPixels]);
|
|
@@ -9852,7 +9802,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9852
9802
|
onPrev,
|
|
9853
9803
|
onNext,
|
|
9854
9804
|
onSelect,
|
|
9855
|
-
onBarClick
|
|
9805
|
+
onBarClick,
|
|
9856
9806
|
};
|
|
9857
9807
|
};
|
|
9858
9808
|
const BarChartFilter = ({ type, config, elementConfig, filter }) => {
|
|
@@ -9860,7 +9810,7 @@ const BarChartFilter = ({ type, config, elementConfig, filter }) => {
|
|
|
9860
9810
|
const { configFilters, loading, height, data, barWidth, barHeight, attributeValue, padding, selectedRange, prevDisabled, nextDisabled, onPrev, onNext, ...rest } = useBarChartFilter({
|
|
9861
9811
|
type,
|
|
9862
9812
|
elementConfig,
|
|
9863
|
-
filter
|
|
9813
|
+
filter,
|
|
9864
9814
|
});
|
|
9865
9815
|
const renderSelectedRange = React.useMemo(() => {
|
|
9866
9816
|
if (!selectedRange)
|
|
@@ -9889,8 +9839,8 @@ const RangeDateFilter = ({ type, filter }) => {
|
|
|
9889
9839
|
const { filterName, label, minValue, maxValue, withTime } = filter.options;
|
|
9890
9840
|
const configFilter = React.useMemo(() => getConfigFilter(filterName, configFilters), [configFilters, filterName]);
|
|
9891
9841
|
const dataSource = React.useMemo(() => getDataSource(configFilter?.relatedDataSource, dataSources), [configFilter?.relatedDataSource, dataSources]);
|
|
9892
|
-
const { minFromData, maxFromData } = React.useMemo(() => dataSource?.features?.reduce((prev, {
|
|
9893
|
-
const date = getDate(
|
|
9842
|
+
const { minFromData, maxFromData } = React.useMemo(() => dataSource?.features?.reduce((prev, { properties }) => {
|
|
9843
|
+
const date = getDate(properties[configFilter?.attributeValue]);
|
|
9894
9844
|
return {
|
|
9895
9845
|
minFromData: !prev.minFromData ? date : date < prev.minFromData ? date : prev.minFromData,
|
|
9896
9846
|
maxFromData: !prev.maxFromData ? date : date > prev.maxFromData ? date : prev.maxFromData
|
|
@@ -10111,7 +10061,7 @@ const ChipsFilter = ({ type, filter, elementConfig, }) => {
|
|
|
10111
10061
|
return [];
|
|
10112
10062
|
const features = dataSource.features;
|
|
10113
10063
|
return features.map(feature => {
|
|
10114
|
-
const attrs = feature.
|
|
10064
|
+
const attrs = feature.properties;
|
|
10115
10065
|
const text = attrs[configFilter.attributeAlias || DEFAULT_ATTRIBUTE_NAME];
|
|
10116
10066
|
const value = attrs[configFilter.attributeValue || DEFAULT_ATTRIBUTE_NAME];
|
|
10117
10067
|
const chipIcon = iconAttribute
|
|
@@ -10284,21 +10234,21 @@ const getProxyService = (layer) => {
|
|
|
10284
10234
|
if (!isProxyService(layer))
|
|
10285
10235
|
return {
|
|
10286
10236
|
layers: [],
|
|
10287
|
-
sourceType: "",
|
|
10288
10237
|
sourceUrl: "",
|
|
10289
|
-
|
|
10238
|
+
sourceType: "",
|
|
10239
|
+
layerDefinition: layer?.layerDefinition,
|
|
10290
10240
|
legend: {
|
|
10291
10241
|
layers: [],
|
|
10292
10242
|
},
|
|
10293
10243
|
};
|
|
10294
|
-
const { layers, sourceType, sourceUrl, legend,
|
|
10244
|
+
const { layers, sourceType, sourceUrl, legend, layerDefinition } = layer;
|
|
10295
10245
|
return {
|
|
10296
10246
|
layers: layers || [],
|
|
10297
|
-
copyrightText: copyrightText || "",
|
|
10298
10247
|
sourceUrl: sourceUrl || "",
|
|
10299
10248
|
sourceType: sourceType || "",
|
|
10249
|
+
layerDefinition,
|
|
10300
10250
|
legend: {
|
|
10301
|
-
layers:
|
|
10251
|
+
layers: legend?.layers || [],
|
|
10302
10252
|
},
|
|
10303
10253
|
};
|
|
10304
10254
|
};
|
|
@@ -10313,10 +10263,12 @@ function getLayerInfo(layer) {
|
|
|
10313
10263
|
name: layer?.name || "",
|
|
10314
10264
|
configuration: {
|
|
10315
10265
|
...configuration,
|
|
10266
|
+
name: layer?.name || "",
|
|
10316
10267
|
layers: configLayers.filter(isCompositeLayerConfiguration),
|
|
10317
10268
|
attributesConfiguration,
|
|
10318
10269
|
},
|
|
10319
|
-
acl:
|
|
10270
|
+
acl: layer?.acl,
|
|
10271
|
+
layerDefinition,
|
|
10320
10272
|
condition: ("condition" in configuration && configuration.condition) || undefined,
|
|
10321
10273
|
tableName: attributesConfiguration.tableName,
|
|
10322
10274
|
idAttribute: attributesConfiguration.idAttribute,
|
|
@@ -10357,8 +10309,8 @@ const getSlideshowImages = ({ element, attribute, }) => {
|
|
|
10357
10309
|
|
|
10358
10310
|
const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
|
|
10359
10311
|
let url = "";
|
|
10360
|
-
if (elementConfig.attributeIcon && layerInfo
|
|
10361
|
-
const iconAttribute = layerInfo.
|
|
10312
|
+
if (elementConfig.attributeIcon && layerInfo?.configuration?.attributesConfiguration?.attributes) {
|
|
10313
|
+
const iconAttribute = layerInfo?.configuration?.attributesConfiguration?.attributes.find(({ attributeName }) => attributeName === elementConfig.attributeIcon)?.icon;
|
|
10362
10314
|
url = iconAttribute?.resourceId || iconAttribute?.url;
|
|
10363
10315
|
}
|
|
10364
10316
|
else {
|
|
@@ -10640,7 +10592,7 @@ const useChartData = ({ element, type }) => {
|
|
|
10640
10592
|
relatedConfig: relatedAxis,
|
|
10641
10593
|
dataSource: featureDataSource,
|
|
10642
10594
|
layerInfo: layerInfo ||
|
|
10643
|
-
{ layerDefinition: { attributes: featureDataSource.attributeDefinition } }
|
|
10595
|
+
{ layerDefinition: { attributes: featureDataSource.attributeDefinition } },
|
|
10644
10596
|
})
|
|
10645
10597
|
: null,
|
|
10646
10598
|
color: axisColor,
|
|
@@ -10659,8 +10611,8 @@ const useChartData = ({ element, type }) => {
|
|
|
10659
10611
|
attributeName: null,
|
|
10660
10612
|
attributeUnits: null,
|
|
10661
10613
|
dataSourceName: null,
|
|
10662
|
-
color: null
|
|
10663
|
-
}
|
|
10614
|
+
color: null,
|
|
10615
|
+
},
|
|
10664
10616
|
];
|
|
10665
10617
|
}, [
|
|
10666
10618
|
currentPage?.dataSources,
|
|
@@ -10670,7 +10622,7 @@ const useChartData = ({ element, type }) => {
|
|
|
10670
10622
|
t,
|
|
10671
10623
|
attributes,
|
|
10672
10624
|
layerInfos,
|
|
10673
|
-
dataSources
|
|
10625
|
+
dataSources,
|
|
10674
10626
|
]);
|
|
10675
10627
|
const [data, setData] = React.useState(fetchedData);
|
|
10676
10628
|
React.useEffect(() => {
|
|
@@ -10779,7 +10731,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10779
10731
|
const queryResponse = await api.eql.getPagedQueryResult({ saveInHistory: false }, getProps);
|
|
10780
10732
|
const descriptionResponse = await api.eql.getQueryDescription(getProps);
|
|
10781
10733
|
return {
|
|
10782
|
-
items: queryResponse.
|
|
10734
|
+
items: queryResponse.features,
|
|
10783
10735
|
attributeDefinition: descriptionResponse,
|
|
10784
10736
|
};
|
|
10785
10737
|
}
|
|
@@ -10827,7 +10779,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10827
10779
|
!!currentDataSources[index].url ||
|
|
10828
10780
|
!!currentDataSources[index].resourceId;
|
|
10829
10781
|
newDataSources[index].layerName = currentDataSources[index].layerName;
|
|
10830
|
-
const items = response.status === "rejected" ? null : response.value?.
|
|
10782
|
+
const items = response.status === "rejected" ? null : response.value?.features || response.items;
|
|
10831
10783
|
newDataSources[index].features =
|
|
10832
10784
|
response.status === "rejected"
|
|
10833
10785
|
? null
|
|
@@ -11262,7 +11214,7 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
11262
11214
|
const attribute = layerInfo?.layerDefinition.attributes[attributeName];
|
|
11263
11215
|
const dataSource = getDataSource(dataSourceName, dataSources);
|
|
11264
11216
|
const units = attributeUnits
|
|
11265
|
-
? dataSource?.features?.[0]?.
|
|
11217
|
+
? dataSource?.features?.[0]?.properties?.[attributeUnits]
|
|
11266
11218
|
: attribute?.stringFormat?.unitsLabel;
|
|
11267
11219
|
const formatValue = attribute
|
|
11268
11220
|
? formatAttributeValue({
|
|
@@ -11482,8 +11434,8 @@ const FeatureCardHeader = () => {
|
|
|
11482
11434
|
const FeatureCardTitle = ({ title, description }) => {
|
|
11483
11435
|
const { t } = useGlobalContext();
|
|
11484
11436
|
const { attributes, layerInfo, feature } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
11485
|
-
const {
|
|
11486
|
-
const resultDescription = description || alias || name || "";
|
|
11437
|
+
const { configuration, layerDefinition } = layerInfo || {};
|
|
11438
|
+
const resultDescription = description || configuration?.alias || configuration?.name || "";
|
|
11487
11439
|
const resultTitle = React.useMemo(() => {
|
|
11488
11440
|
const layerDefinitionAttribute = layerDefinition && attributes?.length
|
|
11489
11441
|
? attributes.find(item => item.name === layerDefinition.titleAttribute)
|
|
@@ -11491,8 +11443,8 @@ const FeatureCardTitle = ({ title, description }) => {
|
|
|
11491
11443
|
const layerDefinitionTitle = layerDefinition?.titleAttribute && layerDefinitionAttribute?.value
|
|
11492
11444
|
? layerDefinitionAttribute.value
|
|
11493
11445
|
: null;
|
|
11494
|
-
const sourceTitleAttribute = titleAttribute && attributes?.length ? attributes.find(item => item.name === titleAttribute) : null;
|
|
11495
|
-
const sourceTitle = titleAttribute && sourceTitleAttribute?.value ? sourceTitleAttribute.value : null;
|
|
11446
|
+
const sourceTitleAttribute = layerDefinition?.titleAttribute && attributes?.length ? attributes.find(item => item.name === layerDefinition?.titleAttribute) : null;
|
|
11447
|
+
const sourceTitle = layerDefinition?.titleAttribute && sourceTitleAttribute?.value ? sourceTitleAttribute.value : null;
|
|
11496
11448
|
return (title ||
|
|
11497
11449
|
(!!sourceTitle &&
|
|
11498
11450
|
formatAttributeValue({ t, type: sourceTitleAttribute.type, value: sourceTitle, stringFormat: sourceTitleAttribute.stringFormat })) ||
|
|
@@ -11504,7 +11456,7 @@ const FeatureCardTitle = ({ title, description }) => {
|
|
|
11504
11456
|
stringFormat: layerDefinitionAttribute.stringFormat,
|
|
11505
11457
|
})) ||
|
|
11506
11458
|
feature?.id);
|
|
11507
|
-
}, [attributes, feature?.id, layerDefinition, title
|
|
11459
|
+
}, [attributes, feature?.id, layerDefinition, title]);
|
|
11508
11460
|
return (jsxRuntime.jsxs(HeaderTitleContainer, { children: [jsxRuntime.jsx(FeatureTitleContainer, { children: jsxRuntime.jsx(uilibGl.FlexSpan, { children: resultTitle }) }), jsxRuntime.jsx(LayerDescription, { title: resultDescription, children: resultDescription })] }));
|
|
11509
11461
|
};
|
|
11510
11462
|
|
|
@@ -11822,22 +11774,22 @@ const RasterLayer = ({ layer, tileUrl, visible, beforeId, filterVersion, }) => {
|
|
|
11822
11774
|
|
|
11823
11775
|
const getClientStyleItemPrefixSuffix = (geometryType, itemType) => {
|
|
11824
11776
|
switch (geometryType) {
|
|
11825
|
-
case api.
|
|
11777
|
+
case api.OgcGeometryType.Point:
|
|
11826
11778
|
switch (itemType) {
|
|
11827
11779
|
case "symbol":
|
|
11828
11780
|
return ["point-label-layer-", "-label"];
|
|
11829
11781
|
default:
|
|
11830
11782
|
return ["point-layer-", ""];
|
|
11831
11783
|
}
|
|
11832
|
-
case api.
|
|
11784
|
+
case api.OgcGeometryType.MultiLineString:
|
|
11833
11785
|
switch (itemType) {
|
|
11834
11786
|
case "symbol":
|
|
11835
11787
|
return ["polyline-label-layer-", "-label"];
|
|
11836
11788
|
default:
|
|
11837
11789
|
return ["polyline-layer-", ""];
|
|
11838
11790
|
}
|
|
11839
|
-
case api.
|
|
11840
|
-
case api.
|
|
11791
|
+
case api.OgcGeometryType.Polygon:
|
|
11792
|
+
case api.OgcGeometryType.MultiPolygon:
|
|
11841
11793
|
switch (itemType) {
|
|
11842
11794
|
case "line":
|
|
11843
11795
|
return ["polygon-stroke-layer-", "-stroke"];
|
|
@@ -11853,6 +11805,52 @@ const getClientStyleItemPrefixSuffix = (geometryType, itemType) => {
|
|
|
11853
11805
|
}
|
|
11854
11806
|
};
|
|
11855
11807
|
|
|
11808
|
+
const findAttributeInExpression = (expression) => {
|
|
11809
|
+
if (Array.isArray(expression) && expression.length === 2 && expression[0] === "get") {
|
|
11810
|
+
return [expression[1]];
|
|
11811
|
+
}
|
|
11812
|
+
return expression.reduce((acc, curr) => {
|
|
11813
|
+
if (!Array.isArray(curr)) {
|
|
11814
|
+
return acc;
|
|
11815
|
+
}
|
|
11816
|
+
if (curr[0] === "get") {
|
|
11817
|
+
return [...new Set([...acc, curr[1]])];
|
|
11818
|
+
}
|
|
11819
|
+
return [...new Set([...acc, ...findAttributeInExpression(curr)])];
|
|
11820
|
+
}, []);
|
|
11821
|
+
};
|
|
11822
|
+
|
|
11823
|
+
const getActualExtrusionHeight = (paint) => {
|
|
11824
|
+
return Array.isArray(paint?.["fill-extrusion-height"]) && paint?.["fill-extrusion-height"][0] === "+"
|
|
11825
|
+
? paint?.["fill-extrusion-height"][1]
|
|
11826
|
+
: paint?.["fill-extrusion-height"];
|
|
11827
|
+
};
|
|
11828
|
+
|
|
11829
|
+
const extractAttributesFromObject = (obj) => {
|
|
11830
|
+
if (!obj || lodash.isEmpty(obj)) {
|
|
11831
|
+
return [];
|
|
11832
|
+
}
|
|
11833
|
+
return Object.entries(obj).reduce((acc, [, value]) => {
|
|
11834
|
+
if (!Array.isArray(value)) {
|
|
11835
|
+
return acc;
|
|
11836
|
+
}
|
|
11837
|
+
return [...new Set([...acc, ...findAttributeInExpression(value)])];
|
|
11838
|
+
}, []);
|
|
11839
|
+
};
|
|
11840
|
+
const parseClientStyle = (style) => {
|
|
11841
|
+
if (!style) {
|
|
11842
|
+
return [];
|
|
11843
|
+
}
|
|
11844
|
+
return style?.items?.reduce((acc, curr) => {
|
|
11845
|
+
const paintAttributes = extractAttributesFromObject(curr.paint);
|
|
11846
|
+
const layoutAttributes = extractAttributesFromObject(curr.layout);
|
|
11847
|
+
const filterAttributes = curr.filter
|
|
11848
|
+
? findAttributeInExpression(curr.filter)
|
|
11849
|
+
: [];
|
|
11850
|
+
return [...new Set([...acc, ...paintAttributes, ...layoutAttributes, ...filterAttributes])];
|
|
11851
|
+
}, []);
|
|
11852
|
+
};
|
|
11853
|
+
|
|
11856
11854
|
const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, filterVersion, }) => {
|
|
11857
11855
|
const clientStyle = layer?.configuration?.clientStyle;
|
|
11858
11856
|
const { idAttribute, geometryType } = layer.layerDefinition || {};
|
|
@@ -11884,7 +11882,7 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
|
|
|
11884
11882
|
const renderLayerByGeometryType = React.useCallback(() => {
|
|
11885
11883
|
const visibility = visible ? "visible" : "none";
|
|
11886
11884
|
switch (geometryType) {
|
|
11887
|
-
case api.
|
|
11885
|
+
case api.OgcGeometryType.Point:
|
|
11888
11886
|
return (jsxRuntime.jsx(MapGL.Layer, { id: layer.name, type: "circle", "source-layer": "default", beforeId: beforeId, layout: {
|
|
11889
11887
|
...getLayerTempStyle?.(layer.name, "circle")?.layout,
|
|
11890
11888
|
visibility,
|
|
@@ -11892,8 +11890,8 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
|
|
|
11892
11890
|
...DEFAULT_CIRCLE_PAINT,
|
|
11893
11891
|
...getLayerTempStyle?.(layer.name, "circle")?.paint,
|
|
11894
11892
|
} }));
|
|
11895
|
-
case api.
|
|
11896
|
-
case api.
|
|
11893
|
+
case api.OgcGeometryType.Polygon:
|
|
11894
|
+
case api.OgcGeometryType.MultiPolygon:
|
|
11897
11895
|
return [
|
|
11898
11896
|
jsxRuntime.jsx(MapGL.Layer, { id: layer.name, type: "fill", "source-layer": "default", beforeId: beforeId, layout: {
|
|
11899
11897
|
...getLayerTempStyle?.(layer.name, "fill")?.layout,
|
|
@@ -11931,7 +11929,7 @@ const VectorLayer = ({ layer, tileUrl, visible, beforeId, getLayerTempStyle, fil
|
|
|
11931
11929
|
...getLayerTempStyle?.(layer.name, "fill-extrusion")?.paint,
|
|
11932
11930
|
} }, `polygon-extrusion-layer-${layer.name}`),
|
|
11933
11931
|
];
|
|
11934
|
-
case api.
|
|
11932
|
+
case api.OgcGeometryType.MultiLineString:
|
|
11935
11933
|
return (jsxRuntime.jsx(MapGL.Layer, { id: layer.name, type: "line", "source-layer": "default", beforeId: beforeId, layout: {
|
|
11936
11934
|
...getLayerTempStyle?.(layer.name, "line")?.layout,
|
|
11937
11935
|
visibility,
|
|
@@ -12203,7 +12201,6 @@ exports.applyQueryFilters = applyQueryFilters;
|
|
|
12203
12201
|
exports.applyVarsToCondition = applyVarsToCondition;
|
|
12204
12202
|
exports.checkEqualOrIncludes = checkEqualOrIncludes;
|
|
12205
12203
|
exports.checkIsLoading = checkIsLoading;
|
|
12206
|
-
exports.convertSpToTurfFeature = convertSpToTurfFeature;
|
|
12207
12204
|
exports.createConfigLayer = createConfigLayer;
|
|
12208
12205
|
exports.createConfigPage = createConfigPage;
|
|
12209
12206
|
exports.createNewPageId = createNewPageId;
|
|
@@ -12274,6 +12271,7 @@ exports.isNumeric = isNumeric;
|
|
|
12274
12271
|
exports.isObject = isObject;
|
|
12275
12272
|
exports.isProxyService = isProxyService;
|
|
12276
12273
|
exports.isVisibleContainer = isVisibleContainer;
|
|
12274
|
+
exports.metersPerPixel = metersPerPixel;
|
|
12277
12275
|
exports.numberOptions = numberOptions;
|
|
12278
12276
|
exports.parseClientStyle = parseClientStyle;
|
|
12279
12277
|
exports.parseIconNames = parseIconNames;
|