@dynatrace/strato-geo 2.9.4 → 2.11.2
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 +7 -1
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayer.js +8 -10
- package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js +12 -5
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +32 -85
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +12 -5
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +71 -0
- package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js.map +7 -0
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js +8 -8
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +30 -27
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +11 -6
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js +1 -1
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js.map +2 -2
- package/esm/map/components/DefaultTooltip/DefaultTooltip.js +1 -4
- package/esm/map/components/DefaultTooltip/DefaultTooltip.js.map +2 -2
- package/esm/map/components/DefaultTooltip/utils/get-default-actions.js +12 -4
- package/esm/map/components/DefaultTooltip/utils/get-default-actions.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayer.js +50 -52
- package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayerTooltip.js +12 -5
- package/esm/map/components/DotLayer/DotLayerTooltip.js.map +2 -2
- package/esm/map/components/MapContent.js +6 -6
- package/esm/map/components/MapContent.js.map +2 -2
- package/esm/map/components/TooltipWrapper.js +26 -0
- package/esm/map/components/TooltipWrapper.js.map +7 -0
- package/esm/map/components/toolbar/MapToolbar.js +11 -3
- package/esm/map/components/toolbar/MapToolbar.js.map +2 -2
- package/esm/map/contexts/tooltip.context.js +8 -0
- package/esm/map/contexts/tooltip.context.js.map +7 -0
- package/esm/map/hooks/use-active-interaction.js +24 -0
- package/esm/map/hooks/use-active-interaction.js.map +2 -2
- package/esm/map/hooks/use-get-position.js +56 -0
- package/esm/map/hooks/use-get-position.js.map +7 -0
- package/esm/map/hooks/use-overlay-events.js +10 -20
- package/esm/map/hooks/use-overlay-events.js.map +2 -2
- package/esm/map/hooks/use-tooltip-event-listeners.js +6 -22
- package/esm/map/hooks/use-tooltip-event-listeners.js.map +2 -2
- package/esm/map/index.js +2 -0
- package/esm/map/index.js.map +2 -2
- package/esm/map/slots/DownloadCSV.js +6 -0
- package/esm/map/slots/DownloadCSV.js.map +7 -0
- package/esm/map/slots/Toolbar.js +6 -0
- package/esm/map/slots/Toolbar.js.map +7 -0
- package/esm/map/store/map-store.context.js +3 -2
- package/esm/map/store/map-store.context.js.map +2 -2
- package/esm/map/store/map-store.provider.js +1 -1
- package/esm/map/store/map-store.provider.js.map +2 -2
- package/esm/map/store/selectors.js +4 -0
- package/esm/map/store/selectors.js.map +2 -2
- package/esm/map/store/store.js +59 -24
- package/esm/map/store/store.js.map +2 -2
- package/esm/map/utils/iterate-config-slots.js +21 -1
- package/esm/map/utils/iterate-config-slots.js.map +2 -2
- package/esm/map/utils/parse-tooltip-data.js +17 -0
- package/esm/map/utils/parse-tooltip-data.js.map +3 -3
- package/map/MapView.d.ts +12 -0
- package/map/MapView.js +7 -1
- package/map/components/BubbleLayer/BubbleLayer.js +7 -9
- package/map/components/BubbleLayer/BubbleLayerTooltip.d.ts +0 -1
- package/map/components/BubbleLayer/BubbleLayerTooltip.js +12 -5
- package/map/components/ChoroplethLayer/ChoroplethLayer.js +30 -76
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.d.ts +0 -1
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +12 -5
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.d.ts +3 -0
- package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +82 -0
- package/map/components/ConnectionLayer/ConnectionLayer.js +8 -8
- package/map/components/ConnectionLayer/ConnectionLayerLine.d.ts +2 -1
- package/map/components/ConnectionLayer/ConnectionLayerLine.js +29 -26
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.d.ts +1 -2
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +11 -6
- package/map/components/ConnectionLayer/utils/restore-null-props.js +1 -1
- package/map/components/DefaultTooltip/DefaultTooltip.js +1 -4
- package/map/components/DefaultTooltip/utils/get-default-actions.d.ts +2 -2
- package/map/components/DefaultTooltip/utils/get-default-actions.js +12 -4
- package/map/components/DotLayer/DotLayer.js +49 -51
- package/map/components/DotLayer/DotLayerTooltip.d.ts +0 -1
- package/map/components/DotLayer/DotLayerTooltip.js +12 -5
- package/map/components/MapContent.js +1 -1
- package/map/components/TooltipWrapper.d.ts +4 -0
- package/map/components/TooltipWrapper.js +42 -0
- package/map/components/toolbar/MapToolbar.js +11 -3
- package/map/contexts/tooltip.context.d.ts +3 -0
- package/map/contexts/tooltip.context.js +27 -0
- package/map/hooks/use-active-interaction.js +24 -0
- package/map/hooks/use-get-position.d.ts +4 -0
- package/map/hooks/use-get-position.js +75 -0
- package/map/hooks/use-overlay-events.js +7 -17
- package/map/hooks/use-tooltip-event-listeners.js +5 -18
- package/map/index.d.ts +2 -1
- package/map/index.js +2 -0
- package/map/slots/DownloadCSV.d.ts +8 -0
- package/map/slots/DownloadCSV.js +25 -0
- package/map/slots/Toolbar.d.ts +9 -0
- package/map/slots/Toolbar.js +25 -0
- package/map/store/map-store.context.d.ts +1 -23
- package/map/store/map-store.context.js +3 -2
- package/map/store/map-store.provider.js +1 -1
- package/map/store/selectors.d.ts +4 -4
- package/map/store/selectors.js +4 -0
- package/map/store/store.d.ts +5 -3
- package/map/store/store.js +59 -24
- package/map/types/state.d.ts +3 -4
- package/map/types/toolbar.d.ts +14 -11
- package/map/utils/iterate-config-slots.js +21 -1
- package/map/utils/parse-tooltip-data.d.ts +10 -1
- package/map/utils/parse-tooltip-data.js +17 -0
- package/package.json +5 -5
package/esm/map/MapView.js
CHANGED
|
@@ -24,7 +24,10 @@ import { MapTruncationModeContext } from "./contexts/map-truncation-mode.context
|
|
|
24
24
|
import { useLoadMapBaseLayer } from "./hooks/use-load-map-base-layer.js";
|
|
25
25
|
import { ColorScaleProvider } from "./providers/color-scale.provider.js";
|
|
26
26
|
import { LayerColorStrategyProvider } from "./providers/layer-color-strategy.provider.js";
|
|
27
|
+
import { DownloadCSV } from "./slots/DownloadCSV.js";
|
|
27
28
|
import { ErrorStateSlot } from "./slots/states/ErrorStateSlot.js";
|
|
29
|
+
import { Toolbar } from "./slots/Toolbar.js";
|
|
30
|
+
import { Zoom } from "./slots/Zoom.js";
|
|
28
31
|
import { MapStoreProvider } from "./store/map-store.provider.js";
|
|
29
32
|
import { isThresholdLegend } from "./utils/build-scale-from-legend-config.js";
|
|
30
33
|
import { extractLayersData } from "./utils/extract-layers-data.js";
|
|
@@ -146,7 +149,10 @@ const _MapView = forwardRef(
|
|
|
146
149
|
);
|
|
147
150
|
_MapView["displayName"] = "MapView";
|
|
148
151
|
const MapView = Object.assign(_MapView, {
|
|
149
|
-
ErrorState: ErrorStateSlot
|
|
152
|
+
ErrorState: ErrorStateSlot,
|
|
153
|
+
Toolbar,
|
|
154
|
+
DownloadCSV,
|
|
155
|
+
Zoom
|
|
150
156
|
});
|
|
151
157
|
export {
|
|
152
158
|
MapView
|
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-preview/charts';\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 { ErrorStateSlot } from './slots/states/ErrorStateSlot.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 {\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 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\n const chartLayoutRef = useAutoLegendRefresh(layersData);\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 >\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 <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={() => setIsMapLoaded(true)}\n {...remaining}\n >\n {parsedChildren}\n </MapContent>\n )}\n </ChartLayout.Graph>\n {!isLegendHidden && (\n <ChartLayout.Legend\n position={legendPosition}\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 </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});\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} from '@dynatrace/strato-components-preview/charts';\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 {\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 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\n const chartLayoutRef = useAutoLegendRefresh(layersData);\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 >\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 <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={() => setIsMapLoaded(true)}\n {...remaining}\n >\n {parsedChildren}\n </MapContent>\n )}\n </ChartLayout.Graph>\n {!isLegendHidden && (\n <ChartLayout.Legend\n position={legendPosition}\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 </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": "AA6GY,cAwBoB,YAxBpB;AA7GZ,SAAS,YAAoC,gBAAgB;AAE7D;AAAA,EACE,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,OACpB;AAEP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,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W,MAAM,eAAe,IAAI;AAAA,8BACnC,GAAG;AAAA,8BAEH;AAAA;AAAA,0BACH,GAEJ;AAAA,0BACC,CAAC,kBACA;AAAA,4BAAC,YAAY;AAAA,4BAAZ;AAAA,8BACC,UAAU;AAAA,8BACV,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;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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Source } from "@vis.gl/react-maplibre";
|
|
3
3
|
import { BubbleCircleLayer } from "./BubbleCircleLayer.js";
|
|
4
4
|
import { BubbleLayerTooltip } from "./BubbleLayerTooltip.js";
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
isScaleRadius
|
|
18
18
|
} from "../../types/bubble-layer.js";
|
|
19
19
|
import { isBubbleTooltipTemplate } from "../../utils/tooltip-type-guards.js";
|
|
20
|
+
import { TooltipWrapper } from "../TooltipWrapper.js";
|
|
20
21
|
const BubbleLayer = (props) => {
|
|
21
22
|
const {
|
|
22
23
|
data,
|
|
@@ -46,19 +47,16 @@ const BubbleLayer = (props) => {
|
|
|
46
47
|
radiusScale
|
|
47
48
|
);
|
|
48
49
|
const tooltipTemplate = useTooltipTemplate(children, BubbleLayerTooltipSlot);
|
|
49
|
-
return /* @__PURE__ */ jsxs(
|
|
50
|
-
/* @__PURE__ */ jsx(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
] }) }),
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
50
|
+
return /* @__PURE__ */ jsx(SizeInterpolationContext.Provider, { value: sizeInterpolation, children: /* @__PURE__ */ jsxs(Source, { id: sourceId, type: "geojson", data: dataGeoJson, generateId: true, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(BubbleCircleLayer, { id: layerId, source: sourceId }),
|
|
52
|
+
/* @__PURE__ */ jsx(BubbleOutlineLayer, { beforeId: layerId, source: sourceId }),
|
|
53
|
+
/* @__PURE__ */ jsx(TooltipWrapper, { layerId, children: /* @__PURE__ */ jsx(
|
|
55
54
|
BubbleLayerTooltip,
|
|
56
55
|
{
|
|
57
|
-
layerId,
|
|
58
56
|
tooltipTemplate: isBubbleTooltipTemplate(tooltipTemplate) ? tooltipTemplate : void 0
|
|
59
57
|
}
|
|
60
|
-
)
|
|
61
|
-
] });
|
|
58
|
+
) })
|
|
59
|
+
] }) });
|
|
62
60
|
};
|
|
63
61
|
BubbleLayer["displayName"] = "BubbleLayer";
|
|
64
62
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/BubbleLayer/BubbleLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Source } from '@vis.gl/react-maplibre';\nimport { type PropsWithChildren } from 'react';\n\nimport { BubbleCircleLayer } from './BubbleCircleLayer.js';\nimport { BubbleLayerTooltip } from './BubbleLayerTooltip.js';\nimport { BubbleOutlineLayer } from './BubbleOutlineLayer.js';\nimport { SizeInterpolationContext } from './contexts/size-interpolation.context.js';\nimport { buildRadiusScale } from './utils/build-radius-scale.js';\nimport { parseBubbleDataToGeoJSON } from './utils/parse-bubble-data-to-geo-json.js';\nimport { DEFAULT_BUBBLE_COLOR, DEFAULT_RADIUS } from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { BubbleLayerTooltip as BubbleLayerTooltipSlot } from '../../slots/BubbleLayerTooltip.js';\nimport {\n type InternalBubbleLayerProps,\n isScaleRadius,\n} from '../../types/bubble-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isBubbleTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\nexport const BubbleLayer = <T extends Location>(\n props: PropsWithChildren<InternalBubbleLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n radius = DEFAULT_RADIUS,\n children,\n sizeInterpolation = 'fixed',\n } = props;\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Source } from '@vis.gl/react-maplibre';\nimport { type PropsWithChildren } from 'react';\n\nimport { BubbleCircleLayer } from './BubbleCircleLayer.js';\nimport { BubbleLayerTooltip } from './BubbleLayerTooltip.js';\nimport { BubbleOutlineLayer } from './BubbleOutlineLayer.js';\nimport { SizeInterpolationContext } from './contexts/size-interpolation.context.js';\nimport { buildRadiusScale } from './utils/build-radius-scale.js';\nimport { parseBubbleDataToGeoJSON } from './utils/parse-bubble-data-to-geo-json.js';\nimport { DEFAULT_BUBBLE_COLOR, DEFAULT_RADIUS } from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { BubbleLayerTooltip as BubbleLayerTooltipSlot } from '../../slots/BubbleLayerTooltip.js';\nimport {\n type InternalBubbleLayerProps,\n isScaleRadius,\n} from '../../types/bubble-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isBubbleTooltipTemplate } from '../../utils/tooltip-type-guards.js';\nimport { TooltipWrapper } from '../TooltipWrapper.js';\n\nexport const BubbleLayer = <T extends Location>(\n props: PropsWithChildren<InternalBubbleLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n radius = DEFAULT_RADIUS,\n children,\n sizeInterpolation = 'fixed',\n } = props;\n const colorParser = useLayerColoringStrategy();\n const bubbleColor = useResolveLocationColor(\n DEFAULT_BUBBLE_COLOR,\n props,\n colorParser,\n );\n\n const sourceId = `source-${layerId}`;\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n let radiusScale = (value: number) => value;\n\n if (isScaleRadius(props)) {\n const { radiusRange = [10, 100], radius, scale = 'linear' } = props;\n\n radiusScale = buildRadiusScale(data, radius, scale, radiusRange);\n }\n\n const dataGeoJson = parseBubbleDataToGeoJSON(\n data,\n bubbleColor,\n radius,\n radiusScale,\n );\n\n const tooltipTemplate = useTooltipTemplate(children, BubbleLayerTooltipSlot);\n\n return (\n <SizeInterpolationContext.Provider value={sizeInterpolation}>\n <Source id={sourceId} type=\"geojson\" data={dataGeoJson} generateId>\n <BubbleCircleLayer id={layerId} source={sourceId} />\n <BubbleOutlineLayer beforeId={layerId} source={sourceId} />\n <TooltipWrapper layerId={layerId}>\n <BubbleLayerTooltip\n tooltipTemplate={\n isBubbleTooltipTemplate(tooltipTemplate)\n ? tooltipTemplate\n : undefined\n }\n />\n </TooltipWrapper>\n </Source>\n </SizeInterpolationContext.Provider>\n );\n};\n\nBubbleLayer['displayName'] = 'BubbleLayer';\n"],
|
|
5
|
+
"mappings": "AAgEM,SACE,KADF;AAhEN,SAAS,cAAc;AAGvB,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,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6
|
"names": ["radius"]
|
|
7
7
|
}
|
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
_ChartTooltip as ChartTooltip,
|
|
6
6
|
_useChartActionsMenu as useChartActionsMenu
|
|
7
7
|
} from "@dynatrace/strato-components-preview/charts";
|
|
8
|
+
import { useGetPosition } from "../../hooks/use-get-position.js";
|
|
8
9
|
import {
|
|
9
10
|
useMapTooltipPinnedState,
|
|
10
11
|
useMapTooltipState
|
|
11
12
|
} from "../../store/selectors.js";
|
|
12
13
|
const BubbleLayerTooltip = (props) => {
|
|
13
|
-
const {
|
|
14
|
+
const { tooltipTemplate } = props;
|
|
14
15
|
const {
|
|
15
16
|
selectedItem: selectedItemId,
|
|
16
17
|
actionsMenuRef,
|
|
@@ -18,15 +19,16 @@ const BubbleLayerTooltip = (props) => {
|
|
|
18
19
|
onLeave
|
|
19
20
|
} = useChartActionsMenu();
|
|
20
21
|
const tooltipRef = useRef(null);
|
|
21
|
-
const {
|
|
22
|
+
const { data, visible, enabled } = useMapTooltipState();
|
|
22
23
|
const pinned = useMapTooltipPinnedState();
|
|
23
24
|
const closestPoint = useRef(null);
|
|
24
25
|
const remainingPoints = useRef([]);
|
|
25
|
-
const forceHideTooltip = !pinned && (
|
|
26
|
+
const forceHideTooltip = !pinned && (!visible || !enabled);
|
|
27
|
+
const position = useGetPosition(pinned, !forceHideTooltip);
|
|
26
28
|
if (!tooltipTemplate || forceHideTooltip || !position) {
|
|
27
29
|
return null;
|
|
28
30
|
}
|
|
29
|
-
if (
|
|
31
|
+
if (data?.[0]) {
|
|
30
32
|
const sanitizedData = data.map((bubbleProps) => {
|
|
31
33
|
const {
|
|
32
34
|
__color: color,
|
|
@@ -43,9 +45,14 @@ const BubbleLayerTooltip = (props) => {
|
|
|
43
45
|
closestPoint.current = sortedBubbles[0];
|
|
44
46
|
remainingPoints.current = sortedBubbles.slice(1);
|
|
45
47
|
}
|
|
48
|
+
const template = closestPoint.current ? tooltipTemplate(closestPoint.current, remainingPoints.current) : null;
|
|
49
|
+
if (!template) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
46
52
|
return /* @__PURE__ */ jsx(
|
|
47
53
|
ChartTooltip,
|
|
48
54
|
{
|
|
55
|
+
updatePositionWhenPinned: true,
|
|
49
56
|
position,
|
|
50
57
|
pinned,
|
|
51
58
|
ref: tooltipRef,
|
|
@@ -55,7 +62,7 @@ const BubbleLayerTooltip = (props) => {
|
|
|
55
62
|
actionsMenuRef,
|
|
56
63
|
updateSelectedItem
|
|
57
64
|
},
|
|
58
|
-
children:
|
|
65
|
+
children: template
|
|
59
66
|
}
|
|
60
67
|
);
|
|
61
68
|
};
|
|
@@ -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';\nimport { useRef } from 'react';\n\nimport {\n _ChartTooltip as ChartTooltip,\n _useChartActionsMenu as useChartActionsMenu,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport {\n useMapTooltipPinnedState,\n useMapTooltipState,\n} from '../../store/selectors.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n BubbleLayerTooltipData,\n BubbleLayerTooltipHandler,\n} from '../../types/tooltip.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
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { sortBy } from 'lodash-es';\nimport { useRef } from 'react';\n\nimport {\n _ChartTooltip as ChartTooltip,\n _useChartActionsMenu as useChartActionsMenu,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { useGetPosition } from '../../hooks/use-get-position.js';\nimport {\n useMapTooltipPinnedState,\n useMapTooltipState,\n} from '../../store/selectors.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n BubbleLayerTooltipData,\n BubbleLayerTooltipHandler,\n} from '../../types/tooltip.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 const {\n selectedItem: selectedItemId,\n actionsMenuRef,\n updateSelectedItem,\n onLeave,\n } = useChartActionsMenu();\n const tooltipRef = useRef<HTMLDivElement | null>(null);\n const { data, visible, enabled } =\n useMapTooltipState<BubbleTooltipStatePayload>();\n\n const pinned = useMapTooltipPinnedState();\n const closestPoint = useRef<BubbleLayerTooltipData | null>(null);\n const remainingPoints = useRef<BubbleLayerTooltipData[]>([]);\n\n const forceHideTooltip = !pinned && (!visible || !enabled);\n\n const position = useGetPosition(pinned, !forceHideTooltip);\n if (!tooltipTemplate || forceHideTooltip || !position) {\n return null;\n }\n\n if (data?.[0]) {\n const sanitizedData = data.map((bubbleProps) => {\n const {\n __color: color,\n __radius: radius,\n data: customData,\n } = bubbleProps;\n\n return {\n color,\n radius,\n data: customData,\n };\n });\n\n const sortedBubbles = sortBy(sanitizedData, ({ radius }) => radius);\n closestPoint.current = sortedBubbles[0];\n remainingPoints.current = sortedBubbles.slice(1);\n }\n const template = closestPoint.current\n ? tooltipTemplate(closestPoint.current, remainingPoints.current)\n : null;\n\n if (!template) {\n return null;\n }\n\n return (\n <ChartTooltip\n updatePositionWhenPinned\n position={position}\n pinned={pinned}\n ref={tooltipRef}\n onMouseLeave={onLeave}\n actionSelectionValue={{\n selectedItemId,\n actionsMenuRef,\n updateSelectedItem,\n }}\n >\n {template}\n </ChartTooltip>\n );\n};\n\nBubbleLayerTooltip['displayName'] = 'BubbleLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AAkFI;AAlFJ,SAAS,cAAc;AACvB,SAAS,cAAc;AAEvB;AAAA,EACE,i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AAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEA,mBAAmB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Layer, Source } from "@vis.gl/react-maplibre";
|
|
3
|
-
import { _getCanvasColor as getCanvasColor } from "@dynatrace/strato-components-preview/charts";
|
|
4
3
|
import { ChoroplethLayerTooltip } from "./ChoroplethLayerTooltip.js";
|
|
4
|
+
import { ChoroplethOutlineLayer } from "./ChoroplethOutlineLayer.js";
|
|
5
5
|
import { parseRegionDataToGeoJSON } from "./utils/parse-region-data-to-geo-json.js";
|
|
6
6
|
import {
|
|
7
|
-
ACTIVE_COLOR,
|
|
8
|
-
ACTIVE_BORDER_WIDTH_OUTER,
|
|
9
|
-
COUNTRY_BORDER_WIDTH,
|
|
10
|
-
REGION_BORDER_WIDTH,
|
|
11
7
|
DEFAULT_CHOROPLETH_COLOR,
|
|
12
|
-
DEFAULT_BOUNDARIES_BORDER_COLOR,
|
|
13
8
|
SHAPE_OPACITY_DIMMED,
|
|
14
|
-
SHAPE_OPACITY_DEFAULT
|
|
15
|
-
TRANSPARENT_BORDER_COLOR,
|
|
16
|
-
ACTIVE_BORDER_WIDTH_INNER
|
|
9
|
+
SHAPE_OPACITY_DEFAULT
|
|
17
10
|
} from "../../constants.js";
|
|
18
11
|
import { useLayerColoringStrategy } from "../../hooks/use-layer-coloring-strategy.js";
|
|
19
12
|
import { useLegendInteractionHighlighting } from "../../hooks/use-legend-interaction-highlighting.js";
|
|
@@ -23,6 +16,7 @@ import { useResolveChoroplethColor } from "../../hooks/use-resolve-color.js";
|
|
|
23
16
|
import { useTooltipTemplate } from "../../hooks/use-tooltip-template.js";
|
|
24
17
|
import { ChoroplethLayerTooltip as ChoroplethLayerTooltipSlot } from "../../slots/ChoroplethLayerTooltip.js";
|
|
25
18
|
import { isChoroplethTooltipTemplate } from "../../utils/tooltip-type-guards.js";
|
|
19
|
+
import { TooltipWrapper } from "../TooltipWrapper.js";
|
|
26
20
|
const ChoroplethLayer = (props) => {
|
|
27
21
|
const { layerId, data, regionAccessor, children } = props;
|
|
28
22
|
const mapSource = useMapBaseLayerFeatures();
|
|
@@ -40,86 +34,39 @@ const ChoroplethLayer = (props) => {
|
|
|
40
34
|
children,
|
|
41
35
|
ChoroplethLayerTooltipSlot
|
|
42
36
|
);
|
|
43
|
-
return dataGeoJSON && /* @__PURE__ */ jsxs(
|
|
44
|
-
/* @__PURE__ */ jsxs(Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true, children: [
|
|
45
|
-
/* @__PURE__ */ jsx(
|
|
46
|
-
Layer,
|
|
47
|
-
{
|
|
48
|
-
id: layerId,
|
|
49
|
-
source: sourceId,
|
|
50
|
-
type: "fill",
|
|
51
|
-
paint: {
|
|
52
|
-
"fill-color": ["get", "__color"],
|
|
53
|
-
"fill-opacity": [
|
|
54
|
-
"case",
|
|
55
|
-
["==", ["feature-state", "legendHover"], false],
|
|
56
|
-
SHAPE_OPACITY_DIMMED,
|
|
57
|
-
["==", ["feature-state", "active"], true],
|
|
58
|
-
SHAPE_OPACITY_DEFAULT,
|
|
59
|
-
["==", ["feature-state", "hover"], true],
|
|
60
|
-
SHAPE_OPACITY_DEFAULT,
|
|
61
|
-
["==", ["feature-state", "legendHover"], true],
|
|
62
|
-
SHAPE_OPACITY_DEFAULT,
|
|
63
|
-
["==", ["feature-state", "isAnyActive"], true],
|
|
64
|
-
SHAPE_OPACITY_DIMMED,
|
|
65
|
-
SHAPE_OPACITY_DEFAULT
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
/* @__PURE__ */ jsx(
|
|
71
|
-
Layer,
|
|
72
|
-
{
|
|
73
|
-
source: sourceId,
|
|
74
|
-
type: "line",
|
|
75
|
-
paint: {
|
|
76
|
-
"line-color": [
|
|
77
|
-
"case",
|
|
78
|
-
["==", ["feature-state", "active"], true],
|
|
79
|
-
getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),
|
|
80
|
-
["==", ["feature-state", "hover"], true],
|
|
81
|
-
getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),
|
|
82
|
-
getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR)
|
|
83
|
-
],
|
|
84
|
-
"line-width": [
|
|
85
|
-
"case",
|
|
86
|
-
["==", ["feature-state", "active"], true],
|
|
87
|
-
ACTIVE_BORDER_WIDTH_OUTER,
|
|
88
|
-
["==", ["feature-state", "hover"], true],
|
|
89
|
-
ACTIVE_BORDER_WIDTH_OUTER,
|
|
90
|
-
["==", ["get", "region_type"], "REGION"],
|
|
91
|
-
REGION_BORDER_WIDTH,
|
|
92
|
-
COUNTRY_BORDER_WIDTH
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
/* @__PURE__ */ jsx(
|
|
98
|
-
Layer,
|
|
99
|
-
{
|
|
100
|
-
source: sourceId,
|
|
101
|
-
type: "line",
|
|
102
|
-
paint: {
|
|
103
|
-
"line-color": [
|
|
104
|
-
"case",
|
|
105
|
-
["==", ["feature-state", "active"], true],
|
|
106
|
-
getCanvasColor(ACTIVE_COLOR),
|
|
107
|
-
["==", ["feature-state", "hover"], true],
|
|
108
|
-
getCanvasColor(ACTIVE_COLOR),
|
|
109
|
-
getCanvasColor(TRANSPARENT_BORDER_COLOR)
|
|
110
|
-
],
|
|
111
|
-
"line-width": ACTIVE_BORDER_WIDTH_INNER
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
] }),
|
|
37
|
+
return dataGeoJSON && /* @__PURE__ */ jsxs(Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true, children: [
|
|
116
38
|
/* @__PURE__ */ jsx(
|
|
39
|
+
Layer,
|
|
40
|
+
{
|
|
41
|
+
id: layerId,
|
|
42
|
+
source: sourceId,
|
|
43
|
+
type: "fill",
|
|
44
|
+
paint: {
|
|
45
|
+
"fill-color": ["get", "__color"],
|
|
46
|
+
"fill-opacity": [
|
|
47
|
+
"case",
|
|
48
|
+
["==", ["feature-state", "legendHover"], false],
|
|
49
|
+
SHAPE_OPACITY_DIMMED,
|
|
50
|
+
["==", ["feature-state", "active"], true],
|
|
51
|
+
SHAPE_OPACITY_DEFAULT,
|
|
52
|
+
["==", ["feature-state", "hover"], true],
|
|
53
|
+
SHAPE_OPACITY_DEFAULT,
|
|
54
|
+
["==", ["feature-state", "legendHover"], true],
|
|
55
|
+
SHAPE_OPACITY_DEFAULT,
|
|
56
|
+
["==", ["feature-state", "isAnyActive"], true],
|
|
57
|
+
SHAPE_OPACITY_DIMMED,
|
|
58
|
+
SHAPE_OPACITY_DEFAULT
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx(ChoroplethOutlineLayer, { sourceId }),
|
|
64
|
+
/* @__PURE__ */ jsx(TooltipWrapper, { layerId, children: /* @__PURE__ */ jsx(
|
|
117
65
|
ChoroplethLayerTooltip,
|
|
118
66
|
{
|
|
119
|
-
layerId,
|
|
120
67
|
tooltipTemplate: isChoroplethTooltipTemplate(tooltipTemplate) ? tooltipTemplate : void 0
|
|
121
68
|
}
|
|
122
|
-
)
|
|
69
|
+
) })
|
|
123
70
|
] });
|
|
124
71
|
};
|
|
125
72
|
ChoroplethLayer["displayName"] = "ChoroplethLayer";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ChoroplethLayer/ChoroplethLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport { type PropsWithChildren } from 'react';\n\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport { type PropsWithChildren } from 'react';\n\nimport { ChoroplethLayerTooltip } from './ChoroplethLayerTooltip.js';\nimport { ChoroplethOutlineLayer } from './ChoroplethOutlineLayer.js';\nimport { parseRegionDataToGeoJSON } from './utils/parse-region-data-to-geo-json.js';\nimport {\n DEFAULT_CHOROPLETH_COLOR,\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n} from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useMapBaseLayerFeatures } from '../../hooks/use-map-base-layer-features.js';\nimport { useResolveChoroplethColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { ChoroplethLayerTooltip as ChoroplethLayerTooltipSlot } from '../../slots/ChoroplethLayerTooltip.js';\nimport type { InternalChoroplethLayerProps } from '../../types/choropleth-layer.js';\nimport { isChoroplethTooltipTemplate } from '../../utils/tooltip-type-guards.js';\nimport { TooltipWrapper } from '../TooltipWrapper.js';\n\nexport const ChoroplethLayer = <T extends Record<string, unknown>>(\n props: PropsWithChildren<InternalChoroplethLayerProps<T>>,\n) => {\n const { layerId, data, regionAccessor, children } = props;\n const mapSource = useMapBaseLayerFeatures();\n\n const colorParser = useLayerColoringStrategy();\n const choroplethColor = useResolveChoroplethColor(\n DEFAULT_CHOROPLETH_COLOR,\n props,\n colorParser,\n );\n const sourceId = layerId.replace('layer', 'source');\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n const dataGeoJSON =\n mapSource &&\n parseRegionDataToGeoJSON(mapSource, data, regionAccessor, choroplethColor);\n\n const tooltipTemplate = useTooltipTemplate(\n children,\n ChoroplethLayerTooltipSlot,\n );\n\n return (\n dataGeoJSON && (\n <Source id={sourceId} type=\"geojson\" data={dataGeoJSON} generateId>\n <Layer\n id={layerId}\n source={sourceId}\n type=\"fill\"\n paint={{\n 'fill-color': ['get', '__color'],\n 'fill-opacity': [\n 'case',\n ['==', ['feature-state', 'legendHover'], false],\n SHAPE_OPACITY_DIMMED,\n ['==', ['feature-state', 'active'], true],\n SHAPE_OPACITY_DEFAULT,\n ['==', ['feature-state', 'hover'], true],\n SHAPE_OPACITY_DEFAULT,\n ['==', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n ['==', ['feature-state', 'isAnyActive'], true],\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n ],\n }}\n />\n <ChoroplethOutlineLayer sourceId={sourceId} />\n <TooltipWrapper layerId={layerId}>\n <ChoroplethLayerTooltip\n tooltipTemplate={\n isChoroplethTooltipTemplate(tooltipTemplate)\n ? tooltipTemplate\n : undefined\n }\n />\n </TooltipWrapper>\n </Source>\n )\n );\n};\n\nChoroplethLayer['displayName'] = 'ChoroplethLayer';\n"],
|
|
5
|
+
"mappings": "AAiDM,SACE,KADF;AAjDN,SAAS,OAAO,cAAc;AAG9B,SAAS,8BAA8B;AACvC,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,sCAAsC;AAC/C,SAAS,+BAA+B;AACxC,SAAS,iCAAiC;AAC1C,SAAS,0BAA0B;AACnC,SAAS,0BAA0B,kCAAkC;AAErE,SAAS,mCAAmC;AAC5C,SAAS,sBAAsB;AAExB,MAAM,kBAAkB,CAC7B,UACG;AACH,QAAM,EAAE,SAAS,MAAM,gBAAgB,SAAS,IAAI;AACpD,QAAM,YAAY,wBAAwB;AAE1C,QAAM,cAAc,yBAAyB;AAC7C,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,QAAM,WAAW,QAAQ,QAAQ,SAAS,QAAQ;AAClD,mCAAiC,OAAO,QAAQ;AAChD,iCAA+B,OAAO,OAAO;AAE7C,QAAM,cACJ,aACA,yBAAyB,WAAW,MAAM,gBAAgB,eAAe;AAE3E,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA;AAAA,EACF;AAEA,SACE,eACE,qBAAC,UAAO,IAAI,UAAU,MAAK,WAAU,MAAM,aAAa,YAAU,MAChE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,QAAQ;AAAA,QACR,MAAK;AAAA,QACL,OAAO;AAAA,UACL,cAAc,CAAC,OAAO,SAAS;AAAA,UAC/B,gBAAgB;AAAA,YACd;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,aAAa,GAAG,KAAK;AAAA,YAC9C;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,QAAQ,GAAG,IAAI;AAAA,YACxC;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,OAAO,GAAG,IAAI;AAAA,YACvC;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,YAC7C;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,YAC7C;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,0BAAuB,UAAoB;AAAA,IAC5C,oBAAC,kBAAe,SACd;AAAA,MAAC;AAAA;AAAA,QACC,iBACE,4BAA4B,eAAe,IACvC,kBACA;AAAA;AAAA,IAER,GACF;AAAA,KACF;AAGN;AAEA,gBAAgB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,32 +4,39 @@ import {
|
|
|
4
4
|
_ChartTooltip as ChartTooltip,
|
|
5
5
|
_useChartActionsMenu as useChartActionsMenu
|
|
6
6
|
} from "@dynatrace/strato-components-preview/charts";
|
|
7
|
+
import { useGetPosition } from "../../hooks/use-get-position.js";
|
|
7
8
|
import {
|
|
8
9
|
useMapTooltipPinnedState,
|
|
9
10
|
useMapTooltipState
|
|
10
11
|
} from "../../store/selectors.js";
|
|
11
12
|
const ChoroplethLayerTooltip = (props) => {
|
|
12
|
-
const {
|
|
13
|
+
const { tooltipTemplate } = props;
|
|
13
14
|
const {
|
|
14
15
|
selectedItem: selectedItemId,
|
|
15
16
|
actionsMenuRef,
|
|
16
17
|
updateSelectedItem,
|
|
17
18
|
onLeave
|
|
18
19
|
} = useChartActionsMenu();
|
|
19
|
-
const {
|
|
20
|
+
const { data, visible, enabled } = useMapTooltipState();
|
|
20
21
|
const pinned = useMapTooltipPinnedState();
|
|
21
22
|
const regionData = useRef(null);
|
|
22
|
-
const forceHideTooltip = !pinned && (
|
|
23
|
+
const forceHideTooltip = !pinned && (!visible || !enabled);
|
|
24
|
+
const position = useGetPosition(pinned, !forceHideTooltip);
|
|
23
25
|
if (!tooltipTemplate || forceHideTooltip || !position) {
|
|
24
26
|
return null;
|
|
25
27
|
}
|
|
26
|
-
if (
|
|
28
|
+
if (data?.[0]) {
|
|
27
29
|
const { name, __color: color, data: customData } = data[0];
|
|
28
30
|
regionData.current = { data: customData, name, color };
|
|
29
31
|
}
|
|
32
|
+
const template = regionData.current && tooltipTemplate(regionData.current);
|
|
33
|
+
if (!template) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
30
36
|
return /* @__PURE__ */ jsx(
|
|
31
37
|
ChartTooltip,
|
|
32
38
|
{
|
|
39
|
+
updatePositionWhenPinned: true,
|
|
33
40
|
position,
|
|
34
41
|
pinned,
|
|
35
42
|
onMouseLeave: onLeave,
|
|
@@ -38,7 +45,7 @@ const ChoroplethLayerTooltip = (props) => {
|
|
|
38
45
|
actionsMenuRef,
|
|
39
46
|
updateSelectedItem
|
|
40
47
|
},
|
|
41
|
-
children:
|
|
48
|
+
children: template
|
|
42
49
|
}
|
|
43
50
|
);
|
|
44
51
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ChoroplethLayer/ChoroplethLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from 'react';\n\nimport {\n _ChartTooltip as ChartTooltip,\n _useChartActionsMenu as useChartActionsMenu,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport {\n useMapTooltipPinnedState,\n useMapTooltipState,\n} from '../../store/selectors.js';\nimport type {\n ChoroplethLayerTooltipData,\n ChoroplethLayerTooltipHandler,\n} from '../../types/tooltip.js';\n\ninterface ChoroplethTooltipStatePayload {\n name: string;\n __color: string;\n __hoveredColor: string;\n data: Record<string, unknown>;\n}\n\nexport interface ChoroplethLayerTooltipProps {\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useRef } from 'react';\n\nimport {\n _ChartTooltip as ChartTooltip,\n _useChartActionsMenu as useChartActionsMenu,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { useGetPosition } from '../../hooks/use-get-position.js';\nimport {\n useMapTooltipPinnedState,\n useMapTooltipState,\n} from '../../store/selectors.js';\nimport type {\n ChoroplethLayerTooltipData,\n ChoroplethLayerTooltipHandler,\n} from '../../types/tooltip.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 const {\n selectedItem: selectedItemId,\n actionsMenuRef,\n updateSelectedItem,\n onLeave,\n } = useChartActionsMenu();\n\n const { data, visible, enabled } =\n useMapTooltipState<ChoroplethTooltipStatePayload>();\n const pinned = useMapTooltipPinnedState();\n const regionData = useRef<ChoroplethLayerTooltipData | null>(null);\n\n const forceHideTooltip = !pinned && (!visible || !enabled);\n const position = useGetPosition(pinned, !forceHideTooltip);\n if (!tooltipTemplate || forceHideTooltip || !position) {\n return null;\n }\n\n if (data?.[0]) {\n const { name, __color: color, data: customData } = data[0];\n\n regionData.current = { data: customData, name, color };\n }\n const template = regionData.current && tooltipTemplate(regionData.current);\n\n if (!template) {\n return null;\n }\n\n return (\n <ChartTooltip\n updatePositionWhenPinned\n position={position}\n pinned={pinned}\n onMouseLeave={onLeave}\n actionSelectionValue={{\n selectedItemId,\n actionsMenuRef,\n updateSelectedItem,\n }}\n >\n {template}\n </ChartTooltip>\n );\n};\n\nChoroplethLayerTooltip['displayName'] = 'ChoroplethLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AA4DI;AA5DJ,SAAS,cAAc;AAEvB;AAAA,EACE,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,OACnB;AAEP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAiBA,MAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM,EAAE,gBAAgB,IAAI;AAC5B,QAAM;AAAA,IACJ,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,oBAAoB;AAExB,QAAM,EAAE,MAAM,SAAS,QAAQ,IAC7B,mBAAkD;AACpD,QAAM,SAAS,yBAAyB;AACxC,QAAM,aAAa,OAA0C,IAAI;AAEjE,QAAM,mBAAmB,CAAC,WAAW,CAAC,WAAW,CAAC;AAClD,QAAM,WAAW,eAAe,QAAQ,CAAC,gBAAgB;AACzD,MAAI,CAAC,mBAAmB,oBAAoB,CAAC,UAAU;AACrD,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,CAAC,GAAG;AACb,UAAM,EAAE,MAAM,SAAS,OAAO,MAAM,WAAW,IAAI,KAAK,CAAC;AAEzD,eAAW,UAAU,EAAE,MAAM,YAAY,MAAM,MAAM;AAAA,EACvD;AACA,QAAM,WAAW,WAAW,WAAW,gBAAgB,WAAW,OAAO;AAEzE,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,0BAAwB;AAAA,MACxB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,sBAAsB;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEA,uBAAuB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Layer } from "@vis.gl/react-maplibre";
|
|
3
|
+
import { _getCanvasColor as getCanvasColor } from "@dynatrace/strato-components-preview/charts";
|
|
4
|
+
import {
|
|
5
|
+
ACTIVE_COLOR,
|
|
6
|
+
ACTIVE_BORDER_WIDTH_OUTER,
|
|
7
|
+
COUNTRY_BORDER_WIDTH,
|
|
8
|
+
REGION_BORDER_WIDTH,
|
|
9
|
+
DEFAULT_BOUNDARIES_BORDER_COLOR,
|
|
10
|
+
TRANSPARENT_BORDER_COLOR,
|
|
11
|
+
ACTIVE_BORDER_WIDTH_INNER
|
|
12
|
+
} from "../../constants.js";
|
|
13
|
+
const ChoroplethOutlineLayer = (props) => {
|
|
14
|
+
const { sourceId } = props;
|
|
15
|
+
const activeColor = getCanvasColor(ACTIVE_COLOR);
|
|
16
|
+
const defaultBoundariesBorderColor = getCanvasColor(
|
|
17
|
+
DEFAULT_BOUNDARIES_BORDER_COLOR
|
|
18
|
+
);
|
|
19
|
+
const transparentBorderColor = getCanvasColor(TRANSPARENT_BORDER_COLOR);
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
Layer,
|
|
23
|
+
{
|
|
24
|
+
source: sourceId,
|
|
25
|
+
type: "line",
|
|
26
|
+
paint: {
|
|
27
|
+
"line-color": [
|
|
28
|
+
"case",
|
|
29
|
+
["==", ["feature-state", "active"], true],
|
|
30
|
+
defaultBoundariesBorderColor,
|
|
31
|
+
["==", ["feature-state", "hover"], true],
|
|
32
|
+
defaultBoundariesBorderColor,
|
|
33
|
+
defaultBoundariesBorderColor
|
|
34
|
+
],
|
|
35
|
+
"line-width": [
|
|
36
|
+
"case",
|
|
37
|
+
["==", ["feature-state", "active"], true],
|
|
38
|
+
ACTIVE_BORDER_WIDTH_OUTER,
|
|
39
|
+
["==", ["feature-state", "hover"], true],
|
|
40
|
+
ACTIVE_BORDER_WIDTH_OUTER,
|
|
41
|
+
["==", ["get", "region_type"], "REGION"],
|
|
42
|
+
REGION_BORDER_WIDTH,
|
|
43
|
+
COUNTRY_BORDER_WIDTH
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Layer,
|
|
50
|
+
{
|
|
51
|
+
source: sourceId,
|
|
52
|
+
type: "line",
|
|
53
|
+
paint: {
|
|
54
|
+
"line-color": [
|
|
55
|
+
"case",
|
|
56
|
+
["==", ["feature-state", "active"], true],
|
|
57
|
+
activeColor,
|
|
58
|
+
["==", ["feature-state", "hover"], true],
|
|
59
|
+
activeColor,
|
|
60
|
+
transparentBorderColor
|
|
61
|
+
],
|
|
62
|
+
"line-width": ACTIVE_BORDER_WIDTH_INNER
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
ChoroplethOutlineLayer
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ChoroplethOutlineLayer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/map/components/ChoroplethLayer/ChoroplethOutlineLayer.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Layer } from '@vis.gl/react-maplibre';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport {\n ACTIVE_COLOR,\n ACTIVE_BORDER_WIDTH_OUTER,\n COUNTRY_BORDER_WIDTH,\n REGION_BORDER_WIDTH,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n TRANSPARENT_BORDER_COLOR,\n ACTIVE_BORDER_WIDTH_INNER,\n} from '../../constants.js';\n\nexport const ChoroplethOutlineLayer = (props: { sourceId: string }) => {\n const { sourceId } = props;\n const activeColor = getCanvasColor(ACTIVE_COLOR);\n const defaultBoundariesBorderColor = getCanvasColor(\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n );\n const transparentBorderColor = getCanvasColor(TRANSPARENT_BORDER_COLOR);\n\n return (\n <>\n <Layer\n source={sourceId}\n type=\"line\"\n paint={{\n 'line-color': [\n 'case',\n ['==', ['feature-state', 'active'], true],\n defaultBoundariesBorderColor,\n ['==', ['feature-state', 'hover'], true],\n defaultBoundariesBorderColor,\n defaultBoundariesBorderColor,\n ],\n 'line-width': [\n 'case',\n ['==', ['feature-state', 'active'], true],\n ACTIVE_BORDER_WIDTH_OUTER,\n ['==', ['feature-state', 'hover'], true],\n ACTIVE_BORDER_WIDTH_OUTER,\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n <Layer\n source={sourceId}\n type=\"line\"\n paint={{\n 'line-color': [\n 'case',\n ['==', ['feature-state', 'active'], true],\n activeColor,\n ['==', ['feature-state', 'hover'], true],\n activeColor,\n transparentBorderColor,\n ],\n 'line-width': ACTIVE_BORDER_WIDTH_INNER,\n }}\n />\n </>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAuBI,mBACE,KADF;AAvBJ,SAAS,aAAa;AAEtB,SAAS,mBAAmB,sBAAsB;AAElD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,yBAAyB,CAAC,UAAgC;AACrE,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,cAAc,eAAe,YAAY;AAC/C,QAAM,+BAA+B;AAAA,IACnC;AAAA,EACF;AACA,QAAM,yBAAyB,eAAe,wBAAwB;AAEtE,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAK;AAAA,QACL,OAAO;AAAA,UACL,cAAc;AAAA,YACZ;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,QAAQ,GAAG,IAAI;AAAA,YACxC;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,OAAO,GAAG,IAAI;AAAA,YACvC;AAAA,YACA;AAAA,UACF;AAAA,UACA,cAAc;AAAA,YACZ;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,QAAQ,GAAG,IAAI;AAAA,YACxC;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,OAAO,GAAG,IAAI;AAAA,YACvC;AAAA,YACA,CAAC,MAAM,CAAC,OAAO,aAAa,GAAG,QAAQ;AAAA,YACvC;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAK;AAAA,QACL,OAAO;AAAA,UACL,cAAc;AAAA,YACZ;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,QAAQ,GAAG,IAAI;AAAA,YACxC;AAAA,YACA,CAAC,MAAM,CAAC,iBAAiB,OAAO,GAAG,IAAI;AAAA,YACvC;AAAA,YACA;AAAA,UACF;AAAA,UACA,cAAc;AAAA,QAChB;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -11,6 +11,7 @@ import { useResolveConnectionColor } from "../../hooks/use-resolve-color.js";
|
|
|
11
11
|
import { useTooltipTemplate } from "../../hooks/use-tooltip-template.js";
|
|
12
12
|
import { ConnectionLayerTooltip as ConnectionLayerTooltipSlot } from "../../slots/ConnectionLayerTooltip.js";
|
|
13
13
|
import { isConnectionTooltipTemplate } from "../../utils/tooltip-type-guards.js";
|
|
14
|
+
import { TooltipWrapper } from "../TooltipWrapper.js";
|
|
14
15
|
const ConnectionLayer = (props) => {
|
|
15
16
|
const {
|
|
16
17
|
data,
|
|
@@ -47,7 +48,13 @@ const ConnectionLayer = (props) => {
|
|
|
47
48
|
geoJsonData,
|
|
48
49
|
layerId,
|
|
49
50
|
sourceId,
|
|
50
|
-
line
|
|
51
|
+
line,
|
|
52
|
+
children: /* @__PURE__ */ jsx(TooltipWrapper, { layerId, children: /* @__PURE__ */ jsx(
|
|
53
|
+
ConnectionLayerTooltip,
|
|
54
|
+
{
|
|
55
|
+
tooltipTemplate: isConnectionTooltipTemplate(tooltipTemplate) ? tooltipTemplate : void 0
|
|
56
|
+
}
|
|
57
|
+
) })
|
|
51
58
|
}
|
|
52
59
|
),
|
|
53
60
|
directionIndicator && /* @__PURE__ */ jsx(
|
|
@@ -57,13 +64,6 @@ const ConnectionLayer = (props) => {
|
|
|
57
64
|
layerId,
|
|
58
65
|
directionIndicator
|
|
59
66
|
}
|
|
60
|
-
),
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
ConnectionLayerTooltip,
|
|
63
|
-
{
|
|
64
|
-
layerId,
|
|
65
|
-
tooltipTemplate: isConnectionTooltipTemplate(tooltipTemplate) ? tooltipTemplate : void 0
|
|
66
|
-
}
|
|
67
67
|
)
|
|
68
68
|
] });
|
|
69
69
|
};
|