@dynatrace/strato-geo 3.2.1 → 3.3.1
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 +5 -3
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js +25 -57
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +18 -41
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +22 -47
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
- package/esm/map/components/DefaultTooltip/DefaultTooltip.js +70 -29
- package/esm/map/components/DefaultTooltip/DefaultTooltip.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayerTooltip.js +18 -45
- package/esm/map/components/DotLayer/DotLayerTooltip.js.map +2 -2
- package/esm/map/components/toolbar/MapToolbar.js +10 -8
- package/esm/map/components/toolbar/MapToolbar.js.map +2 -2
- package/esm/map/hooks/use-geo-layer-tooltip.js +23 -0
- package/esm/map/hooks/use-geo-layer-tooltip.js.map +7 -0
- package/esm/map/hooks/use-geo-tooltip-sync.js +79 -0
- package/esm/map/hooks/use-geo-tooltip-sync.js.map +7 -0
- package/esm/map/hooks/use-overlay-events.js +98 -29
- package/esm/map/hooks/use-overlay-events.js.map +2 -2
- package/esm/map/hooks/use-tooltip-event-listeners.js +6 -5
- package/esm/map/hooks/use-tooltip-event-listeners.js.map +2 -2
- package/esm/map/hooks/use-tooltip-template.js +22 -2
- package/esm/map/hooks/use-tooltip-template.js.map +2 -2
- package/esm/map/store/map-store.context.js +1 -5
- package/esm/map/store/map-store.context.js.map +2 -2
- package/esm/map/store/selectors.js +0 -10
- package/esm/map/store/selectors.js.map +2 -2
- package/esm/map/store/store.js +1 -67
- package/esm/map/store/store.js.map +2 -2
- package/esm/map/utils/build-geo-tooltip-state.js +28 -0
- package/esm/map/utils/build-geo-tooltip-state.js.map +7 -0
- package/esm/map/utils/tooltip-type-guards.js +2 -0
- package/esm/map/utils/tooltip-type-guards.js.map +2 -2
- package/map/MapView.d.ts +2 -2
- package/map/MapView.js +2 -2
- package/map/components/BubbleLayer/BubbleCircleLayer.d.ts +1 -1
- package/map/components/BubbleLayer/BubbleLayer.d.ts +1 -1
- package/map/components/BubbleLayer/BubbleLayerTooltip.d.ts +1 -1
- package/map/components/BubbleLayer/BubbleLayerTooltip.js +24 -50
- package/map/components/BubbleLayer/BubbleOutlineLayer.d.ts +1 -1
- package/map/components/ChoroplethLayer/ChoroplethLayer.d.ts +1 -1
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.d.ts +1 -1
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +17 -34
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.d.ts +1 -1
- package/map/components/ConnectionLayer/ConnectionLayer.d.ts +1 -1
- package/map/components/ConnectionLayer/ConnectionLayerDirection.d.ts +1 -1
- package/map/components/ConnectionLayer/ConnectionLayerLine.d.ts +1 -1
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.d.ts +1 -1
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +21 -40
- package/map/components/DefaultTooltip/DefaultTooltip.d.ts +7 -2
- package/map/components/DefaultTooltip/DefaultTooltip.js +74 -27
- package/map/components/DotLayer/BackgroundLayer.d.ts +1 -1
- package/map/components/DotLayer/BackgroundSymbolLayer.d.ts +1 -1
- package/map/components/DotLayer/DotLayer.d.ts +1 -1
- package/map/components/DotLayer/DotLayerTooltip.d.ts +1 -1
- package/map/components/DotLayer/DotLayerTooltip.js +17 -38
- package/map/components/MapUnavailable.d.ts +1 -1
- package/map/components/TooltipWrapper.d.ts +1 -1
- package/map/components/legend/CategoricalLegendRenderer.d.ts +1 -1
- package/map/components/legend/MapLegendRenderer.d.ts +1 -1
- package/map/components/legend/SequentialLegendRenderer.d.ts +1 -1
- package/map/components/legend/ThresholdLegendRenderer.d.ts +1 -1
- package/map/components/toolbar/MapToolbar.d.ts +1 -1
- package/map/components/toolbar/MapToolbar.js +9 -7
- package/map/components/toolbar/buttons/MapDownloadDataButton.d.ts +1 -1
- package/map/components/toolbar/buttons/MapResetButton.d.ts +1 -1
- package/map/components/toolbar/buttons/MapZoomInOutButtons.d.ts +1 -1
- package/map/components/toolbar/buttons/MapZoomToFitButton.d.ts +1 -1
- package/map/hooks/use-geo-layer-tooltip.d.ts +10 -0
- package/map/hooks/use-geo-layer-tooltip.js +38 -0
- package/map/hooks/use-geo-tooltip-sync.d.ts +24 -0
- package/map/hooks/use-geo-tooltip-sync.js +95 -0
- package/map/hooks/use-overlay-events.js +94 -25
- package/map/hooks/use-tooltip-event-listeners.js +6 -5
- package/map/hooks/use-tooltip-template.d.ts +6 -1
- package/map/hooks/use-tooltip-template.js +22 -2
- package/map/providers/color-scale.provider.d.ts +1 -1
- package/map/providers/layer-color-strategy.provider.d.ts +1 -1
- package/map/providers/map-initial-view.provider.d.ts +1 -1
- package/map/slots/BubbleLayer.d.ts +1 -1
- package/map/slots/BubbleLayerTooltip.d.ts +1 -1
- package/map/slots/DotLayer.d.ts +1 -1
- package/map/slots/DotLayerTooltip.d.ts +1 -1
- package/map/store/map-store.context.d.ts +1 -1
- package/map/store/map-store.context.js +1 -5
- package/map/store/map-store.provider.d.ts +1 -1
- package/map/store/selectors.d.ts +6 -15
- package/map/store/selectors.js +0 -10
- package/map/store/store.d.ts +2 -6
- package/map/store/store.js +1 -67
- package/map/types/state.d.ts +3 -7
- package/map/types/tooltip.d.ts +11 -1
- package/map/utils/build-geo-tooltip-state.d.ts +17 -0
- package/map/{components/DefaultTooltip/utils/handle-copy-to-clipboard.js → utils/build-geo-tooltip-state.js} +27 -11
- package/map/utils/tooltip-type-guards.d.ts +6 -4
- package/map/utils/tooltip-type-guards.js +2 -0
- package/package.json +4 -4
- package/esm/map/components/DefaultTooltip/utils/get-default-actions.js +0 -21
- package/esm/map/components/DefaultTooltip/utils/get-default-actions.js.map +0 -7
- package/esm/map/components/DefaultTooltip/utils/handle-copy-to-clipboard.js +0 -12
- package/esm/map/components/DefaultTooltip/utils/handle-copy-to-clipboard.js.map +0 -7
- package/map/components/DefaultTooltip/utils/get-default-actions.d.ts +0 -2
- package/map/components/DefaultTooltip/utils/get-default-actions.js +0 -40
- package/map/components/DefaultTooltip/utils/handle-copy-to-clipboard.d.ts +0 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var DefaultTooltip_exports = {};
|
|
20
30
|
__export(DefaultTooltip_exports, {
|
|
@@ -24,7 +34,8 @@ module.exports = __toCommonJS(DefaultTooltip_exports);
|
|
|
24
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
35
|
var import_lodash_es = require("lodash");
|
|
26
36
|
var import_charts = require("@dynatrace/strato-components/charts");
|
|
27
|
-
var
|
|
37
|
+
var import_colors = __toESM(require("@dynatrace/strato-design-tokens/colors"));
|
|
38
|
+
var import_strato_icons = require("@dynatrace/strato-icons");
|
|
28
39
|
var import_use_truncation_mode = require("../../hooks/use-truncation-mode.js");
|
|
29
40
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
30
41
|
const isChoroplethTooltip = (props) => (0, import_tooltip_type_guards.isRegion)(props.closestPoint);
|
|
@@ -32,19 +43,24 @@ const isConnectionTooltip = (props) => (0, import_tooltip_type_guards.isConnecti
|
|
|
32
43
|
const isBubbleTooltip = (props) => !(0, import_lodash_es.isNil)(props.layerData);
|
|
33
44
|
const isDotTooltip = (props) => true;
|
|
34
45
|
const DefaultTooltip = (props) => {
|
|
35
|
-
|
|
46
|
+
const defaultConfig = (0, import_charts._useDefaultConfig)();
|
|
47
|
+
const getLabel = (0, import_charts._useDefaultLabels)();
|
|
36
48
|
const truncationMode = (0, import_use_truncation_mode.useTruncationMode)();
|
|
49
|
+
let locations = [];
|
|
37
50
|
if (isChoroplethTooltip(props)) {
|
|
38
|
-
const { closestPoint } = props;
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
40
|
-
import_charts.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
const { closestPoint, seriesActions } = props;
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_charts._OverlayTooltip, { truncation: truncationMode, children: [
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._OverlayTooltip.SeriesHeader, { valueLabel: "" }),
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
import_charts._OverlayTooltip.SeriesItem,
|
|
56
|
+
{
|
|
57
|
+
color: closestPoint.color,
|
|
58
|
+
name: closestPoint.name,
|
|
59
|
+
value: closestPoint.data.value?.toString() ?? "",
|
|
60
|
+
actions: seriesActions ? () => seriesActions(closestPoint) : void 0
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
48
64
|
} else if (isConnectionTooltip(props)) {
|
|
49
65
|
locations = props.closestPoint.data.path;
|
|
50
66
|
} else if (isBubbleTooltip(props)) {
|
|
@@ -53,21 +69,52 @@ const DefaultTooltip = (props) => {
|
|
|
53
69
|
} else if (isDotTooltip(props)) {
|
|
54
70
|
locations = [props.closestPoint.data];
|
|
55
71
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
))
|
|
72
|
+
const seriesLabel = getLabel?.("seriesLabel") ?? "";
|
|
73
|
+
const variant = defaultConfig?.sharedVariant ? "shared" : "single";
|
|
74
|
+
const seriesData = locations.map((location) => ({
|
|
75
|
+
name: `${location.latitude}, ${location.longitude}`,
|
|
76
|
+
value: ""
|
|
77
|
+
}));
|
|
78
|
+
const getActionsForItem = (current) => {
|
|
79
|
+
if (props.actionsForItem) {
|
|
80
|
+
return props.actionsForItem(current);
|
|
81
|
+
}
|
|
82
|
+
const { seriesActions: actions } = props;
|
|
83
|
+
if (!actions || !locations.length) {
|
|
84
|
+
return void 0;
|
|
70
85
|
}
|
|
71
|
-
|
|
86
|
+
const location = locations.find(
|
|
87
|
+
(l) => `${l.latitude}, ${l.longitude}` === current.name
|
|
88
|
+
);
|
|
89
|
+
return location ? () => actions(location) : void 0;
|
|
90
|
+
};
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_charts._OverlayTooltip, { truncation: truncationMode, children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._OverlayTooltip.Header, { header1: seriesLabel }),
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._OverlayTooltip.SeriesHeader, { disabled: true }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
import_charts._OverlayTooltip.Series,
|
|
96
|
+
{
|
|
97
|
+
activeItem: 0,
|
|
98
|
+
data: seriesData,
|
|
99
|
+
variant,
|
|
100
|
+
seriesItemTemplate: (current) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
101
|
+
import_charts._OverlayTooltip.SeriesItem,
|
|
102
|
+
{
|
|
103
|
+
...current,
|
|
104
|
+
iconStyle: "large",
|
|
105
|
+
actions: getActionsForItem(current),
|
|
106
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
+
import_strato_icons.LocationMarkerFilledIcon,
|
|
108
|
+
{
|
|
109
|
+
style: {
|
|
110
|
+
fill: import_colors.default.Text.Neutral.Default
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
72
119
|
};
|
|
73
120
|
DefaultTooltip["displayName"] = "DefaultTooltip";
|
|
@@ -5,5 +5,5 @@ interface BackgroundLayerProps {
|
|
|
5
5
|
radius: number;
|
|
6
6
|
iconAnchor: 'bottom' | 'center';
|
|
7
7
|
}
|
|
8
|
-
export declare const BackgroundLayer: (props: BackgroundLayerProps) => import("react/jsx-runtime
|
|
8
|
+
export declare const BackgroundLayer: (props: BackgroundLayerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -10,5 +10,5 @@ interface BackgroundSymbolLayerProps {
|
|
|
10
10
|
layerId?: string;
|
|
11
11
|
shape?: string | MapShape | ReactNode;
|
|
12
12
|
}
|
|
13
|
-
export declare const BackgroundSymbolLayer: (props: BackgroundSymbolLayerProps) => import("react/jsx-runtime
|
|
13
|
+
export declare const BackgroundSymbolLayer: (props: BackgroundSymbolLayerProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -5,6 +5,6 @@ import type { Location } from '../../types/location.js';
|
|
|
5
5
|
* DotLayer Component
|
|
6
6
|
*/
|
|
7
7
|
export declare const DotLayer: {
|
|
8
|
-
<T extends Location>(props: PropsWithChildren<InternalDotLayerProps<T>>): import("react/jsx-runtime
|
|
8
|
+
<T extends Location>(props: PropsWithChildren<InternalDotLayerProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
@@ -3,6 +3,6 @@ export interface DotLayerTooltipProps {
|
|
|
3
3
|
tooltipTemplate?: DotLayerTooltipHandler;
|
|
4
4
|
}
|
|
5
5
|
export declare const DotLayerTooltip: {
|
|
6
|
-
(props: DotLayerTooltipProps): import("react/jsx-runtime
|
|
6
|
+
(props: DotLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
@@ -22,52 +22,31 @@ __export(DotLayerTooltip_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DotLayerTooltip_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_react = require("react");
|
|
26
25
|
var import_charts = require("@dynatrace/strato-components/charts");
|
|
27
|
-
var
|
|
28
|
-
var
|
|
26
|
+
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
27
|
+
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
29
28
|
const DotLayerTooltip = (props) => {
|
|
30
29
|
const { tooltipTemplate } = props;
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
actionsMenuRef,
|
|
34
|
-
updateSelectedItem,
|
|
35
|
-
onLeave
|
|
36
|
-
} = (0, import_charts._useChartActionsMenu)();
|
|
37
|
-
const { data, visible, enabled } = (0, import_selectors.useMapTooltipState)();
|
|
38
|
-
const pinned = (0, import_selectors.useMapTooltipPinnedState)();
|
|
39
|
-
const dotData = (0, import_react.useRef)(null);
|
|
40
|
-
const forceHideTooltip = !pinned && (!visible || !enabled);
|
|
41
|
-
const position = (0, import_use_get_position.useGetPosition)(pinned, !forceHideTooltip);
|
|
42
|
-
if (!tooltipTemplate || forceHideTooltip || !position) {
|
|
30
|
+
const { data, inBounds, position } = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoDot");
|
|
31
|
+
if (!tooltipTemplate || !inBounds || !position) {
|
|
43
32
|
return null;
|
|
44
33
|
}
|
|
45
|
-
if (data
|
|
46
|
-
|
|
47
|
-
dotData.current = {
|
|
48
|
-
color,
|
|
49
|
-
bearing,
|
|
50
|
-
data: customData
|
|
51
|
-
};
|
|
34
|
+
if (!data || !data[0]) {
|
|
35
|
+
return null;
|
|
52
36
|
}
|
|
53
|
-
const
|
|
37
|
+
const { __color: color, __bearing: bearing, data: customData } = data[0];
|
|
38
|
+
const dotData = {
|
|
39
|
+
color,
|
|
40
|
+
bearing,
|
|
41
|
+
data: customData
|
|
42
|
+
};
|
|
43
|
+
const template = tooltipTemplate(dotData);
|
|
54
44
|
if (!template) {
|
|
55
45
|
return null;
|
|
56
46
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
position,
|
|
62
|
-
pinned,
|
|
63
|
-
onMouseLeave: onLeave,
|
|
64
|
-
actionSelectionValue: {
|
|
65
|
-
selectedItemId,
|
|
66
|
-
actionsMenuRef,
|
|
67
|
-
updateSelectedItem
|
|
68
|
-
},
|
|
69
|
-
children: template
|
|
70
|
-
}
|
|
71
|
-
);
|
|
47
|
+
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
48
|
+
return template;
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_charts._OverlayTooltip, { legacyTemplate: template });
|
|
72
51
|
};
|
|
73
52
|
DotLayerTooltip["displayName"] = "DotLayerTooltip";
|
|
@@ -5,7 +5,7 @@ interface MapUnavailableProps {
|
|
|
5
5
|
chartHeight: string | number;
|
|
6
6
|
}
|
|
7
7
|
export declare const MapUnavailable: {
|
|
8
|
-
({ chartHeight, error, isDisabled, isFetchingFeatures, }: MapUnavailableProps): import("react/jsx-runtime
|
|
8
|
+
({ chartHeight, error, isDisabled, isFetchingFeatures, }: MapUnavailableProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CategoricalLegendRenderer: () => import("react/jsx-runtime
|
|
1
|
+
export declare const CategoricalLegendRenderer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MapLegendRenderer: () => import("react/jsx-runtime
|
|
1
|
+
export declare const MapLegendRenderer: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SequentialLegendRenderer: () => import("react/jsx-runtime
|
|
1
|
+
export declare const SequentialLegendRenderer: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ThresholdLegendRenderer: () => import("react/jsx-runtime
|
|
1
|
+
export declare const ThresholdLegendRenderer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -39,7 +39,7 @@ const MapToolbar = () => {
|
|
|
39
39
|
const { toolbar: toolbarConfig, interactions: interactionsConfig } = (0, import_use_map_config.useMapConfig)();
|
|
40
40
|
const data = (0, import_use_map_raw_data.useMapRawData)();
|
|
41
41
|
const { mouseInBounds } = (0, import_selectors.useMapOverlayState)();
|
|
42
|
-
const
|
|
42
|
+
const setState = (0, import_store.useSetState)();
|
|
43
43
|
const isZoomEnabled = toolbarConfig?.zoom?.enabled ?? interactionsConfig?.zoom?.enabled ?? false;
|
|
44
44
|
const isZoomToFitEnabled = toolbarConfig?.zoom?.enabled ?? interactionsConfig?.zoomToFit?.enabled ?? false;
|
|
45
45
|
const isDownloadDataEnabled = toolbarConfig?.downloadCSV?.enabled ?? false;
|
|
@@ -47,14 +47,16 @@ const MapToolbar = () => {
|
|
|
47
47
|
const hasControls = hasZoomControls || isDownloadDataEnabled;
|
|
48
48
|
const hasOnlyDownloadCSV = isDownloadDataEnabled && !hasZoomControls;
|
|
49
49
|
const handleMouseEnter = () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
setState((prev) => ({
|
|
51
|
+
...prev,
|
|
52
|
+
tooltip: { ...prev.tooltip, enabled: false }
|
|
53
|
+
}));
|
|
53
54
|
};
|
|
54
55
|
const handleMouseLeave = () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
setState((prev) => ({
|
|
57
|
+
...prev,
|
|
58
|
+
tooltip: { ...prev.tooltip, enabled: true }
|
|
59
|
+
}));
|
|
58
60
|
};
|
|
59
61
|
const handleDownloadDataToolbar = () => {
|
|
60
62
|
(0, import_build_and_download_csv.buildAndDownloadCsv)(data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MapDownloadDataButton: () => import("react/jsx-runtime
|
|
1
|
+
export declare const MapDownloadDataButton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MapResetButton: () => import("react/jsx-runtime
|
|
1
|
+
export declare const MapResetButton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MapZoomInOutButtons: () => import("react/jsx-runtime
|
|
1
|
+
export declare const MapZoomInOutButtons: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { _OverlayTooltipGeometryTypes as GeometryTypes } from '@dynatrace/strato-components/charts';
|
|
2
|
+
export declare const useGeoLayerTooltip: <T>(geometryType: GeometryTypes) => {
|
|
3
|
+
data: T[] | undefined;
|
|
4
|
+
pinned: boolean;
|
|
5
|
+
inBounds: boolean;
|
|
6
|
+
position: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
} | null | undefined;
|
|
10
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
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 use_geo_layer_tooltip_exports = {};
|
|
20
|
+
__export(use_geo_layer_tooltip_exports, {
|
|
21
|
+
useGeoLayerTooltip: () => useGeoLayerTooltip
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_geo_layer_tooltip_exports);
|
|
24
|
+
var import_use_geo_tooltip_sync = require("./use-geo-tooltip-sync.js");
|
|
25
|
+
var import_use_get_position = require("./use-get-position.js");
|
|
26
|
+
var import_selectors = require("../store/selectors.js");
|
|
27
|
+
const useGeoLayerTooltip = (geometryType) => {
|
|
28
|
+
const enabled = (0, import_selectors.useSelector)(({ tooltip }) => tooltip.enabled);
|
|
29
|
+
const { data, pinned, inBounds } = (0, import_use_geo_tooltip_sync.useGeoOverlayTooltipState)();
|
|
30
|
+
const forceHideTooltip = !pinned && (!inBounds || !enabled);
|
|
31
|
+
const markerPosition = (0, import_use_get_position.useGetPosition)(pinned, !forceHideTooltip);
|
|
32
|
+
const storePosition = (0, import_use_geo_tooltip_sync.useOverlayTooltipSelector)(
|
|
33
|
+
(state) => state.inBounds && typeof state.absoluteX === "number" && typeof state.absoluteY === "number" ? { x: state.absoluteX, y: state.absoluteY } : null
|
|
34
|
+
);
|
|
35
|
+
const position = pinned ? markerPosition : storePosition;
|
|
36
|
+
(0, import_use_geo_tooltip_sync.useGeoTooltipSync)(position, pinned, geometryType, data ?? void 0);
|
|
37
|
+
return { data, pinned, inBounds, position };
|
|
38
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type _OverlayTooltipGeometryTypes as GeometryTypes, type _OverlayTooltipState as TooltipState } from '@dynatrace/strato-components/charts';
|
|
2
|
+
type Position = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
} | null | undefined;
|
|
6
|
+
export declare const useOverlayTooltipSelector: <S>(selector: (state: TooltipState) => S) => S;
|
|
7
|
+
export declare const useGeoOverlayTooltipState: <T>() => {
|
|
8
|
+
data: T[] | undefined;
|
|
9
|
+
pinned: boolean;
|
|
10
|
+
inBounds: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Syncs position, pinned state, and layer-specific data from the geo map
|
|
14
|
+
* into the OverlayTooltip store.
|
|
15
|
+
*
|
|
16
|
+
* Position updates set the store state directly because the reducer's
|
|
17
|
+
* SET_POSITION / SET_PINNED rely on `overlay.getBounds()`, which is
|
|
18
|
+
* always `undefined` in the geo context (the overlay ref is never
|
|
19
|
+
* attached to a DOM element).
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare const useGeoTooltipSync: (position: Position, pinned: boolean, geometryType: GeometryTypes, geoData?: unknown[] | undefined) => void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
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 use_geo_tooltip_sync_exports = {};
|
|
20
|
+
__export(use_geo_tooltip_sync_exports, {
|
|
21
|
+
useGeoOverlayTooltipState: () => useGeoOverlayTooltipState,
|
|
22
|
+
useGeoTooltipSync: () => useGeoTooltipSync,
|
|
23
|
+
useOverlayTooltipSelector: () => useOverlayTooltipSelector
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_geo_tooltip_sync_exports);
|
|
26
|
+
var import_lodash_es = require("lodash");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_charts = require("@dynatrace/strato-components/charts");
|
|
29
|
+
var import_build_geo_tooltip_state = require("../utils/build-geo-tooltip-state.js");
|
|
30
|
+
const useOverlayTooltipSelector = (selector) => {
|
|
31
|
+
const store = (0, import_charts._useOverlayTooltipStore)();
|
|
32
|
+
const prevRef = (0, import_react.useRef)(void 0);
|
|
33
|
+
const getSnapshot = (0, import_react.useCallback)(() => {
|
|
34
|
+
const next = selector(store.getState());
|
|
35
|
+
if (prevRef.current !== void 0 && (0, import_lodash_es.isEqual)(prevRef.current, next)) {
|
|
36
|
+
return prevRef.current;
|
|
37
|
+
}
|
|
38
|
+
prevRef.current = next;
|
|
39
|
+
return next;
|
|
40
|
+
}, [store, selector]);
|
|
41
|
+
return (0, import_react.useSyncExternalStore)(store.subscribe, getSnapshot);
|
|
42
|
+
};
|
|
43
|
+
const useGeoOverlayTooltipState = () => {
|
|
44
|
+
const metadata = useOverlayTooltipSelector(
|
|
45
|
+
(state) => state.data?.metadata
|
|
46
|
+
);
|
|
47
|
+
const pinned = useOverlayTooltipSelector((state) => state.pinned);
|
|
48
|
+
const inBounds = useOverlayTooltipSelector((state) => state.inBounds);
|
|
49
|
+
return { data: metadata, pinned, inBounds };
|
|
50
|
+
};
|
|
51
|
+
const useGeoTooltipSync = (position, pinned, geometryType, geoData) => {
|
|
52
|
+
const store = (0, import_charts._useOverlayTooltipStore)();
|
|
53
|
+
const dispatch = (0, import_charts._useOverlayTooltipReducer)();
|
|
54
|
+
(0, import_react.useEffect)(() => {
|
|
55
|
+
const onScroll = () => {
|
|
56
|
+
if (store.getState().pinned) {
|
|
57
|
+
dispatch({ type: "TOOLTIP_MOUSE_LEAVE" })();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
document.body.addEventListener("scroll", onScroll, true);
|
|
61
|
+
return () => {
|
|
62
|
+
document.body.removeEventListener("scroll", onScroll, true);
|
|
63
|
+
};
|
|
64
|
+
}, [store, dispatch]);
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
if (position) {
|
|
67
|
+
const nextState = (0, import_build_geo_tooltip_state.buildGeoTooltipState)({
|
|
68
|
+
absoluteX: position.x,
|
|
69
|
+
absoluteY: position.y,
|
|
70
|
+
relativeX: position.x,
|
|
71
|
+
relativeY: position.y,
|
|
72
|
+
pinned,
|
|
73
|
+
geometry: geometryType,
|
|
74
|
+
metadata: geoData
|
|
75
|
+
});
|
|
76
|
+
const current = store.getState();
|
|
77
|
+
if (current.absoluteX !== nextState.absoluteX || current.absoluteY !== nextState.absoluteY || current.inBounds !== nextState.inBounds || current.pinned !== nextState.pinned || !(0, import_lodash_es.isEqual)(current.data?.metadata, nextState.data.metadata)) {
|
|
78
|
+
store.setState(nextState);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
const currentState = store.getState();
|
|
82
|
+
if (currentState.inBounds || currentState.pinned) {
|
|
83
|
+
dispatch({ type: "SET_OUT_BOUNDS" })();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [
|
|
87
|
+
position?.x,
|
|
88
|
+
position?.y,
|
|
89
|
+
pinned,
|
|
90
|
+
geometryType,
|
|
91
|
+
geoData,
|
|
92
|
+
store,
|
|
93
|
+
dispatch
|
|
94
|
+
]);
|
|
95
|
+
};
|
|
@@ -21,54 +21,123 @@ __export(use_overlay_events_exports, {
|
|
|
21
21
|
useOverlayEvents: () => useOverlayEvents
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(use_overlay_events_exports);
|
|
24
|
+
var import_charts = require("@dynatrace/strato-components/charts");
|
|
24
25
|
var import_store = require("../store/store.js");
|
|
26
|
+
var import_build_geo_tooltip_state = require("../utils/build-geo-tooltip-state.js");
|
|
25
27
|
var import_parse_tooltip_data = require("../utils/parse-tooltip-data.js");
|
|
28
|
+
const layerIdToGeometry = (layerId) => {
|
|
29
|
+
if (layerId?.includes("bubble")) {
|
|
30
|
+
return "geoBubble";
|
|
31
|
+
}
|
|
32
|
+
if (layerId?.includes("choropleth")) {
|
|
33
|
+
return "geoChoropleth";
|
|
34
|
+
}
|
|
35
|
+
if (layerId?.includes("connection")) {
|
|
36
|
+
return "geoConnection";
|
|
37
|
+
}
|
|
38
|
+
return "geoDot";
|
|
39
|
+
};
|
|
26
40
|
const useOverlayEvents = () => {
|
|
27
41
|
const setOverlayState = (0, import_store.useSetStateOverlay)();
|
|
28
|
-
const
|
|
29
|
-
const
|
|
42
|
+
const setState = (0, import_store.useSetState)();
|
|
43
|
+
const dispatch = (0, import_charts._useOverlayTooltipReducer)();
|
|
44
|
+
const store = (0, import_charts._useOverlayTooltipStore)();
|
|
45
|
+
const overlay = (0, import_charts._useOverlayChart)();
|
|
46
|
+
const getAbsolutePosition = (event) => {
|
|
47
|
+
return {
|
|
48
|
+
x: Math.round(event.originalEvent.clientX),
|
|
49
|
+
y: Math.round(event.originalEvent.clientY)
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const setTooltipMarker = (hoveredLayerId, location) => {
|
|
53
|
+
setState((prev) => ({
|
|
54
|
+
...prev,
|
|
55
|
+
tooltip: {
|
|
56
|
+
...prev.tooltip,
|
|
57
|
+
hoveredLayerId,
|
|
58
|
+
location
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
30
62
|
const hideTooltip = () => {
|
|
31
|
-
|
|
63
|
+
dispatch({ type: "RESET_TOOLTIP" })();
|
|
64
|
+
setTooltipMarker(void 0, void 0);
|
|
32
65
|
};
|
|
33
66
|
const handleMouseEnter = () => {
|
|
34
|
-
setOverlayState({
|
|
35
|
-
mouseInBounds: true
|
|
36
|
-
});
|
|
67
|
+
setOverlayState({ mouseInBounds: true });
|
|
37
68
|
};
|
|
38
69
|
const handleMouseMove = (event) => {
|
|
39
70
|
if (event.features?.length) {
|
|
71
|
+
const currentState = store.getState();
|
|
72
|
+
if (currentState.pinned) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
40
75
|
const { data, hoveredLayerId } = (0, import_parse_tooltip_data.extractDataFromEvent)(event);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
76
|
+
overlay.clear();
|
|
77
|
+
setTooltipMarker(hoveredLayerId, event.lngLat);
|
|
78
|
+
const pos = getAbsolutePosition(event);
|
|
79
|
+
store.setState(
|
|
80
|
+
(0, import_build_geo_tooltip_state.buildGeoTooltipState)({
|
|
81
|
+
absoluteX: pos.x,
|
|
82
|
+
absoluteY: pos.y,
|
|
83
|
+
relativeX: Math.round(event.point.x),
|
|
84
|
+
relativeY: Math.round(event.point.y),
|
|
85
|
+
pinned: false,
|
|
86
|
+
geometry: layerIdToGeometry(hoveredLayerId),
|
|
87
|
+
metadata: data
|
|
88
|
+
})
|
|
89
|
+
);
|
|
47
90
|
} else {
|
|
48
|
-
|
|
91
|
+
const currentState = store.getState();
|
|
92
|
+
if (!currentState.pinned) {
|
|
93
|
+
hideTooltip();
|
|
94
|
+
}
|
|
49
95
|
}
|
|
50
96
|
};
|
|
51
97
|
const handleMouseLeave = () => {
|
|
52
|
-
setOverlayState({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
98
|
+
setOverlayState({ mouseInBounds: false });
|
|
99
|
+
const currentState = store.getState();
|
|
100
|
+
if (!currentState.pinned) {
|
|
101
|
+
hideTooltip();
|
|
102
|
+
}
|
|
56
103
|
};
|
|
57
104
|
const handleMouseClick = (event) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
105
|
+
const { data, featureId, hoveredLayerId } = (0, import_parse_tooltip_data.extractDataFromEvent)(event);
|
|
106
|
+
if (!featureId) {
|
|
107
|
+
hideTooltip();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!hoveredLayerId) {
|
|
111
|
+
hideTooltip();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
overlay.clear();
|
|
115
|
+
setTooltipMarker(hoveredLayerId, event.lngLat);
|
|
116
|
+
const pos = getAbsolutePosition(event);
|
|
117
|
+
store.setState(
|
|
118
|
+
(0, import_build_geo_tooltip_state.buildGeoTooltipState)({
|
|
119
|
+
absoluteX: pos.x,
|
|
120
|
+
absoluteY: pos.y,
|
|
121
|
+
relativeX: Math.round(event.point.x),
|
|
122
|
+
relativeY: Math.round(event.point.y),
|
|
123
|
+
pinned: true,
|
|
124
|
+
geometry: layerIdToGeometry(hoveredLayerId),
|
|
125
|
+
metadata: data
|
|
126
|
+
})
|
|
127
|
+
);
|
|
62
128
|
};
|
|
63
|
-
const
|
|
64
|
-
|
|
129
|
+
const hideTooltipIfNotPinned = () => {
|
|
130
|
+
const currentState = store.getState();
|
|
131
|
+
if (!currentState.pinned) {
|
|
132
|
+
hideTooltip();
|
|
133
|
+
}
|
|
65
134
|
};
|
|
66
135
|
return {
|
|
67
136
|
handleMouseEnter,
|
|
68
137
|
handleMouseMove,
|
|
69
138
|
handleMouseLeave,
|
|
70
139
|
handleMouseClick,
|
|
71
|
-
handleZoom,
|
|
72
|
-
handleDrag
|
|
140
|
+
handleZoom: hideTooltipIfNotPinned,
|
|
141
|
+
handleDrag: hideTooltipIfNotPinned
|
|
73
142
|
};
|
|
74
143
|
};
|