@dynatrace/strato-geo 3.2.0 → 3.3.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 +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
package/esm/map/MapView.js
CHANGED
|
@@ -3,7 +3,9 @@ import { forwardRef, useState } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
_ChartLayout as ChartLayout,
|
|
5
5
|
_coerceSizeValue as coerceSizeValue,
|
|
6
|
-
_useAutoLegendRefresh as useAutoLegendRefresh
|
|
6
|
+
_useAutoLegendRefresh as useAutoLegendRefresh,
|
|
7
|
+
_OverlayProvider as OverlayProvider,
|
|
8
|
+
_OverlayTooltipProvider as TooltipProvider
|
|
7
9
|
} from "@dynatrace/strato-components/charts";
|
|
8
10
|
import { _useBehavioralTrackingProps as useBehavioralTrackingProps } from "@dynatrace/strato-components/core";
|
|
9
11
|
import { MapLegendRenderer } from "./components/legend/MapLegendRenderer.js";
|
|
@@ -105,7 +107,7 @@ const _MapView = forwardRef(
|
|
|
105
107
|
MapTruncationModeContext.Provider,
|
|
106
108
|
{
|
|
107
109
|
value: truncationMode ?? DEFAULT_TRUNCATION_MODE,
|
|
108
|
-
children: /* @__PURE__ */ jsx(FormatterContext.Provider, { value: formatter, children: /* @__PURE__ */ jsx(MapRawDataContext.Provider, { value: layersData, children: /* @__PURE__ */ jsx(MapStoreProvider, { children: /* @__PURE__ */ jsx(
|
|
110
|
+
children: /* @__PURE__ */ jsx(FormatterContext.Provider, { value: formatter, children: /* @__PURE__ */ jsx(MapRawDataContext.Provider, { value: layersData, children: /* @__PURE__ */ jsx(OverlayProvider, { children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(MapStoreProvider, { children: /* @__PURE__ */ jsx(
|
|
109
111
|
ColorScaleProvider,
|
|
110
112
|
{
|
|
111
113
|
categories,
|
|
@@ -141,7 +143,7 @@ const _MapView = forwardRef(
|
|
|
141
143
|
}
|
|
142
144
|
) })
|
|
143
145
|
}
|
|
144
|
-
) }) }) })
|
|
146
|
+
) }) }) }) }) })
|
|
145
147
|
}
|
|
146
148
|
) }) })
|
|
147
149
|
}
|
package/esm/map/MapView.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/map/MapView.tsx"],
|
|
4
|
-
"sourcesContent": ["import { forwardRef, type PropsWithChildren, useState } from 'react';\n\nimport {\n _ChartLayout as ChartLayout,\n _coerceSizeValue as coerceSizeValue,\n _useAutoLegendRefresh as useAutoLegendRefresh,\n} from '@dynatrace/strato-components/charts';\nimport { _useBehavioralTrackingProps as useBehavioralTrackingProps } from '@dynatrace/strato-components/core';\n\nimport { MapLegendRenderer } from './components/legend/MapLegendRenderer.js';\nimport { MapContent } from './components/MapContent.js';\nimport { MapUnavailable } from './components/MapUnavailable.js';\nimport {\n DEFAULT_LEGEND_SIZES,\n DEFAULT_MAP_HEIGHT,\n DEFAULT_TRUNCATION_MODE,\n MAP_VIEW_ARIA_LABEL,\n} from './constants.js';\nimport { FormatterContext } from './contexts/formatter.context.js';\nimport { LayerIdsContext } from './contexts/layer-ids.context.js';\nimport { MapBaseLayerFeaturesContext } from './contexts/map-base-layer.context.js';\nimport { MapConfigurationContext } from './contexts/map-configuration.context.js';\nimport { MapLoadingContext } from './contexts/map-loading.context.js';\nimport { MapRawDataContext } from './contexts/map-raw-data.context.js';\nimport { MapTruncationModeContext } from './contexts/map-truncation-mode.context.js';\nimport { useLoadMapBaseLayer } from './hooks/use-load-map-base-layer.js';\nimport { ColorScaleProvider } from './providers/color-scale.provider.js';\nimport { LayerColorStrategyProvider } from './providers/layer-color-strategy.provider.js';\nimport { DownloadCSV } from './slots/DownloadCSV.js';\nimport { ErrorStateSlot } from './slots/states/ErrorStateSlot.js';\nimport { Toolbar } from './slots/Toolbar.js';\nimport { Zoom } from './slots/Zoom.js';\nimport { MapStoreProvider } from './store/map-store.provider.js';\nimport type { MapViewProps, MapViewRef } from './types/map-view.js';\nimport { isThresholdLegend } from './utils/build-scale-from-legend-config.js';\nimport { extractLayersData } from './utils/extract-layers-data.js';\nimport { getMapStatesTemplates } from './utils/get-map-states-template.js';\nimport { iterateConfigSlots } from './utils/iterate-config-slots.js';\nimport { setLayersId } from './utils/set-layers-id.js';\nimport './styles/react-mapgl-styles.css';\n\n/**\n * MapView Component\n */\nconst _MapView = forwardRef<MapViewRef, PropsWithChildren<MapViewProps>>(\n (props, forwardedRef) => {\n const [behavioralTrackingProps] = useBehavioralTrackingProps(props);\n\n const {\n children,\n loading = false,\n style: costumerStyle,\n className: customerClassNames,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n 'data-testid': dataTestId,\n formatter,\n truncationMode,\n ...remaining\n } = props;\n const { layerIds, parsedChildren, valueAccessors } = setLayersId(children);\n\n const {\n flattenData: layersData,\n categories,\n legendDomain,\n } = extractLayersData(parsedChildren, valueAccessors);\n\n const config = iterateConfigSlots(children, legendDomain);\n\n const getMaxRange = (): number => {\n if (config.legend && isThresholdLegend(config.legend)) {\n return config.legend.ranges.at(-1)?.to ?? legendDomain[1];\n }\n return legendDomain[1];\n };\n\n const dataMax = getMaxRange();\n\n const isLegendHidden = !config.legend || !!config.legend.hidden;\n const legendPosition = config.legend?.position;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const legendRatio = config.legend?.ratio;\n const legendOnRatioChange = config.legend?.onRatioChange;\n\n const { isMapEnabled, isFetchingFeatures, baseFeatureCollection, error } =\n useLoadMapBaseLayer(config.baseLayer);\n\n const [isMapLoaded, setIsMapLoaded] = useState<boolean>(false);\n const { errorState } = getMapStatesTemplates(children);\n\n const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;\n\n const containerStyles = { width: '100%', ...costumerStyle };\n const chartLayoutRef = useAutoLegendRefresh(categories.join(':'));\n const mapUnavailable = (!isFetchingFeatures && !isMapEnabled) || error;\n\n const isLoading = isFetchingFeatures || !isMapLoaded;\n\n return (\n <div\n style={containerStyles}\n className={customerClassNames}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n data-testid={dataTestId}\n role=\"img\"\n aria-label={MAP_VIEW_ARIA_LABEL}\n {...behavioralTrackingProps}\n >\n {\n // TODO: Error boundaries global fix needed - this error state only purpose is to make map not rendering when there error in response\n mapUnavailable ? (\n <MapUnavailable\n isFetchingFeatures={isFetchingFeatures}\n isDisabled={!isMapEnabled}\n chartHeight={chartHeight}\n error={error}\n />\n ) : (\n <MapLoadingContext.Provider value={loading}>\n <MapBaseLayerFeaturesContext.Provider\n value={baseFeatureCollection}\n >\n <MapConfigurationContext.Provider value={config}>\n <LayerIdsContext.Provider value={layerIds}>\n <MapTruncationModeContext.Provider\n value={truncationMode ?? DEFAULT_TRUNCATION_MODE}\n >\n <FormatterContext.Provider value={formatter}>\n <MapRawDataContext.Provider value={layersData}>\n <
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { forwardRef, type PropsWithChildren, useState } from 'react';\n\nimport {\n _ChartLayout as ChartLayout,\n _coerceSizeValue as coerceSizeValue,\n _useAutoLegendRefresh as useAutoLegendRefresh,\n _OverlayProvider as OverlayProvider,\n _OverlayTooltipProvider as TooltipProvider,\n} from '@dynatrace/strato-components/charts';\nimport { _useBehavioralTrackingProps as useBehavioralTrackingProps } from '@dynatrace/strato-components/core';\n\nimport { MapLegendRenderer } from './components/legend/MapLegendRenderer.js';\nimport { MapContent } from './components/MapContent.js';\nimport { MapUnavailable } from './components/MapUnavailable.js';\nimport {\n DEFAULT_LEGEND_SIZES,\n DEFAULT_MAP_HEIGHT,\n DEFAULT_TRUNCATION_MODE,\n MAP_VIEW_ARIA_LABEL,\n} from './constants.js';\nimport { FormatterContext } from './contexts/formatter.context.js';\nimport { LayerIdsContext } from './contexts/layer-ids.context.js';\nimport { MapBaseLayerFeaturesContext } from './contexts/map-base-layer.context.js';\nimport { MapConfigurationContext } from './contexts/map-configuration.context.js';\nimport { MapLoadingContext } from './contexts/map-loading.context.js';\nimport { MapRawDataContext } from './contexts/map-raw-data.context.js';\nimport { MapTruncationModeContext } from './contexts/map-truncation-mode.context.js';\nimport { useLoadMapBaseLayer } from './hooks/use-load-map-base-layer.js';\nimport { ColorScaleProvider } from './providers/color-scale.provider.js';\nimport { LayerColorStrategyProvider } from './providers/layer-color-strategy.provider.js';\nimport { DownloadCSV } from './slots/DownloadCSV.js';\nimport { ErrorStateSlot } from './slots/states/ErrorStateSlot.js';\nimport { Toolbar } from './slots/Toolbar.js';\nimport { Zoom } from './slots/Zoom.js';\nimport { MapStoreProvider } from './store/map-store.provider.js';\nimport type { MapViewProps, MapViewRef } from './types/map-view.js';\nimport { isThresholdLegend } from './utils/build-scale-from-legend-config.js';\nimport { extractLayersData } from './utils/extract-layers-data.js';\nimport { getMapStatesTemplates } from './utils/get-map-states-template.js';\nimport { iterateConfigSlots } from './utils/iterate-config-slots.js';\nimport { setLayersId } from './utils/set-layers-id.js';\nimport './styles/react-mapgl-styles.css';\n\n/**\n * MapView Component\n */\nconst _MapView = forwardRef<MapViewRef, PropsWithChildren<MapViewProps>>(\n (props, forwardedRef) => {\n const [behavioralTrackingProps] = useBehavioralTrackingProps(props);\n\n const {\n children,\n loading = false,\n style: costumerStyle,\n className: customerClassNames,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n 'data-testid': dataTestId,\n formatter,\n truncationMode,\n ...remaining\n } = props;\n const { layerIds, parsedChildren, valueAccessors } = setLayersId(children);\n\n const {\n flattenData: layersData,\n categories,\n legendDomain,\n } = extractLayersData(parsedChildren, valueAccessors);\n\n const config = iterateConfigSlots(children, legendDomain);\n\n const getMaxRange = (): number => {\n if (config.legend && isThresholdLegend(config.legend)) {\n return config.legend.ranges.at(-1)?.to ?? legendDomain[1];\n }\n return legendDomain[1];\n };\n\n const dataMax = getMaxRange();\n\n const isLegendHidden = !config.legend || !!config.legend.hidden;\n const legendPosition = config.legend?.position;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const legendRatio = config.legend?.ratio;\n const legendOnRatioChange = config.legend?.onRatioChange;\n\n const { isMapEnabled, isFetchingFeatures, baseFeatureCollection, error } =\n useLoadMapBaseLayer(config.baseLayer);\n\n const [isMapLoaded, setIsMapLoaded] = useState<boolean>(false);\n const { errorState } = getMapStatesTemplates(children);\n\n const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;\n\n const containerStyles = { width: '100%', ...costumerStyle };\n const chartLayoutRef = useAutoLegendRefresh(categories.join(':'));\n const mapUnavailable = (!isFetchingFeatures && !isMapEnabled) || error;\n\n const isLoading = isFetchingFeatures || !isMapLoaded;\n\n return (\n <div\n style={containerStyles}\n className={customerClassNames}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n data-testid={dataTestId}\n role=\"img\"\n aria-label={MAP_VIEW_ARIA_LABEL}\n {...behavioralTrackingProps}\n >\n {\n // TODO: Error boundaries global fix needed - this error state only purpose is to make map not rendering when there error in response\n mapUnavailable ? (\n <MapUnavailable\n isFetchingFeatures={isFetchingFeatures}\n isDisabled={!isMapEnabled}\n chartHeight={chartHeight}\n error={error}\n />\n ) : (\n <MapLoadingContext.Provider value={loading}>\n <MapBaseLayerFeaturesContext.Provider\n value={baseFeatureCollection}\n >\n <MapConfigurationContext.Provider value={config}>\n <LayerIdsContext.Provider value={layerIds}>\n <MapTruncationModeContext.Provider\n value={truncationMode ?? DEFAULT_TRUNCATION_MODE}\n >\n <FormatterContext.Provider value={formatter}>\n <MapRawDataContext.Provider value={layersData}>\n <OverlayProvider>\n <TooltipProvider>\n <MapStoreProvider>\n <ColorScaleProvider\n categories={categories}\n dataMax={dataMax}\n >\n <LayerColorStrategyProvider>\n <ChartLayout\n ref={chartLayoutRef}\n chartHeight={chartHeight}\n errorState={errorState}\n showLoader={loading || isLoading}\n >\n <ChartLayout.Graph>\n {baseFeatureCollection && (\n <MapContent\n ref={forwardedRef}\n onMapLoad={() =>\n setIsMapLoaded(true)\n }\n {...remaining}\n >\n {parsedChildren}\n </MapContent>\n )}\n </ChartLayout.Graph>\n {!isLegendHidden && (\n <ChartLayout.Legend\n position={legendPosition}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ratio={legendRatio}\n ratioBoundaries={DEFAULT_LEGEND_SIZES}\n onResize={legendOnRatioChange}\n >\n <MapLegendRenderer />\n </ChartLayout.Legend>\n )}\n </ChartLayout>\n </LayerColorStrategyProvider>\n </ColorScaleProvider>\n </MapStoreProvider>\n </TooltipProvider>\n </OverlayProvider>\n </MapRawDataContext.Provider>\n </FormatterContext.Provider>\n </MapTruncationModeContext.Provider>\n </LayerIdsContext.Provider>\n </MapConfigurationContext.Provider>\n </MapBaseLayerFeaturesContext.Provider>\n </MapLoadingContext.Provider>\n )\n }\n </div>\n );\n },\n);\n\n(_MapView as typeof _MapView & { displayName: string })['displayName'] =\n 'MapView';\n\n/**\n * The `MapView` is a component that renders a map with various geospatial data layers.\n * @public\n */\nexport const MapView = Object.assign(_MapView, {\n ErrorState: ErrorStateSlot,\n Toolbar,\n DownloadCSV,\n Zoom,\n});\n"],
|
|
5
|
+
"mappings": "AAmHY,cA0BwB,YA1BxB;AAnHZ,SAAS,YAAoC,gBAAgB;AAE7D;AAAA,EACE,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,OACtB;AACP,SAAS,+BAA+B,kCAAkC;AAE1E,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,E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AC;AAAA;AAAA,wBACC,KAAK;AAAA,wBACL;AAAA,wBACA;AAAA,wBACA,YAAY,WAAW;AAAA,wBAEvB;AAAA,8CAAC,YAAY,OAAZ,EACE,mCACC;AAAA,4BAAC;AAAA;AAAA,8BACC,KAAK;AAAA,8BACL,WAAW,MACT,eAAe,IAAI;AAAA,8BAEpB,GAAG;AAAA,8BAEH;AAAA;AAAA,0BACH,GAEJ;AAAA,0BACC,CAAC,kBACA;AAAA,4BAAC,YAAY;AAAA,4BAAZ;AAAA,8BACC,UAAU;AAAA,8BAEV,OAAO;AAAA,8BACP,iBAAiB;AAAA,8BACjB,UAAU;AAAA,8BAEV,8BAAC,qBAAkB;AAAA;AAAA,0BACrB;AAAA;AAAA;AAAA,oBAEJ,GACF;AAAA;AAAA,gBACF,GACF,GACF,GACF,GACF,GACF;AAAA;AAAA,YACF,GACF,GACF;AAAA;AAAA,QACF,GACF;AAAA;AAAA,IAGN;AAAA,EAEJ;AACF;AAEC,SAAuD,aAAa,IACnE;AAMK,MAAM,UAAU,OAAO,OAAO,UAAU;AAAA,EAC7C,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,70 +1,38 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { sortBy } from "lodash-es";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
_useChartActionsMenu as useChartActionsMenu
|
|
7
|
-
} from "@dynatrace/strato-components/charts";
|
|
8
|
-
import { useGetPosition } from "../../hooks/use-get-position.js";
|
|
9
|
-
import {
|
|
10
|
-
useMapTooltipPinnedState,
|
|
11
|
-
useMapTooltipState
|
|
12
|
-
} from "../../store/selectors.js";
|
|
3
|
+
import { _OverlayTooltip as OverlayTooltip } from "@dynatrace/strato-components/charts";
|
|
4
|
+
import { useGeoLayerTooltip } from "../../hooks/use-geo-layer-tooltip.js";
|
|
5
|
+
import { isDefaultTooltipHandler } from "../../utils/tooltip-type-guards.js";
|
|
13
6
|
const BubbleLayerTooltip = (props) => {
|
|
14
7
|
const { tooltipTemplate } = props;
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
actionsMenuRef,
|
|
18
|
-
updateSelectedItem,
|
|
19
|
-
onLeave
|
|
20
|
-
} = useChartActionsMenu();
|
|
21
|
-
const tooltipRef = useRef(null);
|
|
22
|
-
const { data, visible, enabled } = useMapTooltipState();
|
|
23
|
-
const pinned = useMapTooltipPinnedState();
|
|
24
|
-
const closestPoint = useRef(null);
|
|
25
|
-
const remainingPoints = useRef([]);
|
|
26
|
-
const forceHideTooltip = !pinned && (!visible || !enabled);
|
|
27
|
-
const position = useGetPosition(pinned, !forceHideTooltip);
|
|
28
|
-
if (!tooltipTemplate || forceHideTooltip || !position) {
|
|
8
|
+
const { data, inBounds, position } = useGeoLayerTooltip("geoBubble");
|
|
9
|
+
if (!tooltipTemplate || !inBounds || !position) {
|
|
29
10
|
return null;
|
|
30
11
|
}
|
|
31
|
-
if (data
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
__color: color,
|
|
35
|
-
__radius: radius,
|
|
36
|
-
data: customData
|
|
37
|
-
} = bubbleProps;
|
|
38
|
-
return {
|
|
39
|
-
color,
|
|
40
|
-
radius,
|
|
41
|
-
data: customData
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
const sortedBubbles = sortBy(sanitizedData, ({ radius }) => radius);
|
|
45
|
-
closestPoint.current = sortedBubbles[0];
|
|
46
|
-
remainingPoints.current = sortedBubbles.slice(1);
|
|
12
|
+
if (!data || !data[0]) {
|
|
13
|
+
return null;
|
|
47
14
|
}
|
|
48
|
-
const
|
|
15
|
+
const sanitizedData = data.map((bubbleProps) => {
|
|
16
|
+
const { __color: color, __radius: radius, data: customData } = bubbleProps;
|
|
17
|
+
return {
|
|
18
|
+
color,
|
|
19
|
+
radius,
|
|
20
|
+
data: customData
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
const sortedBubbles = [
|
|
24
|
+
...sortBy(sanitizedData, ({ radius }) => radius)
|
|
25
|
+
];
|
|
26
|
+
const closestPoint = sortedBubbles[0];
|
|
27
|
+
const remainingPoints = sortedBubbles.slice(1);
|
|
28
|
+
const template = closestPoint ? tooltipTemplate(closestPoint, remainingPoints) : null;
|
|
49
29
|
if (!template) {
|
|
50
30
|
return null;
|
|
51
31
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
position,
|
|
57
|
-
pinned,
|
|
58
|
-
ref: tooltipRef,
|
|
59
|
-
onMouseLeave: onLeave,
|
|
60
|
-
actionSelectionValue: {
|
|
61
|
-
selectedItemId,
|
|
62
|
-
actionsMenuRef,
|
|
63
|
-
updateSelectedItem
|
|
64
|
-
},
|
|
65
|
-
children: template
|
|
66
|
-
}
|
|
67
|
-
);
|
|
32
|
+
if (isDefaultTooltipHandler(tooltipTemplate)) {
|
|
33
|
+
return template;
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(OverlayTooltip, { legacyTemplate: template });
|
|
68
36
|
};
|
|
69
37
|
BubbleLayerTooltip["displayName"] = "BubbleLayerTooltip";
|
|
70
38
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/BubbleLayer/BubbleLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { sortBy } from 'lodash-es';\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { sortBy } from 'lodash-es';\n\nimport { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport { useGeoLayerTooltip } from '../../hooks/use-geo-layer-tooltip.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n BubbleLayerTooltipData,\n BubbleLayerTooltipHandler,\n} from '../../types/tooltip.js';\nimport { isDefaultTooltipHandler } from '../../utils/tooltip-type-guards.js';\n\ninterface BubbleTooltipStatePayload {\n __color: string;\n __hoveredColor: string;\n __radius: number;\n __lat: number;\n data: Location;\n}\n\nexport interface BubbleLayerTooltipProps {\n tooltipTemplate?: BubbleLayerTooltipHandler;\n}\n\nexport const BubbleLayerTooltip = (props: BubbleLayerTooltipProps) => {\n const { tooltipTemplate } = props;\n\n const { data, inBounds, position } =\n useGeoLayerTooltip<BubbleTooltipStatePayload>('geoBubble');\n\n if (!tooltipTemplate || !inBounds || !position) {\n return null;\n }\n\n if (!data || !data[0]) {\n return null;\n }\n\n const sanitizedData: BubbleLayerTooltipData[] = data.map((bubbleProps) => {\n const { __color: color, __radius: radius, data: customData } = bubbleProps;\n\n return {\n color,\n radius,\n data: customData,\n };\n });\n\n const sortedBubbles: BubbleLayerTooltipData[] = [\n ...sortBy(sanitizedData, ({ radius }) => radius),\n ];\n const closestPoint = sortedBubbles[0];\n const remainingPoints = sortedBubbles.slice(1);\n\n const template = closestPoint\n ? tooltipTemplate(closestPoint, remainingPoints)\n : null;\n\n if (!template) {\n return null;\n }\n\n if (isDefaultTooltipHandler(tooltipTemplate)) {\n return template;\n }\n\n return <OverlayTooltip legacyTemplate={template} />;\n};\n\nBubbleLayerTooltip['displayName'] = 'BubbleLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AAkES;AAlET,SAAS,cAAc;AAEvB,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,0BAA0B;AAMnC,SAAS,+BAA+B;AAcjC,MAAM,qBAAqB,CAAC,UAAmC;AACpE,QAAM,EAAE,gBAAgB,IAAI;AAE5B,QAAM,EAAE,MAAM,UAAU,SAAS,IAC/B,mBAA8C,WAAW;AAE3D,MAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,UAAU;AAC9C,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,gBAA0C,KAAK,IAAI,CAAC,gBAAgB;AACxE,UAAM,EAAE,SAAS,OAAO,UAAU,QAAQ,MAAM,WAAW,IAAI;AAE/D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,MAAM;AAAA,IACR;AAAA,EACF,CAAC;AAED,QAAM,gBAA0C;AAAA,IAC9C,GAAG,OAAO,eAAe,CAAC,EAAE,OAAO,MAAM,MAAM;AAAA,EACjD;AACA,QAAM,eAAe,cAAc,CAAC;AACpC,QAAM,kBAAkB,cAAc,MAAM,CAAC;AAE7C,QAAM,WAAW,eACb,gBAAgB,cAAc,eAAe,IAC7C;AAEJ,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI,wBAAwB,eAAe,GAAG;AAC5C,WAAO;AAAA,EACT;AAEA,SAAO,oBAAC,kBAAe,gBAAgB,UAAU;AACnD;AAEA,mBAAmB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,53 +1,30 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
_useChartActionsMenu as useChartActionsMenu
|
|
6
|
-
} from "@dynatrace/strato-components/charts";
|
|
7
|
-
import { useGetPosition } from "../../hooks/use-get-position.js";
|
|
8
|
-
import {
|
|
9
|
-
useMapTooltipPinnedState,
|
|
10
|
-
useMapTooltipState
|
|
11
|
-
} from "../../store/selectors.js";
|
|
2
|
+
import { _OverlayTooltip as OverlayTooltip } from "@dynatrace/strato-components/charts";
|
|
3
|
+
import { useGeoLayerTooltip } from "../../hooks/use-geo-layer-tooltip.js";
|
|
4
|
+
import { isDefaultTooltipHandler } from "../../utils/tooltip-type-guards.js";
|
|
12
5
|
const ChoroplethLayerTooltip = (props) => {
|
|
13
6
|
const { tooltipTemplate } = props;
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
actionsMenuRef,
|
|
17
|
-
updateSelectedItem,
|
|
18
|
-
onLeave
|
|
19
|
-
} = useChartActionsMenu();
|
|
20
|
-
const { data, visible, enabled } = useMapTooltipState();
|
|
21
|
-
const pinned = useMapTooltipPinnedState();
|
|
22
|
-
const regionData = useRef(null);
|
|
23
|
-
const forceHideTooltip = !pinned && (!visible || !enabled);
|
|
24
|
-
const position = useGetPosition(pinned, !forceHideTooltip);
|
|
25
|
-
if (!tooltipTemplate || forceHideTooltip || !position) {
|
|
7
|
+
const { data, inBounds, position } = useGeoLayerTooltip("geoChoropleth");
|
|
8
|
+
if (!tooltipTemplate || !inBounds || !position) {
|
|
26
9
|
return null;
|
|
27
10
|
}
|
|
28
|
-
if (data
|
|
29
|
-
|
|
30
|
-
regionData.current = { data: customData, name, color };
|
|
11
|
+
if (!data || !data[0]) {
|
|
12
|
+
return null;
|
|
31
13
|
}
|
|
32
|
-
const
|
|
14
|
+
const { name, __color: color, data: customData } = data[0];
|
|
15
|
+
const regionData = {
|
|
16
|
+
data: customData,
|
|
17
|
+
name,
|
|
18
|
+
color
|
|
19
|
+
};
|
|
20
|
+
const template = tooltipTemplate(regionData);
|
|
33
21
|
if (!template) {
|
|
34
22
|
return null;
|
|
35
23
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
position,
|
|
41
|
-
pinned,
|
|
42
|
-
onMouseLeave: onLeave,
|
|
43
|
-
actionSelectionValue: {
|
|
44
|
-
selectedItemId,
|
|
45
|
-
actionsMenuRef,
|
|
46
|
-
updateSelectedItem
|
|
47
|
-
},
|
|
48
|
-
children: template
|
|
49
|
-
}
|
|
50
|
-
);
|
|
24
|
+
if (isDefaultTooltipHandler(tooltipTemplate)) {
|
|
25
|
+
return template;
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx(OverlayTooltip, { legacyTemplate: template });
|
|
51
28
|
};
|
|
52
29
|
ChoroplethLayerTooltip["displayName"] = "ChoroplethLayerTooltip";
|
|
53
30
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ChoroplethLayer/ChoroplethLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport { useGeoLayerTooltip } from '../../hooks/use-geo-layer-tooltip.js';\nimport type {\n ChoroplethLayerTooltipData,\n ChoroplethLayerTooltipHandler,\n} from '../../types/tooltip.js';\nimport { isDefaultTooltipHandler } from '../../utils/tooltip-type-guards.js';\n\ninterface ChoroplethTooltipStatePayload {\n name: string;\n __color: string;\n __hoveredColor: string;\n data: Record<string, unknown>;\n}\n\nexport interface ChoroplethLayerTooltipProps {\n tooltipTemplate?: ChoroplethLayerTooltipHandler;\n}\n\nexport const ChoroplethLayerTooltip = (props: ChoroplethLayerTooltipProps) => {\n const { tooltipTemplate } = props;\n\n const { data, inBounds, position } =\n useGeoLayerTooltip<ChoroplethTooltipStatePayload>('geoChoropleth');\n\n if (!tooltipTemplate || !inBounds || !position) {\n return null;\n }\n\n if (!data || !data[0]) {\n return null;\n }\n\n const { name, __color: color, data: customData } = data[0];\n const regionData: ChoroplethLayerTooltipData = {\n data: customData,\n name,\n color,\n };\n\n const template = tooltipTemplate(regionData);\n\n if (!template) {\n return null;\n }\n\n if (isDefaultTooltipHandler(tooltipTemplate)) {\n return template;\n }\n\n return <OverlayTooltip legacyTemplate={template} />;\n};\n\nChoroplethLayerTooltip['displayName'] = 'ChoroplethLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AAmDS;AAnDT,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,0BAA0B;AAKnC,SAAS,+BAA+B;AAajC,MAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM,EAAE,gBAAgB,IAAI;AAE5B,QAAM,EAAE,MAAM,UAAU,SAAS,IAC/B,mBAAkD,eAAe;AAEnE,MAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,UAAU;AAC9C,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,MAAM,SAAS,OAAO,MAAM,WAAW,IAAI,KAAK,CAAC;AACzD,QAAM,aAAyC;AAAA,IAC7C,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW,gBAAgB,UAAU;AAE3C,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI,wBAAwB,eAAe,GAAG;AAC5C,WAAO;AAAA,EACT;AAEA,SAAO,oBAAC,kBAAe,gBAAgB,UAAU;AACnD;AAEA,uBAAuB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,61 +1,36 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
_ChartTooltip as ChartTooltip,
|
|
5
|
-
_useChartActionsMenu as useChartActionsMenu
|
|
6
|
-
} from "@dynatrace/strato-components/charts";
|
|
2
|
+
import { _OverlayTooltip as OverlayTooltip } from "@dynatrace/strato-components/charts";
|
|
7
3
|
import { restoreNullProps } from "./utils/restore-null-props.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
useMapTooltipPinnedState,
|
|
11
|
-
useMapTooltipState
|
|
12
|
-
} from "../../store/selectors.js";
|
|
4
|
+
import { useGeoLayerTooltip } from "../../hooks/use-geo-layer-tooltip.js";
|
|
5
|
+
import { isDefaultTooltipHandler } from "../../utils/tooltip-type-guards.js";
|
|
13
6
|
const ConnectionLayerTooltip = (props) => {
|
|
14
7
|
const { tooltipTemplate } = props;
|
|
15
8
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
data: dataWithoutNullProps,
|
|
23
|
-
visible,
|
|
24
|
-
enabled
|
|
25
|
-
} = useMapTooltipState();
|
|
26
|
-
const pinned = useMapTooltipPinnedState();
|
|
27
|
-
const data = restoreNullProps(dataWithoutNullProps);
|
|
28
|
-
const connectionData = useRef(
|
|
29
|
-
null
|
|
30
|
-
);
|
|
31
|
-
const forceHideTooltip = !pinned && (!visible || !enabled);
|
|
32
|
-
const position = useGetPosition(pinned, !forceHideTooltip);
|
|
33
|
-
if (!tooltipTemplate || forceHideTooltip || !position) {
|
|
9
|
+
data: rawData,
|
|
10
|
+
inBounds,
|
|
11
|
+
position
|
|
12
|
+
} = useGeoLayerTooltip("geoConnection");
|
|
13
|
+
const data = restoreNullProps(rawData);
|
|
14
|
+
if (!tooltipTemplate || !inBounds || !position) {
|
|
34
15
|
return null;
|
|
35
16
|
}
|
|
36
|
-
if (data
|
|
37
|
-
|
|
38
|
-
connectionData.current = { color, thickness, data: rest };
|
|
17
|
+
if (!data || !data[0]) {
|
|
18
|
+
return null;
|
|
39
19
|
}
|
|
40
|
-
const
|
|
20
|
+
const { __lineColor: color, __lineWidth: thickness, ...rest } = data[0];
|
|
21
|
+
const connectionData = {
|
|
22
|
+
color,
|
|
23
|
+
thickness,
|
|
24
|
+
data: rest
|
|
25
|
+
};
|
|
26
|
+
const template = tooltipTemplate(connectionData);
|
|
41
27
|
if (!template) {
|
|
42
28
|
return null;
|
|
43
29
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
position,
|
|
49
|
-
pinned,
|
|
50
|
-
onMouseLeave: onLeave,
|
|
51
|
-
actionSelectionValue: {
|
|
52
|
-
selectedItemId,
|
|
53
|
-
actionsMenuRef,
|
|
54
|
-
updateSelectedItem
|
|
55
|
-
},
|
|
56
|
-
children: template
|
|
57
|
-
}
|
|
58
|
-
);
|
|
30
|
+
if (isDefaultTooltipHandler(tooltipTemplate)) {
|
|
31
|
+
return template;
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ jsx(OverlayTooltip, { legacyTemplate: template });
|
|
59
34
|
};
|
|
60
35
|
ConnectionLayerTooltip["displayName"] = "ConnectionLayerTooltip";
|
|
61
36
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { _OverlayTooltip as OverlayTooltip } from '@dynatrace/strato-components/charts';\n\nimport { restoreNullProps } from './utils/restore-null-props.js';\nimport { useGeoLayerTooltip } from '../../hooks/use-geo-layer-tooltip.js';\nimport type {\n Connection,\n ConnectionTooltipStatePayload,\n} from '../../types/connection-layer.js';\nimport type {\n ConnectionLayerTooltipData,\n ConnectionLayerTooltipHandler,\n} from '../../types/tooltip.js';\nimport { isDefaultTooltipHandler } from '../../utils/tooltip-type-guards.js';\n\nexport interface ConnectionLayerTooltipProps {\n tooltipTemplate?: ConnectionLayerTooltipHandler;\n}\n\nexport const ConnectionLayerTooltip = (props: ConnectionLayerTooltipProps) => {\n const { tooltipTemplate } = props;\n\n const {\n data: rawData,\n inBounds,\n position,\n } = useGeoLayerTooltip<ConnectionTooltipStatePayload>('geoConnection');\n\n const data = restoreNullProps(rawData);\n\n if (!tooltipTemplate || !inBounds || !position) {\n return null;\n }\n\n if (!data || !data[0]) {\n return null;\n }\n\n const { __lineColor: color, __lineWidth: thickness, ...rest } = data[0];\n const connectionData: ConnectionLayerTooltipData<Connection> = {\n color,\n thickness,\n data: rest as Connection,\n };\n\n const template = tooltipTemplate(connectionData);\n\n if (!template) {\n return null;\n }\n\n if (isDefaultTooltipHandler(tooltipTemplate)) {\n return template;\n }\n\n return <OverlayTooltip legacyTemplate={template} />;\n};\n\nConnectionLayerTooltip['displayName'] = 'ConnectionLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AAsDS;AAtDT,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AASnC,SAAS,+BAA+B;AAMjC,MAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM,EAAE,gBAAgB,IAAI;AAE5B,QAAM;AAAA,IACJ,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF,IAAI,mBAAkD,eAAe;AAErE,QAAM,OAAO,iBAAiB,OAAO;AAErC,MAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,UAAU;AAC9C,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,aAAa,OAAO,aAAa,WAAW,GAAG,KAAK,IAAI,KAAK,CAAC;AACtE,QAAM,iBAAyD;AAAA,IAC7D;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AAEA,QAAM,WAAW,gBAAgB,cAAc;AAE/C,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI,wBAAwB,eAAe,GAAG;AAC5C,WAAO;AAAA,EACT;AAEA,SAAO,oBAAC,kBAAe,gBAAgB,UAAU;AACnD;AAEA,uBAAuB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { isNil } from "lodash-es";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
_OverlayTooltip as OverlayTooltip,
|
|
5
|
+
_useDefaultConfig as useDefaultConfig,
|
|
6
|
+
_useDefaultLabels as useDefaultLabels
|
|
7
|
+
} from "@dynatrace/strato-components/charts";
|
|
8
|
+
import Colors from "@dynatrace/strato-design-tokens/colors";
|
|
9
|
+
import { LocationMarkerFilledIcon } from "@dynatrace/strato-icons";
|
|
5
10
|
import { useTruncationMode } from "../../hooks/use-truncation-mode.js";
|
|
6
11
|
import { isConnection, isRegion } from "../../utils/tooltip-type-guards.js";
|
|
7
12
|
const isChoroplethTooltip = (props) => isRegion(props.closestPoint);
|
|
@@ -9,19 +14,24 @@ const isConnectionTooltip = (props) => isConnection(props.closestPoint);
|
|
|
9
14
|
const isBubbleTooltip = (props) => !isNil(props.layerData);
|
|
10
15
|
const isDotTooltip = (props) => true;
|
|
11
16
|
const DefaultTooltip = (props) => {
|
|
12
|
-
|
|
17
|
+
const defaultConfig = useDefaultConfig();
|
|
18
|
+
const getLabel = useDefaultLabels();
|
|
13
19
|
const truncationMode = useTruncationMode();
|
|
20
|
+
let locations = [];
|
|
14
21
|
if (isChoroplethTooltip(props)) {
|
|
15
|
-
const { closestPoint } = props;
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const { closestPoint, seriesActions } = props;
|
|
23
|
+
return /* @__PURE__ */ jsxs(OverlayTooltip, { truncation: truncationMode, children: [
|
|
24
|
+
/* @__PURE__ */ jsx(OverlayTooltip.SeriesHeader, { valueLabel: "" }),
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
OverlayTooltip.SeriesItem,
|
|
27
|
+
{
|
|
28
|
+
color: closestPoint.color,
|
|
29
|
+
name: closestPoint.name,
|
|
30
|
+
value: closestPoint.data.value?.toString() ?? "",
|
|
31
|
+
actions: seriesActions ? () => seriesActions(closestPoint) : void 0
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
] });
|
|
25
35
|
} else if (isConnectionTooltip(props)) {
|
|
26
36
|
locations = props.closestPoint.data.path;
|
|
27
37
|
} else if (isBubbleTooltip(props)) {
|
|
@@ -30,22 +40,53 @@ const DefaultTooltip = (props) => {
|
|
|
30
40
|
} else if (isDotTooltip(props)) {
|
|
31
41
|
locations = [props.closestPoint.data];
|
|
32
42
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
))
|
|
43
|
+
const seriesLabel = getLabel?.("seriesLabel") ?? "";
|
|
44
|
+
const variant = defaultConfig?.sharedVariant ? "shared" : "single";
|
|
45
|
+
const seriesData = locations.map((location) => ({
|
|
46
|
+
name: `${location.latitude}, ${location.longitude}`,
|
|
47
|
+
value: ""
|
|
48
|
+
}));
|
|
49
|
+
const getActionsForItem = (current) => {
|
|
50
|
+
if (props.actionsForItem) {
|
|
51
|
+
return props.actionsForItem(current);
|
|
52
|
+
}
|
|
53
|
+
const { seriesActions: actions } = props;
|
|
54
|
+
if (!actions || !locations.length) {
|
|
55
|
+
return void 0;
|
|
47
56
|
}
|
|
48
|
-
|
|
57
|
+
const location = locations.find(
|
|
58
|
+
(l) => `${l.latitude}, ${l.longitude}` === current.name
|
|
59
|
+
);
|
|
60
|
+
return location ? () => actions(location) : void 0;
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsxs(OverlayTooltip, { truncation: truncationMode, children: [
|
|
63
|
+
/* @__PURE__ */ jsx(OverlayTooltip.Header, { header1: seriesLabel }),
|
|
64
|
+
/* @__PURE__ */ jsx(OverlayTooltip.SeriesHeader, { disabled: true }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
OverlayTooltip.Series,
|
|
67
|
+
{
|
|
68
|
+
activeItem: 0,
|
|
69
|
+
data: seriesData,
|
|
70
|
+
variant,
|
|
71
|
+
seriesItemTemplate: (current) => /* @__PURE__ */ jsx(
|
|
72
|
+
OverlayTooltip.SeriesItem,
|
|
73
|
+
{
|
|
74
|
+
...current,
|
|
75
|
+
iconStyle: "large",
|
|
76
|
+
actions: getActionsForItem(current),
|
|
77
|
+
icon: /* @__PURE__ */ jsx(
|
|
78
|
+
LocationMarkerFilledIcon,
|
|
79
|
+
{
|
|
80
|
+
style: {
|
|
81
|
+
fill: Colors.Text.Neutral.Default
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] });
|
|
49
90
|
};
|
|
50
91
|
DefaultTooltip["displayName"] = "DefaultTooltip";
|
|
51
92
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/DefaultTooltip/DefaultTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isNil } from 'lodash-es';\n\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { isNil } from 'lodash-es';\n\nimport {\n _OverlayTooltip as OverlayTooltip,\n _OverlayTooltipData as Data,\n _useDefaultConfig as useDefaultConfig,\n _useDefaultLabels as useDefaultLabels,\n type SeriesActionsTemplate,\n} from '@dynatrace/strato-components/charts';\nimport Colors from '@dynatrace/strato-design-tokens/colors';\nimport { LocationMarkerFilledIcon } from '@dynatrace/strato-icons';\n\nimport { useTruncationMode } from '../../hooks/use-truncation-mode.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n BubbleLayerTooltipData,\n ChoroplethLayerTooltipData,\n ConnectionLayerTooltipData,\n DotLayerTooltipData,\n LayerTooltipData,\n} from '../../types/tooltip.js';\nimport { isConnection, isRegion } from '../../utils/tooltip-type-guards.js';\n\nconst isChoroplethTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: ChoroplethLayerTooltipData;\n seriesActions?: (\n data: Location | ChoroplethLayerTooltipData,\n ) => SeriesActionsTemplate;\n} => isRegion(props.closestPoint);\nconst isConnectionTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: ConnectionLayerTooltipData;\n} => isConnection(props.closestPoint);\nconst isBubbleTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: BubbleLayerTooltipData;\n layerData: BubbleLayerTooltipData[];\n} => !isNil(props.layerData);\n\nconst isDotTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: DotLayerTooltipData;\n} => true; // if it's not any of the other tooltips, it will be Dot\n\ntype SeriesData = Data['series'][number];\n\ninterface DefaultTooltipProps {\n closestPoint: LayerTooltipData;\n layerData?: LayerTooltipData[];\n actionsForItem?: (\n item: SeriesData,\n ) => (() => SeriesActionsTemplate) | undefined;\n seriesActions?: (\n data: Location | ChoroplethLayerTooltipData,\n ) => SeriesActionsTemplate;\n}\n\nexport const DefaultTooltip = (props: DefaultTooltipProps) => {\n const defaultConfig = useDefaultConfig();\n const getLabel = useDefaultLabels();\n const truncationMode = useTruncationMode();\n let locations: Location[] = [];\n\n if (isChoroplethTooltip(props)) {\n const { closestPoint, seriesActions } = props;\n return (\n <OverlayTooltip truncation={truncationMode}>\n <OverlayTooltip.SeriesHeader valueLabel=\"\" />\n <OverlayTooltip.SeriesItem\n color={closestPoint.color}\n name={closestPoint.name}\n value={closestPoint.data.value?.toString() ?? ''}\n actions={\n seriesActions ? () => seriesActions(closestPoint) : undefined\n }\n />\n </OverlayTooltip>\n );\n } else if (isConnectionTooltip(props)) {\n locations = props.closestPoint.data.path;\n } else if (isBubbleTooltip(props)) {\n const { closestPoint, layerData } = props;\n locations =\n layerData === undefined || layerData === null || layerData.length === 0\n ? [closestPoint.data]\n : layerData.map((point) => point.data);\n } else if (isDotTooltip(props)) {\n locations = [props.closestPoint.data];\n }\n\n const seriesLabel = getLabel?.('seriesLabel') ?? '';\n const variant = defaultConfig?.sharedVariant ? 'shared' : 'single';\n\n const seriesData = locations.map((location) => ({\n name: `${location.latitude}, ${location.longitude}`,\n value: '',\n }));\n\n const getActionsForItem = (\n current: SeriesData,\n ): (() => SeriesActionsTemplate) | undefined => {\n if (props.actionsForItem) {\n return props.actionsForItem(current);\n }\n const { seriesActions: actions } = props;\n if (!actions || !locations.length) {\n return undefined;\n }\n const location = locations.find(\n (l) => `${l.latitude}, ${l.longitude}` === current.name,\n );\n return location ? () => actions(location) : undefined;\n };\n\n return (\n <OverlayTooltip truncation={truncationMode}>\n <OverlayTooltip.Header header1={seriesLabel} />\n <OverlayTooltip.SeriesHeader disabled />\n <OverlayTooltip.Series\n activeItem={0}\n data={seriesData}\n variant={variant}\n seriesItemTemplate={(current) => (\n <OverlayTooltip.SeriesItem\n {...current}\n iconStyle=\"large\"\n actions={getActionsForItem(current as SeriesData)}\n icon={\n <LocationMarkerFilledIcon\n style={{\n fill: Colors.Text.Neutral.Default,\n }}\n />\n }\n />\n )}\n />\n </OverlayTooltip>\n );\n};\n\nDefaultTooltip['displayName'] = 'DefaultTooltip';\n"],
|
|
5
|
+
"mappings": "AAuEM,SACE,KADF;AAvEN,SAAS,aAAa;AAEtB;AAAA,EACE,mBAAmB;AAAA,EAEnB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,OAEhB;AACP,OAAO,YAAY;AACnB,SAAS,gCAAgC;AAEzC,SAAS,yBAAyB;AASlC,SAAS,cAAc,gBAAgB;AAEvC,MAAM,sBAAsB,CAC1B,UAMG,SAAS,MAAM,YAAY;AAChC,MAAM,sBAAsB,CAC1B,UAGG,aAAa,MAAM,YAAY;AACpC,MAAM,kBAAkB,CACtB,UAIG,CAAC,MAAM,MAAM,SAAS;AAE3B,MAAM,eAAe,CACnB,UAGG;AAeE,MAAM,iBAAiB,CAAC,UAA+B;AAC5D,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,WAAW,iBAAiB;AAClC,QAAM,iBAAiB,kBAAkB;AACzC,MAAI,YAAwB,CAAC;AAE7B,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,EAAE,cAAc,cAAc,IAAI;AACxC,WACE,qBAAC,kBAAe,YAAY,gBAC1B;AAAA,0BAAC,eAAe,cAAf,EAA4B,YAAW,IAAG;AAAA,MAC3C;AAAA,QAAC,eAAe;AAAA,QAAf;AAAA,UACC,OAAO,aAAa;AAAA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