@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
package/map/types/tooltip.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export interface DotLayerTooltipHandlerProps {
|
|
|
38
38
|
children?: DotLayerTooltipHandler | null;
|
|
39
39
|
/** Series actions callback for the default tooltip */
|
|
40
40
|
seriesActions?: (data: Location) => SeriesActionsTemplate;
|
|
41
|
+
/** Whether the tooltip is hidden */
|
|
42
|
+
hidden?: boolean;
|
|
43
|
+
/** Overrides the horizontal alignment of series symbols */
|
|
44
|
+
symbolAlignment?: 'left' | 'right';
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Bubble Tooltip data payload for the tooltip handler callback
|
|
@@ -67,6 +71,10 @@ export interface BubbleLayerTooltipHandlerProps {
|
|
|
67
71
|
children?: BubbleLayerTooltipHandler | null;
|
|
68
72
|
/** Series actions callback for the default tooltip */
|
|
69
73
|
seriesActions?: (location: Location) => SeriesActionsTemplate;
|
|
74
|
+
/** Whether the tooltip is hidden */
|
|
75
|
+
hidden?: boolean;
|
|
76
|
+
/** Overrides the horizontal alignment of series symbols */
|
|
77
|
+
symbolAlignment?: 'left' | 'right';
|
|
70
78
|
}
|
|
71
79
|
/**
|
|
72
80
|
* Connection Tooltip data payload for the tooltip handler callback
|
|
@@ -95,6 +103,10 @@ export interface ConnectionLayerTooltipHandlerProps {
|
|
|
95
103
|
children?: ConnectionLayerTooltipHandler | null;
|
|
96
104
|
/** Series actions callback for the default tooltip */
|
|
97
105
|
seriesActions?: (data: Location) => SeriesActionsTemplate;
|
|
106
|
+
/** Whether the tooltip is hidden */
|
|
107
|
+
hidden?: boolean;
|
|
108
|
+
/** Overrides the horizontal alignment of series symbols */
|
|
109
|
+
symbolAlignment?: 'left' | 'right';
|
|
98
110
|
}
|
|
99
111
|
/**
|
|
100
112
|
* Choropleth Tooltip data payload for the tooltip handler callback
|
|
@@ -125,9 +137,14 @@ export interface ChoroplethLayerTooltipHandlerProps {
|
|
|
125
137
|
children?: ChoroplethLayerTooltipHandler | null;
|
|
126
138
|
/** Series actions callback for the default tooltip */
|
|
127
139
|
seriesActions?: (data: ChoroplethLayerTooltipData) => SeriesActionsTemplate;
|
|
140
|
+
/** Whether the tooltip is hidden */
|
|
141
|
+
hidden?: boolean;
|
|
142
|
+
/** Overrides the horizontal alignment of series symbols */
|
|
143
|
+
symbolAlignment?: 'left' | 'right';
|
|
128
144
|
}
|
|
129
145
|
/**
|
|
130
146
|
* Map Geo Tooltip Props
|
|
131
147
|
* @public
|
|
148
|
+
* @deprecated Use `ChartTooltip` from `@dynatrace/strato-components/charts` instead. Removal: APPDEV-17834
|
|
132
149
|
*/
|
|
133
150
|
export type ChartTooltip = ChartTooltipSlotsType & ChartTooltipTemplateType;
|
|
@@ -25,20 +25,22 @@ var import_attach_image_to_map = require("./attach-image-to-map.js");
|
|
|
25
25
|
var import_create_bitmap_config_options = require("./create-bitmap-config-options.js");
|
|
26
26
|
var import_get_data_uri = require("./get-data-uri.js");
|
|
27
27
|
var import_constants = require("../constants.js");
|
|
28
|
+
var import_is_browser_firefox = require("./is-browser-firefox.js");
|
|
28
29
|
var import_shape_picker = require("../shapes/shape-picker.js");
|
|
29
30
|
const attachImageFromShape = (map, shape, name, outputSize) => {
|
|
30
31
|
const pickedShape = (0, import_shape_picker.getShape)(shape);
|
|
31
32
|
const stringUrl = (0, import_get_data_uri.getDataUri)(encodeURIComponent(pickedShape));
|
|
32
33
|
const img = new Image(import_constants.DEFAULT_INPUT_ICON_SIZE, import_constants.DEFAULT_INPUT_ICON_SIZE);
|
|
33
34
|
img.addEventListener("load", () => {
|
|
34
|
-
createImageBitmap(
|
|
35
|
+
const bitmapPromise = (0, import_is_browser_firefox.isFirefox)() ? createImageBitmap(img, (0, import_create_bitmap_config_options.createBitmapConfigOptions)(outputSize)) : createImageBitmap(
|
|
35
36
|
img,
|
|
36
37
|
0,
|
|
37
38
|
0,
|
|
38
39
|
import_constants.DEFAULT_INPUT_ICON_SIZE,
|
|
39
40
|
import_constants.DEFAULT_INPUT_ICON_SIZE,
|
|
40
41
|
(0, import_create_bitmap_config_options.createBitmapConfigOptions)(outputSize)
|
|
41
|
-
)
|
|
42
|
+
);
|
|
43
|
+
bitmapPromise.then((bitmap) => {
|
|
42
44
|
if (!map) {
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import type { GeoDataLookupRegistry } from '../contexts/geo-data-lookup.context.js';
|
|
2
3
|
/**
|
|
3
4
|
* Extract layers data
|
|
4
5
|
* @param children - MapView children
|
|
@@ -9,4 +10,5 @@ export declare const extractLayersData: (children: ReactNode, valueAccessors: Ma
|
|
|
9
10
|
flattenData: Record<string, unknown>[];
|
|
10
11
|
categories: string[];
|
|
11
12
|
legendDomain: [number, number];
|
|
13
|
+
dataLookupRegistry: GeoDataLookupRegistry;
|
|
12
14
|
};
|
|
@@ -47,17 +47,20 @@ const extractLayersData = (children, valueAccessors) => {
|
|
|
47
47
|
let flattenData = [];
|
|
48
48
|
const categoriesSet = /* @__PURE__ */ new Set();
|
|
49
49
|
let legendDomain = [Infinity, -Infinity];
|
|
50
|
+
const dataLookupRegistry = /* @__PURE__ */ new Map();
|
|
50
51
|
import_react.Children.forEach(children, (child) => {
|
|
51
52
|
if ((0, import_is_component.isComponent)(child, import_BubbleLayer.BubbleLayer) || (0, import_is_component.isComponent)(child, import_DotLayer.DotLayer)) {
|
|
52
|
-
const { data } = child.props;
|
|
53
|
-
|
|
53
|
+
const { data, layerId } = child.props;
|
|
54
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
55
|
+
data.forEach((dataPoint, index) => {
|
|
56
|
+
lookup.set(index, dataPoint);
|
|
54
57
|
const extendedDataPoint = {
|
|
55
58
|
...dataPoint,
|
|
56
|
-
"layer-name":
|
|
59
|
+
"layer-name": layerId
|
|
57
60
|
};
|
|
58
61
|
const category = addCategory(
|
|
59
62
|
extendedDataPoint,
|
|
60
|
-
valueAccessors.get(
|
|
63
|
+
valueAccessors.get(layerId)
|
|
61
64
|
);
|
|
62
65
|
category && categoriesSet.add(category);
|
|
63
66
|
if (typeof category === "number") {
|
|
@@ -65,14 +68,14 @@ const extractLayersData = (children, valueAccessors) => {
|
|
|
65
68
|
}
|
|
66
69
|
flattenData = flattenData.concat(extendedDataPoint);
|
|
67
70
|
});
|
|
71
|
+
dataLookupRegistry.set(`source-${layerId}`, lookup);
|
|
68
72
|
} else if ((0, import_is_component.isComponent)(child, import_ConnectionLayer.ConnectionLayer)) {
|
|
69
|
-
const { data } = child.props;
|
|
73
|
+
const { data, layerId } = child.props;
|
|
74
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
70
75
|
data.forEach((connection, connectionIndex) => {
|
|
76
|
+
lookup.set(connectionIndex, connection);
|
|
71
77
|
if (connection.path.length >= 2) {
|
|
72
|
-
const category = addCategory(
|
|
73
|
-
connection,
|
|
74
|
-
valueAccessors.get(child.props.layerId)
|
|
75
|
-
);
|
|
78
|
+
const category = addCategory(connection, valueAccessors.get(layerId));
|
|
76
79
|
category && categoriesSet.add(category);
|
|
77
80
|
if (typeof category === "number") {
|
|
78
81
|
legendDomain = updateDomain(legendDomain, category);
|
|
@@ -82,24 +85,28 @@ const extractLayersData = (children, valueAccessors) => {
|
|
|
82
85
|
...path,
|
|
83
86
|
"connection-name": `connection-${connectionIndex + 1}`,
|
|
84
87
|
"connection-item-index": pathIndex,
|
|
85
|
-
"layer-name":
|
|
88
|
+
"layer-name": layerId
|
|
86
89
|
};
|
|
87
90
|
flattenData.push(parsedPath);
|
|
88
91
|
});
|
|
89
92
|
}
|
|
90
93
|
});
|
|
94
|
+
dataLookupRegistry.set(`source-${layerId}`, lookup);
|
|
91
95
|
} else if ((0, import_is_component.isComponent)(child, import_ChoroplethLayer.ChoroplethLayer)) {
|
|
92
|
-
const { data, regionAccessor } = child.props;
|
|
93
|
-
|
|
96
|
+
const { data, regionAccessor, layerId } = child.props;
|
|
97
|
+
const sourceId = layerId.replace("layer", "source");
|
|
98
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
99
|
+
data.forEach((dataEntry, index) => {
|
|
100
|
+
lookup.set(index, dataEntry);
|
|
94
101
|
const region = (0, import_lodash_es.isString)(regionAccessor) ? dataEntry[regionAccessor] : regionAccessor(dataEntry);
|
|
95
102
|
const choroplethLayerData = {
|
|
96
103
|
...dataEntry,
|
|
97
104
|
region,
|
|
98
|
-
"layer-name":
|
|
105
|
+
"layer-name": layerId
|
|
99
106
|
};
|
|
100
107
|
const category = addCategory(
|
|
101
108
|
choroplethLayerData,
|
|
102
|
-
valueAccessors.get(
|
|
109
|
+
valueAccessors.get(layerId)
|
|
103
110
|
);
|
|
104
111
|
category && categoriesSet.add(category);
|
|
105
112
|
if (typeof category === "number") {
|
|
@@ -107,11 +114,13 @@ const extractLayersData = (children, valueAccessors) => {
|
|
|
107
114
|
}
|
|
108
115
|
flattenData.push(choroplethLayerData);
|
|
109
116
|
});
|
|
117
|
+
dataLookupRegistry.set(sourceId, lookup);
|
|
110
118
|
}
|
|
111
119
|
});
|
|
112
120
|
return {
|
|
113
121
|
flattenData,
|
|
114
122
|
categories: [...categoriesSet],
|
|
115
|
-
legendDomain
|
|
123
|
+
legendDomain,
|
|
124
|
+
dataLookupRegistry
|
|
116
125
|
};
|
|
117
126
|
};
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(fetch_base_layer_features_exports);
|
|
|
26
26
|
var import_lodash_es = require("lodash");
|
|
27
27
|
var import_constants = require("../constants.js");
|
|
28
28
|
const cache = /* @__PURE__ */ new Map();
|
|
29
|
-
const MAPS_WITH_DISPUTED_BORDERS = ["IN", "IL", "CN"];
|
|
29
|
+
const MAPS_WITH_DISPUTED_BORDERS = ["IN", "IL", "CN", "MA"];
|
|
30
30
|
const getWorldViewParam = (countryCode) => MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : "";
|
|
31
31
|
const fetchWorldViewFeatures = async (tenantCountryCode) => {
|
|
32
32
|
const worldViewParam = getWorldViewParam(tenantCountryCode);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_browser_firefox_exports = {};
|
|
20
|
+
__export(is_browser_firefox_exports, {
|
|
21
|
+
isFirefox: () => isFirefox
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(is_browser_firefox_exports);
|
|
24
|
+
function isFirefox() {
|
|
25
|
+
return typeof navigator !== "undefined" && navigator.userAgent.toLowerCase().includes("firefox");
|
|
26
|
+
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl';
|
|
2
|
+
import type { GeoDataLookupRegistry } from '../contexts/geo-data-lookup.context.js';
|
|
2
3
|
/**
|
|
3
|
-
* Extracts useful map features data for the tooltip
|
|
4
|
+
* Extracts useful map features data for the tooltip.
|
|
5
|
+
*
|
|
6
|
+
* When a data lookup registry is provided, the full original data
|
|
7
|
+
* is restored from the `__dataIndex` stored in GeoJSON properties.
|
|
8
|
+
* This allows GeoJSON features to carry only rendering-relevant
|
|
9
|
+
* fields while still providing full data for tooltips.
|
|
10
|
+
*
|
|
4
11
|
* @param features - map features
|
|
12
|
+
* @param registry - optional data lookup registry for restoring full data
|
|
5
13
|
*/
|
|
6
|
-
export declare const parseTooltipData: (features: MapGeoJSONFeature[]) => unknown[];
|
|
7
|
-
export declare const extractDataFromEvent: (event: MapLayerMouseEvent) => {
|
|
14
|
+
export declare const parseTooltipData: (features: MapGeoJSONFeature[], registry?: GeoDataLookupRegistry) => unknown[];
|
|
15
|
+
export declare const extractDataFromEvent: (event: MapLayerMouseEvent, registry?: GeoDataLookupRegistry) => {
|
|
8
16
|
featureId?: undefined;
|
|
9
17
|
hoveredLayerId?: undefined;
|
|
10
18
|
data?: undefined;
|
|
@@ -40,20 +40,35 @@ const parseFeatureProperties = (featureProperties) => {
|
|
|
40
40
|
}
|
|
41
41
|
return properties;
|
|
42
42
|
};
|
|
43
|
-
const
|
|
43
|
+
const resolveSourceId = (feature) => feature.source ?? feature.layer?.source;
|
|
44
|
+
const restoreDataFromLookup = (sourceId, dataIndex, registry) => {
|
|
45
|
+
if (registry === void 0 || sourceId === void 0 || dataIndex === void 0) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
const lookup = registry.get(sourceId);
|
|
49
|
+
return lookup?.get(dataIndex);
|
|
50
|
+
};
|
|
51
|
+
const parseTooltipData = (features, registry) => {
|
|
44
52
|
const data = [];
|
|
45
53
|
for (const feature of features) {
|
|
46
54
|
const properties = parseFeatureProperties(feature.properties);
|
|
47
|
-
const
|
|
55
|
+
const sourceId = resolveSourceId(feature);
|
|
56
|
+
const { __dataIndex, ...visibleProperties } = properties;
|
|
57
|
+
const dataIndex = typeof __dataIndex === "number" ? __dataIndex : void 0;
|
|
58
|
+
const originalData = restoreDataFromLookup(sourceId, dataIndex, registry);
|
|
59
|
+
const coordinates = feature.geometry.type === "Point" ? {
|
|
60
|
+
longitude: feature.geometry.coordinates[0],
|
|
61
|
+
latitude: feature.geometry.coordinates[1]
|
|
62
|
+
} : {};
|
|
48
63
|
data.push({
|
|
49
|
-
...
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
...visibleProperties,
|
|
65
|
+
...originalData !== void 0 ? { data: originalData } : {},
|
|
66
|
+
...coordinates
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
69
|
return data;
|
|
55
70
|
};
|
|
56
|
-
const extractDataFromEvent = (event) => {
|
|
71
|
+
const extractDataFromEvent = (event, registry) => {
|
|
57
72
|
if (!event.features?.length) {
|
|
58
73
|
return {};
|
|
59
74
|
}
|
|
@@ -62,7 +77,7 @@ const extractDataFromEvent = (event) => {
|
|
|
62
77
|
const hoveredFeatures = event.features.filter(
|
|
63
78
|
(feature2) => feature2.layer.id === hoveredLayerId
|
|
64
79
|
);
|
|
65
|
-
const data = parseTooltipData(hoveredFeatures);
|
|
80
|
+
const data = parseTooltipData(hoveredFeatures, registry);
|
|
66
81
|
return {
|
|
67
82
|
featureId: `${hoveredLayerId}-${feature.id}`,
|
|
68
83
|
hoveredLayerId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-geo",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@dynatrace-sdk/client-classic-environment-v2": "^5.1.0",
|
|
55
55
|
"@dynatrace-sdk/client-platform-management-service": "^1.7.0",
|
|
56
56
|
"@dynatrace-sdk/units": "^1.5.0",
|
|
57
|
-
"@dynatrace/strato-components": "^3.
|
|
57
|
+
"@dynatrace/strato-components": "^3.7.0",
|
|
58
58
|
"@dynatrace/strato-design-tokens": "^1.5.0",
|
|
59
59
|
"@dynatrace/strato-icons": "^2.3.0",
|
|
60
60
|
"react": "^18.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { merge } from "lodash-es";
|
|
2
|
-
const restoreNullProps = (data) => data?.map(({ __nullValues, ...rest }) => {
|
|
3
|
-
const nullProps = __nullValues?.map((prop) => ({ [prop]: null })) || [];
|
|
4
|
-
return merge(rest, ...nullProps);
|
|
5
|
-
});
|
|
6
|
-
export {
|
|
7
|
-
restoreNullProps
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=restore-null-props.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/map/components/ConnectionLayer/utils/restore-null-props.ts"],
|
|
4
|
-
"sourcesContent": ["import { merge } from 'lodash-es';\n\nimport type { ConnectionTooltipStatePayload } from '../../../types/connection-layer.js';\n\nexport const restoreNullProps = (\n data: ConnectionTooltipStatePayload[] | undefined,\n): Omit<ConnectionTooltipStatePayload, '__nullValues'>[] | undefined =>\n data?.map(({ __nullValues, ...rest }) => {\n const nullProps = __nullValues?.map((prop) => ({ [prop]: null })) || [];\n return merge(rest, ...nullProps);\n });\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AAIf,MAAM,mBAAmB,CAC9B,SAEA,MAAM,IAAI,CAAC,EAAE,cAAc,GAAG,KAAK,MAAM;AACvC,QAAM,YAAY,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,KAAK,EAAE,KAAK,CAAC;AACtE,SAAO,MAAM,MAAM,GAAG,SAAS;AACjC,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useMap } from "@vis.gl/react-maplibre";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
const useMapMouseMove = (layerIds, callback) => {
|
|
4
|
-
const { current: map } = useMap();
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
layerIds.forEach((layerId) => {
|
|
7
|
-
map?.on("mousemove", layerId, callback);
|
|
8
|
-
});
|
|
9
|
-
return () => {
|
|
10
|
-
layerIds.forEach((layerId) => {
|
|
11
|
-
map?.off("mousemove", layerId, callback);
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
useMapMouseMove
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=use-map-mouse-move.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/map/hooks/use-map-mouse-move.ts"],
|
|
4
|
-
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport { useEffect } from 'react';\n\nexport const useMapMouseMove = (\n layerIds: string[],\n callback: (event: MapLayerMouseEvent) => void,\n) => {\n const { current: map } = useMap();\n\n useEffect(() => {\n layerIds.forEach((layerId) => {\n map?.on('mousemove', layerId, callback);\n });\n\n return () => {\n layerIds.forEach((layerId) => {\n map?.off('mousemove', layerId, callback);\n });\n };\n });\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAEnB,MAAM,kBAAkB,CAC7B,UACA,aACG;AACH,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAEhC,YAAU,MAAM;AACd,aAAS,QAAQ,CAAC,YAAY;AAC5B,WAAK,GAAG,aAAa,SAAS,QAAQ;AAAA,IACxC,CAAC;AAED,WAAO,MAAM;AACX,eAAS,QAAQ,CAAC,YAAY;AAC5B,aAAK,IAAI,aAAa,SAAS,QAAQ;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|