@dynatrace/strato-geo 3.5.2 → 3.7.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/esm/map/MapView.js +42 -34
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleCircleLayer.js +2 -0
- package/esm/map/components/BubbleLayer/BubbleCircleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayer.js +14 -3
- package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js +9 -3
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js.map +2 -2
- package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js +5 -5
- package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +15 -7
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +9 -3
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +3 -1
- package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +6 -5
- package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js +11 -6
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +3 -0
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +16 -12
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +20 -18
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayer.js +12 -3
- package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayerTooltip.js +9 -3
- package/esm/map/components/DotLayer/DotLayerTooltip.js.map +2 -2
- package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js +5 -5
- package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js.map +2 -2
- package/esm/map/components/MapContent.js +22 -12
- package/esm/map/components/MapContent.js.map +2 -2
- package/esm/map/contexts/geo-data-lookup.context.js +8 -0
- package/esm/map/contexts/geo-data-lookup.context.js.map +7 -0
- package/esm/map/contexts/map-view-provider.context.js +9 -0
- package/esm/map/contexts/map-view-provider.context.js.map +7 -0
- package/esm/map/hooks/use-active-interaction.js +59 -43
- package/esm/map/hooks/use-active-interaction.js.map +2 -2
- package/esm/map/hooks/use-attach-image-from-icon.js +4 -2
- package/esm/map/hooks/use-attach-image-from-icon.js.map +2 -2
- package/esm/map/hooks/use-hover-interaction.js +59 -41
- package/esm/map/hooks/use-hover-interaction.js.map +2 -2
- package/esm/map/hooks/use-layer-before-id.js +24 -0
- package/esm/map/hooks/use-layer-before-id.js.map +7 -0
- package/esm/map/hooks/use-load-map-base-layer.js +13 -3
- package/esm/map/hooks/use-load-map-base-layer.js.map +2 -2
- package/esm/map/hooks/use-map-runtime-error.js +93 -0
- package/esm/map/hooks/use-map-runtime-error.js.map +7 -0
- package/esm/map/hooks/use-map-view-provider-context.js +7 -0
- package/esm/map/hooks/use-map-view-provider-context.js.map +7 -0
- package/esm/map/hooks/use-overlay-events.js +11 -2
- package/esm/map/hooks/use-overlay-events.js.map +2 -2
- package/esm/map/hooks/use-tooltip-template.js +17 -2
- package/esm/map/hooks/use-tooltip-template.js.map +2 -2
- package/esm/map/hooks/use-webgl-context-error.js +2 -1
- package/esm/map/hooks/use-webgl-context-error.js.map +2 -2
- package/esm/map/index.js +2 -0
- package/esm/map/index.js.map +2 -2
- package/esm/map/providers/map-view.provider.js +18 -0
- package/esm/map/providers/map-view.provider.js.map +7 -0
- package/esm/map/slots/Tooltip.js.map +2 -2
- package/esm/map/types/map-view-provider.js +1 -0
- package/esm/map/types/map-view-provider.js.map +7 -0
- package/esm/map/utils/attach-image-from-shape.js +4 -2
- package/esm/map/utils/attach-image-from-shape.js.map +2 -2
- package/esm/map/utils/extract-layers-data.js +24 -15
- package/esm/map/utils/extract-layers-data.js.map +2 -2
- package/esm/map/utils/fetch-base-layer-features.js +1 -1
- package/esm/map/utils/fetch-base-layer-features.js.map +2 -2
- package/esm/map/utils/is-browser-firefox.js +7 -0
- package/esm/map/utils/is-browser-firefox.js.map +7 -0
- package/esm/map/utils/parse-tooltip-data.js +22 -7
- package/esm/map/utils/parse-tooltip-data.js.map +2 -2
- package/map/MapView.js +42 -34
- package/map/components/BubbleLayer/BubbleCircleLayer.d.ts +2 -1
- package/map/components/BubbleLayer/BubbleCircleLayer.js +2 -0
- package/map/components/BubbleLayer/BubbleLayer.js +14 -3
- package/map/components/BubbleLayer/BubbleLayerTooltip.d.ts +2 -0
- package/map/components/BubbleLayer/BubbleLayerTooltip.js +9 -3
- package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.d.ts +3 -1
- package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js +5 -5
- package/map/components/ChoroplethLayer/ChoroplethLayer.js +15 -7
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.d.ts +2 -0
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +9 -3
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.d.ts +1 -0
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +3 -1
- package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.d.ts +3 -1
- package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +6 -5
- package/map/components/ConnectionLayer/ConnectionLayer.js +11 -6
- package/map/components/ConnectionLayer/ConnectionLayerLine.js +3 -0
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.d.ts +2 -0
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +16 -12
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.d.ts +3 -1
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +20 -18
- package/map/components/DotLayer/DotLayer.js +12 -3
- package/map/components/DotLayer/DotLayerTooltip.d.ts +2 -0
- package/map/components/DotLayer/DotLayerTooltip.js +9 -3
- package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.d.ts +3 -1
- package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js +5 -5
- package/map/components/MapContent.js +21 -12
- package/map/contexts/geo-data-lookup.context.d.ts +9 -0
- package/map/contexts/geo-data-lookup.context.js +27 -0
- package/map/contexts/map-view-provider.context.d.ts +2 -0
- package/map/{components/ConnectionLayer/utils/restore-null-props.js → contexts/map-view-provider.context.js} +8 -8
- package/map/hooks/use-active-interaction.d.ts +8 -1
- package/map/hooks/use-active-interaction.js +58 -42
- package/map/hooks/use-attach-image-from-icon.js +4 -2
- package/map/hooks/use-hover-interaction.d.ts +6 -2
- package/map/hooks/use-hover-interaction.js +52 -39
- package/map/hooks/use-layer-before-id.d.ts +13 -0
- package/map/hooks/{use-map-mouse-move.js → use-layer-before-id.js} +20 -15
- package/map/hooks/use-load-map-base-layer.js +13 -3
- package/map/hooks/use-map-runtime-error.d.ts +34 -0
- package/map/hooks/use-map-runtime-error.js +112 -0
- package/map/hooks/use-map-view-provider-context.d.ts +1 -0
- package/map/hooks/use-map-view-provider-context.js +26 -0
- package/map/hooks/use-overlay-events.js +11 -2
- package/map/hooks/use-tooltip-template.d.ts +8 -0
- package/map/hooks/use-tooltip-template.js +17 -2
- package/map/hooks/use-webgl-context-error.js +2 -1
- package/map/index.d.ts +2 -0
- package/map/index.js +2 -0
- package/map/providers/map-view.provider.d.ts +7 -0
- package/map/providers/map-view.provider.js +37 -0
- package/map/slots/Tooltip.d.ts +2 -0
- package/map/types/connection-layer.d.ts +1 -8
- package/map/types/map-view-provider.d.ts +10 -0
- package/map/types/map-view-provider.js +16 -0
- package/map/types/tooltip.d.ts +17 -0
- package/map/utils/attach-image-from-shape.js +4 -2
- package/map/utils/extract-layers-data.d.ts +2 -0
- package/map/utils/extract-layers-data.js +24 -15
- package/map/utils/fetch-base-layer-features.js +1 -1
- package/map/utils/is-browser-firefox.d.ts +5 -0
- package/map/utils/is-browser-firefox.js +26 -0
- package/map/utils/parse-tooltip-data.d.ts +11 -3
- package/map/utils/parse-tooltip-data.js +22 -7
- package/package.json +2 -2
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js +0 -9
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js.map +0 -7
- package/esm/map/hooks/use-map-mouse-move.js +0 -19
- package/esm/map/hooks/use-map-mouse-move.js.map +0 -7
- package/map/components/ConnectionLayer/utils/restore-null-props.d.ts +0 -2
- package/map/hooks/use-map-mouse-move.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isUndefined } from "lodash-es";
|
|
2
2
|
import { CDN_BASE_PATH } from "../constants.js";
|
|
3
3
|
const cache = /* @__PURE__ */ new Map();
|
|
4
|
-
const MAPS_WITH_DISPUTED_BORDERS = ["IN", "IL", "CN"];
|
|
4
|
+
const MAPS_WITH_DISPUTED_BORDERS = ["IN", "IL", "CN", "MA"];
|
|
5
5
|
const getWorldViewParam = (countryCode) => MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : "";
|
|
6
6
|
const fetchWorldViewFeatures = async (tenantCountryCode) => {
|
|
7
7
|
const worldViewParam = getWorldViewParam(tenantCountryCode);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/fetch-base-layer-features.ts"],
|
|
4
|
-
"sourcesContent": ["import type { FeatureCollection } from 'geojson';\nimport { isUndefined } from 'lodash-es';\n\nimport { CDN_BASE_PATH } from '../constants.js';\n\nconst cache = new Map<string, FeatureCollection>();\n\nconst MAPS_WITH_DISPUTED_BORDERS = ['IN', 'IL', 'CN'];\n\nconst getWorldViewParam = (countryCode: string): string =>\n MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : '';\n\nexport const fetchWorldViewFeatures = async (\n tenantCountryCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = worldViewParam || 'default';\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}WORLD-COUNTRIES.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\nexport const fetchCountryFeatures = async (\n tenantCountryCode: string,\n regionCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = `${worldViewParam || 'default'}-${regionCode}`;\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}${regionCode}.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\n/**\n * @internal\n * Only used in unit tests to reset the map features cache\n */\nexport const _clearCache = () => {\n cache.clear();\n};\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAE9B,MAAM,QAAQ,oBAAI,IAA+B;AAEjD,MAAM,6BAA6B,CAAC,MAAM,MAAM,IAAI;
|
|
4
|
+
"sourcesContent": ["import type { FeatureCollection } from 'geojson';\nimport { isUndefined } from 'lodash-es';\n\nimport { CDN_BASE_PATH } from '../constants.js';\n\nconst cache = new Map<string, FeatureCollection>();\n\nconst MAPS_WITH_DISPUTED_BORDERS = ['IN', 'IL', 'CN', 'MA'];\n\nconst getWorldViewParam = (countryCode: string): string =>\n MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : '';\n\nexport const fetchWorldViewFeatures = async (\n tenantCountryCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = worldViewParam || 'default';\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}WORLD-COUNTRIES.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\nexport const fetchCountryFeatures = async (\n tenantCountryCode: string,\n regionCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = `${worldViewParam || 'default'}-${regionCode}`;\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}${regionCode}.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\n/**\n * @internal\n * Only used in unit tests to reset the map features cache\n */\nexport const _clearCache = () => {\n cache.clear();\n};\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAE9B,MAAM,QAAQ,oBAAI,IAA+B;AAEjD,MAAM,6BAA6B,CAAC,MAAM,MAAM,MAAM,IAAI;AAE1D,MAAM,oBAAoB,CAAC,gBACzB,2BAA2B,SAAS,WAAW,IAAI,GAAG,WAAW,MAAM;AAElE,MAAM,yBAAyB,OACpC,sBAC+B;AAC/B,QAAM,iBAAiB,kBAAkB,iBAAiB;AAE1D,QAAM,WAAW,kBAAkB;AAEnC,MAAI,WAAW,MAAM,IAAI,QAAQ;AAEjC,MAAI,YAAY,QAAQ,GAAG;AACzB,UAAM,MAAM,MAAM;AAAA,MAChB,GAAG,aAAa,GAAG,cAAc;AAAA,IACnC;AAEA,eAAY,MAAM,IAAI,KAAK;AAE3B,UAAM,IAAI,UAAU,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAEO,MAAM,uBAAuB,OAClC,mBACA,eAC+B;AAC/B,QAAM,iBAAiB,kBAAkB,iBAAiB;AAE1D,QAAM,WAAW,GAAG,kBAAkB,SAAS,IAAI,UAAU;AAE7D,MAAI,WAAW,MAAM,IAAI,QAAQ;AAEjC,MAAI,YAAY,QAAQ,GAAG;AACzB,UAAM,MAAM,MAAM;AAAA,MAChB,GAAG,aAAa,GAAG,cAAc,GAAG,UAAU;AAAA,IAChD;AAEA,eAAY,MAAM,IAAI,KAAK;AAE3B,UAAM,IAAI,UAAU,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAMO,MAAM,cAAc,MAAM;AAC/B,QAAM,MAAM;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/map/utils/is-browser-firefox.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @returns true if is firefox browser, false otherwise\n * @internal\n */\nexport function isFirefox() {\n return (\n typeof navigator !== 'undefined' &&\n navigator.userAgent.toLowerCase().includes('firefox')\n );\n}\n"],
|
|
5
|
+
"mappings": "AAIO,SAAS,YAAY;AAC1B,SACE,OAAO,cAAc,eACrB,UAAU,UAAU,YAAY,EAAE,SAAS,SAAS;AAExD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -16,20 +16,35 @@ const parseFeatureProperties = (featureProperties) => {
|
|
|
16
16
|
}
|
|
17
17
|
return properties;
|
|
18
18
|
};
|
|
19
|
-
const
|
|
19
|
+
const resolveSourceId = (feature) => feature.source ?? feature.layer?.source;
|
|
20
|
+
const restoreDataFromLookup = (sourceId, dataIndex, registry) => {
|
|
21
|
+
if (registry === void 0 || sourceId === void 0 || dataIndex === void 0) {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
const lookup = registry.get(sourceId);
|
|
25
|
+
return lookup?.get(dataIndex);
|
|
26
|
+
};
|
|
27
|
+
const parseTooltipData = (features, registry) => {
|
|
20
28
|
const data = [];
|
|
21
29
|
for (const feature of features) {
|
|
22
30
|
const properties = parseFeatureProperties(feature.properties);
|
|
23
|
-
const
|
|
31
|
+
const sourceId = resolveSourceId(feature);
|
|
32
|
+
const { __dataIndex, ...visibleProperties } = properties;
|
|
33
|
+
const dataIndex = typeof __dataIndex === "number" ? __dataIndex : void 0;
|
|
34
|
+
const originalData = restoreDataFromLookup(sourceId, dataIndex, registry);
|
|
35
|
+
const coordinates = feature.geometry.type === "Point" ? {
|
|
36
|
+
longitude: feature.geometry.coordinates[0],
|
|
37
|
+
latitude: feature.geometry.coordinates[1]
|
|
38
|
+
} : {};
|
|
24
39
|
data.push({
|
|
25
|
-
...
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
...visibleProperties,
|
|
41
|
+
...originalData !== void 0 ? { data: originalData } : {},
|
|
42
|
+
...coordinates
|
|
28
43
|
});
|
|
29
44
|
}
|
|
30
45
|
return data;
|
|
31
46
|
};
|
|
32
|
-
const extractDataFromEvent = (event) => {
|
|
47
|
+
const extractDataFromEvent = (event, registry) => {
|
|
33
48
|
if (!event.features?.length) {
|
|
34
49
|
return {};
|
|
35
50
|
}
|
|
@@ -38,7 +53,7 @@ const extractDataFromEvent = (event) => {
|
|
|
38
53
|
const hoveredFeatures = event.features.filter(
|
|
39
54
|
(feature2) => feature2.layer.id === hoveredLayerId
|
|
40
55
|
);
|
|
41
|
-
const data = parseTooltipData(hoveredFeatures);
|
|
56
|
+
const data = parseTooltipData(hoveredFeatures, registry);
|
|
42
57
|
return {
|
|
43
58
|
featureId: `${hoveredLayerId}-${feature.id}`,
|
|
44
59
|
hoveredLayerId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/parse-tooltip-data.ts"],
|
|
4
|
-
"sourcesContent": ["import type
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl';\n\nimport type { GeoDataLookupRegistry } from '../contexts/geo-data-lookup.context.js';\n\n/**\n * Tries to deserialize an object, if serialized\n * @param serializedObject - string\n */\nconst deserializeObject = (\n serializedObject: string,\n): string | Record<string, unknown> => {\n try {\n return JSON.parse(serializedObject);\n } catch {\n return serializedObject;\n }\n};\n\n/**\n * Deserializes map feature properties that are serialized\n *\n * @param featureProperties - map feature properties\n */\nconst parseFeatureProperties = (featureProperties: Record<string, unknown>) => {\n const properties: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(featureProperties)) {\n if (typeof value === 'string') {\n properties[key] = deserializeObject(value);\n } else {\n properties[key] = value;\n }\n }\n\n return properties;\n};\n\n/**\n * Resolves the source ID from a feature, looking at either the\n * `source` property or the `layer.source` property.\n */\nconst resolveSourceId = (feature: MapGeoJSONFeature): string | undefined =>\n feature.source ?? feature.layer?.source;\n\n/**\n * Restores full user data from the data lookup registry using the\n * `__dataIndex` stored in the feature's properties.\n *\n * Returns the original data object if found, or undefined if not.\n */\nconst restoreDataFromLookup = (\n sourceId: string | undefined,\n dataIndex: number | undefined,\n registry: GeoDataLookupRegistry | undefined,\n): unknown => {\n if (\n registry === undefined ||\n sourceId === undefined ||\n dataIndex === undefined\n ) {\n return undefined;\n }\n\n const lookup = registry.get(sourceId);\n return lookup?.get(dataIndex);\n};\n\n/**\n * Extracts useful map features data for the tooltip.\n *\n * When a data lookup registry is provided, the full original data\n * is restored from the `__dataIndex` stored in GeoJSON properties.\n * This allows GeoJSON features to carry only rendering-relevant\n * fields while still providing full data for tooltips.\n *\n * @param features - map features\n * @param registry - optional data lookup registry for restoring full data\n */\nexport const parseTooltipData = (\n features: MapGeoJSONFeature[],\n registry?: GeoDataLookupRegistry,\n) => {\n const data: unknown[] = [];\n\n for (const feature of features) {\n const properties = parseFeatureProperties(feature.properties);\n\n const sourceId = resolveSourceId(feature);\n const { __dataIndex, ...visibleProperties } = properties;\n const dataIndex = typeof __dataIndex === 'number' ? __dataIndex : undefined;\n const originalData = restoreDataFromLookup(sourceId, dataIndex, registry);\n\n const coordinates =\n feature.geometry.type === 'Point'\n ? {\n longitude: feature.geometry.coordinates[0],\n latitude: feature.geometry.coordinates[1],\n }\n : {};\n\n data.push({\n ...visibleProperties,\n ...(originalData !== undefined ? { data: originalData } : {}),\n ...coordinates,\n });\n }\n\n return data;\n};\n\nexport const extractDataFromEvent = (\n event: MapLayerMouseEvent,\n registry?: GeoDataLookupRegistry,\n) => {\n if (!event.features?.length) {\n return {};\n }\n const feature = event.features[0];\n const hoveredLayerId = feature.layer.id;\n const hoveredFeatures = event.features.filter(\n (feature) => feature.layer.id === hoveredLayerId,\n );\n\n const data = parseTooltipData(hoveredFeatures, registry);\n\n return {\n featureId: `${hoveredLayerId}-${feature.id}`,\n hoveredLayerId,\n data,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAQA,MAAM,oBAAoB,CACxB,qBACqC;AACrC,MAAI;AACF,WAAO,KAAK,MAAM,gBAAgB;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOA,MAAM,yBAAyB,CAAC,sBAA+C;AAC7E,QAAM,aAAsC,CAAC;AAE7C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,iBAAiB,GAAG;AAC5D,QAAI,OAAO,UAAU,UAAU;AAC7B,iBAAW,GAAG,IAAI,kBAAkB,KAAK;AAAA,IAC3C,OAAO;AACL,iBAAW,GAAG,IAAI;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AACT;AAMA,MAAM,kBAAkB,CAAC,YACvB,QAAQ,UAAU,QAAQ,OAAO;AAQnC,MAAM,wBAAwB,CAC5B,UACA,WACA,aACY;AACZ,MACE,aAAa,UACb,aAAa,UACb,cAAc,QACd;AACA,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,SAAS,IAAI,QAAQ;AACpC,SAAO,QAAQ,IAAI,SAAS;AAC9B;AAaO,MAAM,mBAAmB,CAC9B,UACA,aACG;AACH,QAAM,OAAkB,CAAC;AAEzB,aAAW,WAAW,UAAU;AAC9B,UAAM,aAAa,uBAAuB,QAAQ,UAAU;AAE5D,UAAM,WAAW,gBAAgB,OAAO;AACxC,UAAM,EAAE,aAAa,GAAG,kBAAkB,IAAI;AAC9C,UAAM,YAAY,OAAO,gBAAgB,WAAW,cAAc;AAClE,UAAM,eAAe,sBAAsB,UAAU,WAAW,QAAQ;AAExE,UAAM,cACJ,QAAQ,SAAS,SAAS,UACtB;AAAA,MACE,WAAW,QAAQ,SAAS,YAAY,CAAC;AAAA,MACzC,UAAU,QAAQ,SAAS,YAAY,CAAC;AAAA,IAC1C,IACA,CAAC;AAEP,SAAK,KAAK;AAAA,MACR,GAAG;AAAA,MACH,GAAI,iBAAiB,SAAY,EAAE,MAAM,aAAa,IAAI,CAAC;AAAA,MAC3D,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAEO,MAAM,uBAAuB,CAClC,OACA,aACG;AACH,MAAI,CAAC,MAAM,UAAU,QAAQ;AAC3B,WAAO,CAAC;AAAA,EACV;AACA,QAAM,UAAU,MAAM,SAAS,CAAC;AAChC,QAAM,iBAAiB,QAAQ,MAAM;AACrC,QAAM,kBAAkB,MAAM,SAAS;AAAA,IACrC,CAACA,aAAYA,SAAQ,MAAM,OAAO;AAAA,EACpC;AAEA,QAAM,OAAO,iBAAiB,iBAAiB,QAAQ;AAEvD,SAAO;AAAA,IACL,WAAW,GAAG,cAAc,IAAI,QAAQ,EAAE;AAAA,IAC1C;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["feature"]
|
|
7
7
|
}
|
package/map/MapView.js
CHANGED
|
@@ -30,6 +30,7 @@ var import_MapContent = require("./components/MapContent.js");
|
|
|
30
30
|
var import_MapUnavailable = require("./components/MapUnavailable.js");
|
|
31
31
|
var import_constants = require("./constants.js");
|
|
32
32
|
var import_formatter_context = require("./contexts/formatter.context.js");
|
|
33
|
+
var import_geo_data_lookup_context = require("./contexts/geo-data-lookup.context.js");
|
|
33
34
|
var import_layer_ids_context = require("./contexts/layer-ids.context.js");
|
|
34
35
|
var import_map_base_layer_context = require("./contexts/map-base-layer.context.js");
|
|
35
36
|
var import_map_configuration_context = require("./contexts/map-configuration.context.js");
|
|
@@ -69,7 +70,8 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
69
70
|
const {
|
|
70
71
|
flattenData: layersData,
|
|
71
72
|
categories,
|
|
72
|
-
legendDomain
|
|
73
|
+
legendDomain,
|
|
74
|
+
dataLookupRegistry
|
|
73
75
|
} = (0, import_extract_layers_data.extractLayersData)(parsedChildren, valueAccessors);
|
|
74
76
|
const config = (0, import_iterate_config_slots.iterateConfigSlots)(children, legendDomain);
|
|
75
77
|
const getMaxRange = () => {
|
|
@@ -119,43 +121,49 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
119
121
|
import_map_truncation_mode_context.MapTruncationModeContext.Provider,
|
|
120
122
|
{
|
|
121
123
|
value: truncationMode ?? import_constants.DEFAULT_TRUNCATION_MODE,
|
|
122
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_formatter_context.FormatterContext.Provider, { value: formatter, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_map_raw_data_context.MapRawDataContext.Provider, { value: layersData, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
|
-
|
|
124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_formatter_context.FormatterContext.Provider, { value: formatter, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_map_raw_data_context.MapRawDataContext.Provider, { value: layersData, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
import_geo_data_lookup_context.GeoDataLookupContext.Provider,
|
|
124
126
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
import_charts._ChartLayout,
|
|
127
|
+
value: dataLookupRegistry,
|
|
128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._OverlayProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._OverlayTooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_map_store_provider.MapStoreProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
+
import_color_scale_provider.ColorScaleProvider,
|
|
129
130
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
131
|
+
categories,
|
|
132
|
+
dataMax,
|
|
133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layer_color_strategy_provider.LayerColorStrategyProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
134
|
+
import_charts._ChartLayout,
|
|
135
|
+
{
|
|
136
|
+
ref: chartLayoutRef,
|
|
137
|
+
chartHeight,
|
|
138
|
+
errorState,
|
|
139
|
+
showLoader: loading || isLoading,
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._ChartLayout.Graph, { children: baseFeatureCollection && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
142
|
+
import_MapContent.MapContent,
|
|
143
|
+
{
|
|
144
|
+
ref: forwardedRef,
|
|
145
|
+
onMapLoad: () => setIsMapLoaded(true),
|
|
146
|
+
...remaining,
|
|
147
|
+
children: parsedChildren
|
|
148
|
+
}
|
|
149
|
+
) }),
|
|
150
|
+
!isLegendHidden && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
151
|
+
import_charts._ChartLayout.Legend,
|
|
152
|
+
{
|
|
153
|
+
position: legendPosition,
|
|
154
|
+
ratio: legendRatio,
|
|
155
|
+
ratioBoundaries: import_constants.DEFAULT_LEGEND_SIZES,
|
|
156
|
+
onResize: legendOnRatioChange,
|
|
157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MapLegendRenderer.MapLegendRenderer, {})
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
) })
|
|
155
163
|
}
|
|
156
|
-
) })
|
|
164
|
+
) }) }) })
|
|
157
165
|
}
|
|
158
|
-
) }) })
|
|
166
|
+
) }) })
|
|
159
167
|
}
|
|
160
168
|
) }) })
|
|
161
169
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BehaviorTrackingProps } from '@dynatrace/strato-components/core';
|
|
2
|
-
export declare const BubbleCircleLayer: ({ id, source, ...behavioralTrackingProps }: {
|
|
2
|
+
export declare const BubbleCircleLayer: ({ id, source, beforeId, ...behavioralTrackingProps }: {
|
|
3
3
|
id: string;
|
|
4
4
|
source: string;
|
|
5
|
+
beforeId?: string;
|
|
5
6
|
} & BehaviorTrackingProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,6 +29,7 @@ var import_constants = require("../../constants.js");
|
|
|
29
29
|
const BubbleCircleLayer = ({
|
|
30
30
|
id,
|
|
31
31
|
source,
|
|
32
|
+
beforeId,
|
|
32
33
|
...behavioralTrackingProps
|
|
33
34
|
}) => {
|
|
34
35
|
const sizeInterpolation = (0, import_use_size_interpolation.useSizeInterpolation)();
|
|
@@ -39,6 +40,7 @@ const BubbleCircleLayer = ({
|
|
|
39
40
|
type: "circle",
|
|
40
41
|
id,
|
|
41
42
|
source,
|
|
43
|
+
beforeId,
|
|
42
44
|
paint: {
|
|
43
45
|
"circle-color": [
|
|
44
46
|
"case",
|
|
@@ -31,6 +31,7 @@ var import_size_interpolation_context = require("./contexts/size-interpolation.c
|
|
|
31
31
|
var import_build_radius_scale = require("./utils/build-radius-scale.js");
|
|
32
32
|
var import_parse_bubble_data_to_geo_json = require("./utils/parse-bubble-data-to-geo-json.js");
|
|
33
33
|
var import_constants = require("../../constants.js");
|
|
34
|
+
var import_use_layer_before_id = require("../../hooks/use-layer-before-id.js");
|
|
34
35
|
var import_use_layer_coloring_strategy = require("../../hooks/use-layer-coloring-strategy.js");
|
|
35
36
|
var import_use_legend_interaction_highlighting = require("../../hooks/use-legend-interaction-highlighting.js");
|
|
36
37
|
var import_use_legend_interaction_visibility = require("../../hooks/use-legend-interaction-visibility.js");
|
|
@@ -58,24 +59,32 @@ const BubbleLayer = (props) => {
|
|
|
58
59
|
const sourceId = `source-${layerId}`;
|
|
59
60
|
(0, import_use_legend_interaction_highlighting.useLegendInteractionHighlighting)(props, sourceId);
|
|
60
61
|
(0, import_use_legend_interaction_visibility.useLegendInteractionVisibility)(props, layerId);
|
|
62
|
+
const beforeId = (0, import_use_layer_before_id.useLayerBeforeId)(layerId);
|
|
61
63
|
let radiusScale = (value) => value;
|
|
62
64
|
if ((0, import_bubble_layer.isScaleRadius)(props)) {
|
|
63
65
|
const { radiusRange = [10, 100], radius: radius2, scale = "linear" } = props;
|
|
64
66
|
radiusScale = (0, import_build_radius_scale.buildRadiusScale)(data, radius2, scale, radiusRange);
|
|
65
67
|
}
|
|
66
|
-
const dataGeoJson = (0, import_parse_bubble_data_to_geo_json.parseBubbleDataToGeoJSON)(
|
|
68
|
+
const { geoJson: dataGeoJson } = (0, import_parse_bubble_data_to_geo_json.parseBubbleDataToGeoJSON)(
|
|
67
69
|
data,
|
|
68
70
|
bubbleColor,
|
|
69
71
|
radius,
|
|
70
72
|
radiusScale
|
|
71
73
|
);
|
|
72
|
-
const
|
|
74
|
+
const {
|
|
75
|
+
handler: tooltipTemplate,
|
|
76
|
+
hidden: tooltipHidden,
|
|
77
|
+
symbolAlignment
|
|
78
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_BubbleLayerTooltip2.BubbleLayerTooltip, {
|
|
79
|
+
extractProps: true
|
|
80
|
+
});
|
|
73
81
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_size_interpolation_context.SizeInterpolationContext.Provider, { value: sizeInterpolation, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: dataGeoJson, generateId: true, children: [
|
|
74
82
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
83
|
import_BubbleCircleLayer.BubbleCircleLayer,
|
|
76
84
|
{
|
|
77
85
|
id: layerId,
|
|
78
86
|
source: sourceId,
|
|
87
|
+
beforeId,
|
|
79
88
|
...behavioralTrackingProps
|
|
80
89
|
}
|
|
81
90
|
),
|
|
@@ -83,7 +92,9 @@ const BubbleLayer = (props) => {
|
|
|
83
92
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
93
|
import_BubbleLayerTooltip.BubbleLayerTooltip,
|
|
85
94
|
{
|
|
86
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isBubbleTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
95
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isBubbleTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
96
|
+
hidden: tooltipHidden,
|
|
97
|
+
symbolAlignment
|
|
87
98
|
}
|
|
88
99
|
) })
|
|
89
100
|
] }) });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { BubbleLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface BubbleLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: BubbleLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const BubbleLayerTooltip: {
|
|
6
8
|
(props: BubbleLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -27,9 +27,9 @@ var import_charts = require("@dynatrace/strato-components/charts");
|
|
|
27
27
|
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
28
28
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
29
29
|
const BubbleLayerTooltip = (props) => {
|
|
30
|
-
const { tooltipTemplate } = props;
|
|
30
|
+
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
31
31
|
const { data, inBounds, position } = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoBubble");
|
|
32
|
-
if (!tooltipTemplate || !inBounds || !position) {
|
|
32
|
+
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
if (!data || !data[0]) {
|
|
@@ -55,6 +55,12 @@ const BubbleLayerTooltip = (props) => {
|
|
|
55
55
|
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
56
56
|
return template;
|
|
57
57
|
}
|
|
58
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
import_charts._OverlayTooltip,
|
|
60
|
+
{
|
|
61
|
+
legacyTemplate: template,
|
|
62
|
+
symbolAlignment
|
|
63
|
+
}
|
|
64
|
+
);
|
|
59
65
|
};
|
|
60
66
|
BubbleLayerTooltip["displayName"] = "BubbleLayerTooltip";
|
|
@@ -2,5 +2,7 @@ import type { ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
|
2
2
|
import type GeoJSON from 'geojson';
|
|
3
3
|
import type { Location } from '../../../types/location.js';
|
|
4
4
|
type RadiusScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number> | ((value: number) => number);
|
|
5
|
-
export declare const parseBubbleDataToGeoJSON: <T extends Location>(data: T[], color: string | ((item: T) => string), radius: number | ((item: T) => number), scale: RadiusScale) =>
|
|
5
|
+
export declare const parseBubbleDataToGeoJSON: <T extends Location>(data: T[], color: string | ((item: T) => string), radius: number | ((item: T) => number), scale: RadiusScale) => {
|
|
6
|
+
geoJson: GeoJSON.FeatureCollection;
|
|
7
|
+
};
|
|
6
8
|
export {};
|
|
@@ -26,18 +26,17 @@ var import_define_radius = require("./define-radius.js");
|
|
|
26
26
|
var import_calculate_hovered_color = require("../../../utils/calculate-hovered-color.js");
|
|
27
27
|
var import_define_color = require("../../../utils/define-color.js");
|
|
28
28
|
const parseBubbleDataToGeoJSON = (data, color, radius, scale) => {
|
|
29
|
-
|
|
29
|
+
const geoJson = {
|
|
30
30
|
type: "FeatureCollection",
|
|
31
|
-
features: data.map((feature) => {
|
|
32
|
-
const { longitude, latitude
|
|
31
|
+
features: data.map((feature, index) => {
|
|
32
|
+
const { longitude, latitude } = feature;
|
|
33
33
|
const canvasColor = (0, import_charts._getCanvasColor)((0, import_define_color.defineColor)(color, feature));
|
|
34
34
|
const hoveredColor = (0, import_calculate_hovered_color.calculateHoveredColor)(canvasColor);
|
|
35
35
|
const scaledRadius = scale((0, import_define_radius.defineRadius)(radius, feature));
|
|
36
36
|
return {
|
|
37
37
|
type: "Feature",
|
|
38
38
|
properties: {
|
|
39
|
-
|
|
40
|
-
...properties,
|
|
39
|
+
__dataIndex: index,
|
|
41
40
|
__color: canvasColor,
|
|
42
41
|
__hoveredColor: hoveredColor,
|
|
43
42
|
__radius: scaledRadius,
|
|
@@ -47,4 +46,5 @@ const parseBubbleDataToGeoJSON = (data, color, radius, scale) => {
|
|
|
47
46
|
};
|
|
48
47
|
})
|
|
49
48
|
};
|
|
49
|
+
return { geoJson };
|
|
50
50
|
};
|
|
@@ -28,6 +28,7 @@ var import_ChoroplethLayerTooltip = require("./ChoroplethLayerTooltip.js");
|
|
|
28
28
|
var import_ChoroplethOutlineLayer = require("./ChoroplethOutlineLayer.js");
|
|
29
29
|
var import_parse_region_data_to_geo_json = require("./utils/parse-region-data-to-geo-json.js");
|
|
30
30
|
var import_constants = require("../../constants.js");
|
|
31
|
+
var import_use_layer_before_id = require("../../hooks/use-layer-before-id.js");
|
|
31
32
|
var import_use_layer_coloring_strategy = require("../../hooks/use-layer-coloring-strategy.js");
|
|
32
33
|
var import_use_legend_interaction_highlighting = require("../../hooks/use-legend-interaction-highlighting.js");
|
|
33
34
|
var import_use_legend_interaction_visibility = require("../../hooks/use-legend-interaction-visibility.js");
|
|
@@ -50,11 +51,15 @@ const ChoroplethLayer = (props) => {
|
|
|
50
51
|
const sourceId = layerId.replace("layer", "source");
|
|
51
52
|
(0, import_use_legend_interaction_highlighting.useLegendInteractionHighlighting)(props, sourceId);
|
|
52
53
|
(0, import_use_legend_interaction_visibility.useLegendInteractionVisibility)(props, layerId);
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const beforeId = (0, import_use_layer_before_id.useLayerBeforeId)(layerId);
|
|
55
|
+
const dataGeoJSON = mapSource ? (0, import_parse_region_data_to_geo_json.parseRegionDataToGeoJSON)(mapSource, data, regionAccessor, choroplethColor).geoJson : void 0;
|
|
56
|
+
const {
|
|
57
|
+
handler: tooltipTemplate,
|
|
58
|
+
hidden: tooltipHidden,
|
|
59
|
+
symbolAlignment
|
|
60
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_ChoroplethLayerTooltip2.ChoroplethLayerTooltip, {
|
|
61
|
+
extractProps: true
|
|
62
|
+
});
|
|
58
63
|
return dataGeoJSON && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true, children: [
|
|
59
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
65
|
import_react_maplibre.Layer,
|
|
@@ -62,6 +67,7 @@ const ChoroplethLayer = (props) => {
|
|
|
62
67
|
id: layerId,
|
|
63
68
|
source: sourceId,
|
|
64
69
|
type: "fill",
|
|
70
|
+
beforeId,
|
|
65
71
|
paint: {
|
|
66
72
|
"fill-color": ["get", "__color"],
|
|
67
73
|
"fill-opacity": [
|
|
@@ -82,11 +88,13 @@ const ChoroplethLayer = (props) => {
|
|
|
82
88
|
...behavioralTrackingProps
|
|
83
89
|
}
|
|
84
90
|
),
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ChoroplethOutlineLayer.ChoroplethOutlineLayer, { sourceId }),
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ChoroplethOutlineLayer.ChoroplethOutlineLayer, { sourceId, beforeId }),
|
|
86
92
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
93
|
import_ChoroplethLayerTooltip.ChoroplethLayerTooltip,
|
|
88
94
|
{
|
|
89
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isChoroplethTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
95
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isChoroplethTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
96
|
+
hidden: tooltipHidden,
|
|
97
|
+
symbolAlignment
|
|
90
98
|
}
|
|
91
99
|
) })
|
|
92
100
|
] });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ChoroplethLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface ChoroplethLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: ChoroplethLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const ChoroplethLayerTooltip: {
|
|
6
8
|
(props: ChoroplethLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -26,9 +26,9 @@ var import_charts = require("@dynatrace/strato-components/charts");
|
|
|
26
26
|
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
27
27
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
28
28
|
const ChoroplethLayerTooltip = (props) => {
|
|
29
|
-
const { tooltipTemplate } = props;
|
|
29
|
+
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
30
30
|
const { data, inBounds, position } = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoChoropleth");
|
|
31
|
-
if (!tooltipTemplate || !inBounds || !position) {
|
|
31
|
+
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
if (!data || !data[0]) {
|
|
@@ -47,6 +47,12 @@ const ChoroplethLayerTooltip = (props) => {
|
|
|
47
47
|
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
48
48
|
return template;
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_charts._OverlayTooltip,
|
|
52
|
+
{
|
|
53
|
+
legacyTemplate: template,
|
|
54
|
+
symbolAlignment
|
|
55
|
+
}
|
|
56
|
+
);
|
|
51
57
|
};
|
|
52
58
|
ChoroplethLayerTooltip["displayName"] = "ChoroplethLayerTooltip";
|
|
@@ -26,7 +26,7 @@ var import_react_maplibre = require("@vis.gl/react-maplibre");
|
|
|
26
26
|
var import_charts = require("@dynatrace/strato-components/charts");
|
|
27
27
|
var import_constants = require("../../constants.js");
|
|
28
28
|
const ChoroplethOutlineLayer = (props) => {
|
|
29
|
-
const { sourceId } = props;
|
|
29
|
+
const { sourceId, beforeId } = props;
|
|
30
30
|
const activeColor = (0, import_charts._getCanvasColor)(import_constants.ACTIVE_COLOR);
|
|
31
31
|
const defaultBoundariesBorderColor = (0, import_charts._getCanvasColor)(
|
|
32
32
|
import_constants.DEFAULT_BOUNDARIES_BORDER_COLOR
|
|
@@ -38,6 +38,7 @@ const ChoroplethOutlineLayer = (props) => {
|
|
|
38
38
|
{
|
|
39
39
|
source: sourceId,
|
|
40
40
|
type: "line",
|
|
41
|
+
beforeId,
|
|
41
42
|
paint: {
|
|
42
43
|
"line-color": [
|
|
43
44
|
"case",
|
|
@@ -65,6 +66,7 @@ const ChoroplethOutlineLayer = (props) => {
|
|
|
65
66
|
{
|
|
66
67
|
source: sourceId,
|
|
67
68
|
type: "line",
|
|
69
|
+
beforeId,
|
|
68
70
|
paint: {
|
|
69
71
|
"line-color": [
|
|
70
72
|
"case",
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type GeoJSON from 'geojson';
|
|
2
|
-
export declare const parseRegionDataToGeoJSON: <T extends Record<string, unknown>>(mapSource: GeoJSON.FeatureCollection, data: T[], regionAccessor: string | ((i: T) => string), color: string | ((i: T) => string)) =>
|
|
2
|
+
export declare const parseRegionDataToGeoJSON: <T extends Record<string, unknown>>(mapSource: GeoJSON.FeatureCollection, data: T[], regionAccessor: string | ((i: T) => string), color: string | ((i: T) => string)) => {
|
|
3
|
+
geoJson: GeoJSON.FeatureCollection;
|
|
4
|
+
};
|
|
@@ -26,7 +26,7 @@ var import_core = require("@dynatrace/strato-components/core");
|
|
|
26
26
|
var import_calculate_hovered_color = require("../../../utils/calculate-hovered-color.js");
|
|
27
27
|
var import_define_color = require("../../../utils/define-color.js");
|
|
28
28
|
const parseRegionDataToGeoJSON = (mapSource, data, regionAccessor, color) => {
|
|
29
|
-
const features = data.reduce((features2, item) => {
|
|
29
|
+
const features = data.reduce((features2, item, index) => {
|
|
30
30
|
let id = "";
|
|
31
31
|
if (typeof regionAccessor === "function") {
|
|
32
32
|
id = regionAccessor(item);
|
|
@@ -44,8 +44,7 @@ const parseRegionDataToGeoJSON = (mapSource, data, regionAccessor, color) => {
|
|
|
44
44
|
properties: {
|
|
45
45
|
name,
|
|
46
46
|
region_type,
|
|
47
|
-
|
|
48
|
-
...item,
|
|
47
|
+
__dataIndex: index,
|
|
49
48
|
__color: canvasColor,
|
|
50
49
|
__hoveredColor: hoveredColor
|
|
51
50
|
}
|
|
@@ -55,7 +54,9 @@ const parseRegionDataToGeoJSON = (mapSource, data, regionAccessor, color) => {
|
|
|
55
54
|
return features2;
|
|
56
55
|
}, []);
|
|
57
56
|
return {
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
geoJson: {
|
|
58
|
+
type: "FeatureCollection",
|
|
59
|
+
features
|
|
60
|
+
}
|
|
60
61
|
};
|
|
61
62
|
};
|
|
@@ -56,16 +56,19 @@ const ConnectionLayer = (props) => {
|
|
|
56
56
|
const sourceId = `source-${layerId}`;
|
|
57
57
|
(0, import_use_legend_interaction_highlighting.useLegendInteractionHighlighting)(props, sourceId);
|
|
58
58
|
(0, import_use_legend_interaction_visibility.useLegendInteractionVisibility)(props, layerId);
|
|
59
|
-
const geoJsonData = (0, import_parse_connection_data_to_geo_json.parseConnectionDataToGeoJSON)(
|
|
59
|
+
const { geoJson: geoJsonData } = (0, import_parse_connection_data_to_geo_json.parseConnectionDataToGeoJSON)(
|
|
60
60
|
data,
|
|
61
61
|
thickness,
|
|
62
62
|
connectionColor,
|
|
63
63
|
curve
|
|
64
64
|
);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const {
|
|
66
|
+
handler: tooltipTemplate,
|
|
67
|
+
hidden: tooltipHidden,
|
|
68
|
+
symbolAlignment
|
|
69
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_ConnectionLayerTooltip2.ConnectionLayerTooltip, {
|
|
70
|
+
extractProps: true
|
|
71
|
+
});
|
|
69
72
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
70
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
74
|
import_ConnectionLayerLine.ConnectionLayerLine,
|
|
@@ -78,7 +81,9 @@ const ConnectionLayer = (props) => {
|
|
|
78
81
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
82
|
import_ConnectionLayerTooltip.ConnectionLayerTooltip,
|
|
80
83
|
{
|
|
81
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isConnectionTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
84
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isConnectionTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
85
|
+
hidden: tooltipHidden,
|
|
86
|
+
symbolAlignment
|
|
82
87
|
}
|
|
83
88
|
) })
|
|
84
89
|
}
|
|
@@ -25,15 +25,18 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
25
25
|
var import_react_maplibre = require("@vis.gl/react-maplibre");
|
|
26
26
|
var import_core = require("@dynatrace/strato-components/core");
|
|
27
27
|
var import_constants = require("../../constants.js");
|
|
28
|
+
var import_use_layer_before_id = require("../../hooks/use-layer-before-id.js");
|
|
28
29
|
const ConnectionLayerLine = (props) => {
|
|
29
30
|
const { geoJsonData, layerId, sourceId, line, children, ...restProps } = props;
|
|
30
31
|
const [behavioralTrackingProps] = (0, import_core._useBehavioralTrackingProps)(restProps);
|
|
32
|
+
const beforeId = (0, import_use_layer_before_id.useLayerBeforeId)(layerId);
|
|
31
33
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: geoJsonData, promoteId: "id", children: [
|
|
32
34
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
35
|
import_react_maplibre.Layer,
|
|
34
36
|
{
|
|
35
37
|
type: "line",
|
|
36
38
|
id: layerId,
|
|
39
|
+
beforeId,
|
|
37
40
|
layout: {
|
|
38
41
|
"line-cap": import_constants.DEFAULT_LINE_CAP,
|
|
39
42
|
"line-join": import_constants.DEFAULT_LINE_JOIN
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ConnectionLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface ConnectionLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: ConnectionLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const ConnectionLayerTooltip: {
|
|
6
8
|
(props: ConnectionLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|