@dynatrace/strato-geo 3.5.0 → 3.6.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/components/BubbleLayer/BubbleLayer.js +10 -2
- package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js +9 -3
- package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +10 -5
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +9 -3
- package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js +10 -5
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +9 -3
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayer.js +8 -2
- package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayerTooltip.js +9 -3
- package/esm/map/components/DotLayer/DotLayerTooltip.js.map +2 -2
- package/esm/map/contexts/map-view-provider.context.js +9 -0
- package/esm/map/contexts/map-view-provider.context.js.map +7 -0
- package/esm/map/hooks/use-load-map-base-layer.js +13 -3
- package/esm/map/hooks/use-load-map-base-layer.js.map +2 -2
- package/esm/map/hooks/use-map-view-provider-context.js +7 -0
- package/esm/map/hooks/use-map-view-provider-context.js.map +7 -0
- package/esm/map/hooks/use-tooltip-template.js +17 -2
- package/esm/map/hooks/use-tooltip-template.js.map +2 -2
- package/esm/map/index.js +2 -0
- package/esm/map/index.js.map +2 -2
- package/esm/map/providers/map-view.provider.js +18 -0
- package/esm/map/providers/map-view.provider.js.map +7 -0
- package/esm/map/types/map-view-provider.js +1 -0
- package/esm/map/types/map-view-provider.js.map +7 -0
- package/esm/map/utils/fetch-base-layer-features.js +1 -1
- package/esm/map/utils/fetch-base-layer-features.js.map +2 -2
- package/map/components/BubbleLayer/BubbleLayer.js +10 -2
- package/map/components/BubbleLayer/BubbleLayerTooltip.d.ts +2 -0
- package/map/components/BubbleLayer/BubbleLayerTooltip.js +9 -3
- package/map/components/ChoroplethLayer/ChoroplethLayer.js +10 -5
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.d.ts +2 -0
- package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +9 -3
- package/map/components/ConnectionLayer/ConnectionLayer.js +10 -5
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.d.ts +2 -0
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +9 -3
- package/map/components/DotLayer/DotLayer.js +8 -2
- package/map/components/DotLayer/DotLayerTooltip.d.ts +2 -0
- package/map/components/DotLayer/DotLayerTooltip.js +9 -3
- package/map/contexts/map-view-provider.context.d.ts +2 -0
- package/map/contexts/map-view-provider.context.js +28 -0
- package/map/hooks/use-load-map-base-layer.js +13 -3
- package/map/hooks/use-map-view-provider-context.d.ts +1 -0
- package/map/hooks/use-map-view-provider-context.js +26 -0
- package/map/hooks/use-tooltip-template.d.ts +8 -0
- package/map/hooks/use-tooltip-template.js +17 -2
- package/map/index.d.ts +2 -0
- package/map/index.js +2 -0
- package/map/providers/map-view.provider.d.ts +7 -0
- package/map/providers/map-view.provider.js +37 -0
- package/map/types/map-view-provider.d.ts +10 -0
- package/map/types/map-view-provider.js +16 -0
- package/map/types/tooltip.d.ts +16 -0
- package/map/utils/fetch-base-layer-features.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/hooks/use-tooltip-template.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isNil } from 'lodash-es';\nimport {\n Children,\n type ReactNode,\n type JSXElementConstructor,\n isValidElement,\n} from 'react';\n\nimport type { SeriesActionsTemplate } from '@dynatrace/strato-components/charts';\n\nimport { DefaultTooltip } from '../components/DefaultTooltip/DefaultTooltip.js';\nimport type { Location } from '../types/location.js';\nimport type {\n ChoroplethLayerTooltipData,\n LayerTooltipData,\n LayerTooltipHandler,\n} from '../types/tooltip.js';\n\nexport const defaultTooltipHandler: LayerTooltipHandler = (\n closestPoint: LayerTooltipData,\n layerData?: LayerTooltipData[],\n) => <DefaultTooltip closestPoint={closestPoint} layerData={layerData} />;\n\n(defaultTooltipHandler as { __isDefault?: boolean }).__isDefault = true;\n\nconst createDefaultHandlerWithActions = (\n seriesActions: (\n data: Location | ChoroplethLayerTooltipData,\n ) => SeriesActionsTemplate,\n): LayerTooltipHandler => {\n const handler: LayerTooltipHandler = (\n closestPoint: LayerTooltipData,\n layerData?: LayerTooltipData[],\n ) => (\n <DefaultTooltip\n closestPoint={closestPoint}\n layerData={layerData}\n seriesActions={seriesActions}\n />\n );\n (handler as { __isDefault?: boolean }).__isDefault = true;\n return handler;\n};\n\nexport const isDefaultTooltipHandler = (\n handler: LayerTooltipHandler,\n): boolean => (handler as { __isDefault?: boolean }).__isDefault ?? false;\n\n/**\n * It returns the tooltip template handler or undefined (tooltip disabled).\n *\n * - No tooltip slot found (undefined) \u2192 default tooltip handler.\n * - Tooltip slot with `null` children \u2192 `null` (tooltip disabled).\n * - Tooltip slot with `undefined` children \u2192 default tooltip handler.\n * - Tooltip slot with a custom handler \u2192 that handler.\n * @param children -\n * @param layerType -\n */\nexport function useTooltipTemplate<T>(\n children: ReactNode | undefined,\n layerType: string | JSXElementConstructor<T>,\n): LayerTooltipHandler | undefined {\n let template: LayerTooltipHandler | undefined = undefined;\n\n Children.forEach(children, (child) => {\n if (\n isValidElement<{\n children: LayerTooltipHandler;\n seriesActions?: (\n data: Location | ChoroplethLayerTooltipData,\n ) => SeriesActionsTemplate;\n }>(child) &&\n child.type === layerType\n ) {\n if (isNil(child.props.children)) {\n template = child.props.seriesActions\n ? createDefaultHandlerWithActions(child.props.seriesActions)\n : defaultTooltipHandler;\n } else {\n template = child.props.children;\n }\n }\n });\n\n return template;\n}\n"],
|
|
5
|
-
"mappings": "AAqBK;AArBL,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AAIP,SAAS,sBAAsB;AAQxB,MAAM,wBAA6C,CACxD,cACA,cACG,oBAAC,kBAAe,cAA4B,WAAsB;AAEtE,sBAAoD,cAAc;AAEnE,MAAM,kCAAkC,CACtC,kBAGwB;AACxB,QAAM,UAA+B,CACnC,cACA,cAEA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEF,EAAC,QAAsC,cAAc;AACrD,SAAO;AACT;AAEO,MAAM,0BAA0B,CACrC,YACa,QAAsC,eAAe;
|
|
4
|
+
"sourcesContent": ["import { isNil } from 'lodash-es';\nimport {\n Children,\n type ReactNode,\n type JSXElementConstructor,\n isValidElement,\n} from 'react';\n\nimport type { SeriesActionsTemplate } from '@dynatrace/strato-components/charts';\n\nimport { DefaultTooltip } from '../components/DefaultTooltip/DefaultTooltip.js';\nimport type { Location } from '../types/location.js';\nimport type {\n ChoroplethLayerTooltipData,\n LayerTooltipData,\n LayerTooltipHandler,\n} from '../types/tooltip.js';\n\nexport const defaultTooltipHandler: LayerTooltipHandler = (\n closestPoint: LayerTooltipData,\n layerData?: LayerTooltipData[],\n) => <DefaultTooltip closestPoint={closestPoint} layerData={layerData} />;\n\n(defaultTooltipHandler as { __isDefault?: boolean }).__isDefault = true;\n\nconst createDefaultHandlerWithActions = (\n seriesActions: (\n data: Location | ChoroplethLayerTooltipData,\n ) => SeriesActionsTemplate,\n): LayerTooltipHandler => {\n const handler: LayerTooltipHandler = (\n closestPoint: LayerTooltipData,\n layerData?: LayerTooltipData[],\n ) => (\n <DefaultTooltip\n closestPoint={closestPoint}\n layerData={layerData}\n seriesActions={seriesActions}\n />\n );\n (handler as { __isDefault?: boolean }).__isDefault = true;\n return handler;\n};\n\nexport const isDefaultTooltipHandler = (\n handler: LayerTooltipHandler,\n): boolean => (handler as { __isDefault?: boolean }).__isDefault ?? false;\n\n/**\n * It returns the tooltip template handler or undefined (tooltip disabled).\n *\n * - No tooltip slot found (undefined) \u2192 default tooltip handler.\n * - Tooltip slot with `null` children \u2192 `null` (tooltip disabled).\n * - Tooltip slot with `undefined` children \u2192 default tooltip handler.\n * - Tooltip slot with a custom handler \u2192 that handler.\n * @param children -\n * @param layerType -\n */\nexport interface TooltipTemplateResult {\n handler: LayerTooltipHandler | undefined;\n hidden?: boolean;\n symbolAlignment?: 'left' | 'right';\n}\n\nexport function useTooltipTemplate<T>(\n children: ReactNode | undefined,\n layerType: string | JSXElementConstructor<T>,\n): LayerTooltipHandler | undefined;\nexport function useTooltipTemplate<T>(\n children: ReactNode | undefined,\n layerType: string | JSXElementConstructor<T>,\n options: { extractProps: true },\n): TooltipTemplateResult;\nexport function useTooltipTemplate<T>(\n children: ReactNode | undefined,\n layerType: string | JSXElementConstructor<T>,\n options?: { extractProps: true },\n): LayerTooltipHandler | undefined | TooltipTemplateResult {\n let template: LayerTooltipHandler | undefined = undefined;\n let hidden: boolean | undefined = undefined;\n let symbolAlignment: 'left' | 'right' | undefined = undefined;\n\n Children.forEach(children, (child) => {\n if (\n isValidElement<{\n children: LayerTooltipHandler;\n seriesActions?: (\n data: Location | ChoroplethLayerTooltipData,\n ) => SeriesActionsTemplate;\n hidden?: boolean;\n symbolAlignment?: 'left' | 'right';\n }>(child) &&\n child.type === layerType\n ) {\n hidden = child.props.hidden;\n symbolAlignment = child.props.symbolAlignment;\n\n if (child.props.hidden) {\n template = undefined;\n return;\n }\n if (isNil(child.props.children)) {\n template = child.props.seriesActions\n ? createDefaultHandlerWithActions(child.props.seriesActions)\n : defaultTooltipHandler;\n } else {\n template = child.props.children;\n }\n }\n });\n\n if (options?.extractProps) {\n return {\n handler: hidden ? undefined : template ?? defaultTooltipHandler,\n hidden,\n symbolAlignment,\n };\n }\n\n return hidden ? undefined : template ?? defaultTooltipHandler;\n}\n"],
|
|
5
|
+
"mappings": "AAqBK;AArBL,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AAIP,SAAS,sBAAsB;AAQxB,MAAM,wBAA6C,CACxD,cACA,cACG,oBAAC,kBAAe,cAA4B,WAAsB;AAEtE,sBAAoD,cAAc;AAEnE,MAAM,kCAAkC,CACtC,kBAGwB;AACxB,QAAM,UAA+B,CACnC,cACA,cAEA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEF,EAAC,QAAsC,cAAc;AACrD,SAAO;AACT;AAEO,MAAM,0BAA0B,CACrC,YACa,QAAsC,eAAe;AA2B7D,SAAS,mBACd,UACA,WACA,SACyD;AACzD,MAAI,WAA4C;AAChD,MAAI,SAA8B;AAClC,MAAI,kBAAgD;AAEpD,WAAS,QAAQ,UAAU,CAAC,UAAU;AACpC,QACE,eAOG,KAAK,KACR,MAAM,SAAS,WACf;AACA,eAAS,MAAM,MAAM;AACrB,wBAAkB,MAAM,MAAM;AAE9B,UAAI,MAAM,MAAM,QAAQ;AACtB,mBAAW;AACX;AAAA,MACF;AACA,UAAI,MAAM,MAAM,MAAM,QAAQ,GAAG;AAC/B,mBAAW,MAAM,MAAM,gBACnB,gCAAgC,MAAM,MAAM,aAAa,IACzD;AAAA,MACN,OAAO;AACL,mBAAW,MAAM,MAAM;AAAA,MACzB;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,SAAS,cAAc;AACzB,WAAO;AAAA,MACL,SAAS,SAAS,SAAY,YAAY;AAAA,MAC1C;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,SAAS,SAAY,YAAY;AAC1C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/esm/map/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { SequentialLegend } from "./slots/SequentialLegend.js";
|
|
|
11
11
|
import { ThresholdLegend } from "./slots/ThresholdLegend.js";
|
|
12
12
|
import { CategoricalLegend } from "./slots/CategoricalLegend.js";
|
|
13
13
|
import { getAllCountries } from "./utils/get-all-countries.js";
|
|
14
|
+
import { MapViewProvider } from "./providers/map-view.provider.js";
|
|
14
15
|
export {
|
|
15
16
|
BaseLayer,
|
|
16
17
|
BubbleLayer,
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
DotLayer,
|
|
22
23
|
DownloadCSV,
|
|
23
24
|
MapView,
|
|
25
|
+
MapViewProvider,
|
|
24
26
|
SequentialLegend,
|
|
25
27
|
ThresholdLegend,
|
|
26
28
|
Tooltip,
|
package/esm/map/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/map/index.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable-next-line @typescript-eslint/no-deprecated */\nexport { ChartInteractions } from './slots/ChartInteractions.js';\nexport { MapView } from './MapView.js';\nexport { ConnectionLayer } from './slots/ConnectionLayer.js';\nexport { DotLayer } from './slots/DotLayer.js';\nexport { BubbleLayer } from './slots/BubbleLayer.js';\nexport { BaseLayer } from './slots/BaseLayer.js';\nexport { ChoroplethLayer } from './slots/ChoroplethLayer.js';\nexport { Tooltip, TooltipAtoms } from './slots/Tooltip.js';\nexport { DownloadCSV } from './slots/DownloadCSV.js';\n\nexport type {\n MapViewProps,\n MapViewBaseProps,\n MapViewUncontrolledProps,\n MapViewControlledProps,\n DisallowAll,\n ViewState,\n MapViewRef,\n} from './types/map-view.js';\n\nexport type { BaseLayerProps } from './types/base-layer.js';\n\nexport type { MapViewZoomSlotProps } from './slots/Zoom.js';\n\nexport type {\n Connection,\n ConnectionColorProps,\n ConnectionLayerBaseProps,\n ConnectionLayerProps,\n CurvedLine,\n} from './types/connection-layer.js';\n\nexport type { DotLayerBaseProps, DotLayerProps } from './types/dot-layer.js';\n\nexport type {\n BubbleLayerBaseProps,\n BubbleLayerProps,\n ScaleNoneProps,\n ScaleRadiusProps,\n} from './types/bubble-layer.js';\n\nexport type {\n ChoroplethLayerBaseProps,\n ChoroplethLayerProps,\n} from './types/choropleth-layer.js';\n\nexport type { Location } from './types/location.js';\nexport type { MapShape } from './types/shapes.js';\nexport type {\n ChartInteractionsProps,\n MapToolbarSlotProps,\n} from './types/toolbar.js';\nexport type { ErrorStateSlotProps } from './slots/states/ErrorStateSlot.js';\n\nexport type {\n BaseLegendProps,\n CategoricalLegendProps,\n SequentialLegendProps,\n ThresholdLegendProps,\n} from './types/legend.js';\n\nexport type {\n LocationColorProps,\n LegendColorLayerProps,\n ChoroplethCustomColorProps,\n} from './types/coloring.js';\n\nexport { SequentialLegend } from './slots/SequentialLegend.js';\nexport { ThresholdLegend } from './slots/ThresholdLegend.js';\nexport { CategoricalLegend } from './slots/CategoricalLegend.js';\n\nexport type {\n BubbleLayerTooltipHandler,\n BubbleLayerTooltipHandlerProps,\n DotLayerTooltipHandler,\n DotLayerTooltipHandlerProps,\n ConnectionLayerTooltipHandler,\n ConnectionLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandler,\n ChartTooltip,\n DotLayerTooltipData,\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n ChoroplethLayerTooltipData,\n} from './types/tooltip.js';\n\nexport { getAllCountries } from './utils/get-all-countries.js';\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AA2D5B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAkBlC,SAAS,uBAAuB;",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable-next-line @typescript-eslint/no-deprecated */\nexport { ChartInteractions } from './slots/ChartInteractions.js';\nexport { MapView } from './MapView.js';\nexport { ConnectionLayer } from './slots/ConnectionLayer.js';\nexport { DotLayer } from './slots/DotLayer.js';\nexport { BubbleLayer } from './slots/BubbleLayer.js';\nexport { BaseLayer } from './slots/BaseLayer.js';\nexport { ChoroplethLayer } from './slots/ChoroplethLayer.js';\nexport { Tooltip, TooltipAtoms } from './slots/Tooltip.js';\nexport { DownloadCSV } from './slots/DownloadCSV.js';\n\nexport type {\n MapViewProps,\n MapViewBaseProps,\n MapViewUncontrolledProps,\n MapViewControlledProps,\n DisallowAll,\n ViewState,\n MapViewRef,\n} from './types/map-view.js';\n\nexport type { BaseLayerProps } from './types/base-layer.js';\n\nexport type { MapViewZoomSlotProps } from './slots/Zoom.js';\n\nexport type {\n Connection,\n ConnectionColorProps,\n ConnectionLayerBaseProps,\n ConnectionLayerProps,\n CurvedLine,\n} from './types/connection-layer.js';\n\nexport type { DotLayerBaseProps, DotLayerProps } from './types/dot-layer.js';\n\nexport type {\n BubbleLayerBaseProps,\n BubbleLayerProps,\n ScaleNoneProps,\n ScaleRadiusProps,\n} from './types/bubble-layer.js';\n\nexport type {\n ChoroplethLayerBaseProps,\n ChoroplethLayerProps,\n} from './types/choropleth-layer.js';\n\nexport type { Location } from './types/location.js';\nexport type { MapShape } from './types/shapes.js';\nexport type {\n ChartInteractionsProps,\n MapToolbarSlotProps,\n} from './types/toolbar.js';\nexport type { ErrorStateSlotProps } from './slots/states/ErrorStateSlot.js';\n\nexport type {\n BaseLegendProps,\n CategoricalLegendProps,\n SequentialLegendProps,\n ThresholdLegendProps,\n} from './types/legend.js';\n\nexport type {\n LocationColorProps,\n LegendColorLayerProps,\n ChoroplethCustomColorProps,\n} from './types/coloring.js';\n\nexport { SequentialLegend } from './slots/SequentialLegend.js';\nexport { ThresholdLegend } from './slots/ThresholdLegend.js';\nexport { CategoricalLegend } from './slots/CategoricalLegend.js';\n\nexport type {\n BubbleLayerTooltipHandler,\n BubbleLayerTooltipHandlerProps,\n DotLayerTooltipHandler,\n DotLayerTooltipHandlerProps,\n ConnectionLayerTooltipHandler,\n ConnectionLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandler,\n ChartTooltip,\n DotLayerTooltipData,\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n ChoroplethLayerTooltipData,\n} from './types/tooltip.js';\n\nexport { getAllCountries } from './utils/get-all-countries.js';\n\nexport { MapViewProvider } from './providers/map-view.provider.js';\nexport type { MapViewProviderProps } from './types/map-view-provider.js';\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AA2D5B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAkBlC,SAAS,uBAAuB;AAEhC,SAAS,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { MapViewProviderContext } from "../contexts/map-view-provider.context.js";
|
|
4
|
+
const MapViewProvider = ({
|
|
5
|
+
children,
|
|
6
|
+
countryCode,
|
|
7
|
+
displayWorldMap
|
|
8
|
+
}) => {
|
|
9
|
+
const value = useMemo(
|
|
10
|
+
() => ({ countryCode, displayWorldMap }),
|
|
11
|
+
[countryCode, displayWorldMap]
|
|
12
|
+
);
|
|
13
|
+
return /* @__PURE__ */ jsx(MapViewProviderContext.Provider, { value, children });
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
MapViewProvider
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=map-view.provider.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/map/providers/map-view.provider.tsx"],
|
|
4
|
+
"sourcesContent": ["import { type PropsWithChildren, useMemo } from 'react';\n\nimport { MapViewProviderContext } from '../contexts/map-view-provider.context.js';\nimport type { MapViewProviderProps } from '../types/map-view-provider.js';\n\n/**\n * The `MapViewProvider` is a component that provides shared configuration to nested `MapView` instances.\n * @public\n */\nexport const MapViewProvider = ({\n children,\n countryCode,\n displayWorldMap,\n}: PropsWithChildren<MapViewProviderProps>) => {\n const value = useMemo(\n () => ({ countryCode, displayWorldMap }),\n [countryCode, displayWorldMap],\n );\n\n return (\n <MapViewProviderContext.Provider value={value}>\n {children}\n </MapViewProviderContext.Provider>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAoBI;AApBJ,SAAiC,eAAe;AAEhD,SAAS,8BAA8B;AAOhC,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,QAAQ;AAAA,IACZ,OAAO,EAAE,aAAa,gBAAgB;AAAA,IACtC,CAAC,aAAa,eAAe;AAAA,EAC/B;AAEA,SACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAC9B,UACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=map-view-provider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isUndefined } from "lodash-es";
|
|
2
2
|
import { CDN_BASE_PATH } from "../constants.js";
|
|
3
3
|
const cache = /* @__PURE__ */ new Map();
|
|
4
|
-
const MAPS_WITH_DISPUTED_BORDERS = ["IN", "IL", "CN"];
|
|
4
|
+
const MAPS_WITH_DISPUTED_BORDERS = ["IN", "IL", "CN", "MA"];
|
|
5
5
|
const getWorldViewParam = (countryCode) => MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : "";
|
|
6
6
|
const fetchWorldViewFeatures = async (tenantCountryCode) => {
|
|
7
7
|
const worldViewParam = getWorldViewParam(tenantCountryCode);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/fetch-base-layer-features.ts"],
|
|
4
|
-
"sourcesContent": ["import type { FeatureCollection } from 'geojson';\nimport { isUndefined } from 'lodash-es';\n\nimport { CDN_BASE_PATH } from '../constants.js';\n\nconst cache = new Map<string, FeatureCollection>();\n\nconst MAPS_WITH_DISPUTED_BORDERS = ['IN', 'IL', 'CN'];\n\nconst getWorldViewParam = (countryCode: string): string =>\n MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : '';\n\nexport const fetchWorldViewFeatures = async (\n tenantCountryCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = worldViewParam || 'default';\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}WORLD-COUNTRIES.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\nexport const fetchCountryFeatures = async (\n tenantCountryCode: string,\n regionCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = `${worldViewParam || 'default'}-${regionCode}`;\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}${regionCode}.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\n/**\n * @internal\n * Only used in unit tests to reset the map features cache\n */\nexport const _clearCache = () => {\n cache.clear();\n};\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAE9B,MAAM,QAAQ,oBAAI,IAA+B;AAEjD,MAAM,6BAA6B,CAAC,MAAM,MAAM,IAAI;
|
|
4
|
+
"sourcesContent": ["import type { FeatureCollection } from 'geojson';\nimport { isUndefined } from 'lodash-es';\n\nimport { CDN_BASE_PATH } from '../constants.js';\n\nconst cache = new Map<string, FeatureCollection>();\n\nconst MAPS_WITH_DISPUTED_BORDERS = ['IN', 'IL', 'CN', 'MA'];\n\nconst getWorldViewParam = (countryCode: string): string =>\n MAPS_WITH_DISPUTED_BORDERS.includes(countryCode) ? `${countryCode}/` : '';\n\nexport const fetchWorldViewFeatures = async (\n tenantCountryCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = worldViewParam || 'default';\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}WORLD-COUNTRIES.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\nexport const fetchCountryFeatures = async (\n tenantCountryCode: string,\n regionCode: string,\n): Promise<FeatureCollection> => {\n const worldViewParam = getWorldViewParam(tenantCountryCode);\n\n const cacheKey = `${worldViewParam || 'default'}-${regionCode}`;\n\n let features = cache.get(cacheKey);\n\n if (isUndefined(features)) {\n const res = await fetch(\n `${CDN_BASE_PATH}${worldViewParam}${regionCode}.json`,\n );\n\n features = (await res.json()) as FeatureCollection;\n\n cache.set(cacheKey, features);\n }\n\n return features;\n};\n\n/**\n * @internal\n * Only used in unit tests to reset the map features cache\n */\nexport const _clearCache = () => {\n cache.clear();\n};\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAE9B,MAAM,QAAQ,oBAAI,IAA+B;AAEjD,MAAM,6BAA6B,CAAC,MAAM,MAAM,MAAM,IAAI;AAE1D,MAAM,oBAAoB,CAAC,gBACzB,2BAA2B,SAAS,WAAW,IAAI,GAAG,WAAW,MAAM;AAElE,MAAM,yBAAyB,OACpC,sBAC+B;AAC/B,QAAM,iBAAiB,kBAAkB,iBAAiB;AAE1D,QAAM,WAAW,kBAAkB;AAEnC,MAAI,WAAW,MAAM,IAAI,QAAQ;AAEjC,MAAI,YAAY,QAAQ,GAAG;AACzB,UAAM,MAAM,MAAM;AAAA,MAChB,GAAG,aAAa,GAAG,cAAc;AAAA,IACnC;AAEA,eAAY,MAAM,IAAI,KAAK;AAE3B,UAAM,IAAI,UAAU,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAEO,MAAM,uBAAuB,OAClC,mBACA,eAC+B;AAC/B,QAAM,iBAAiB,kBAAkB,iBAAiB;AAE1D,QAAM,WAAW,GAAG,kBAAkB,SAAS,IAAI,UAAU;AAE7D,MAAI,WAAW,MAAM,IAAI,QAAQ;AAEjC,MAAI,YAAY,QAAQ,GAAG;AACzB,UAAM,MAAM,MAAM;AAAA,MAChB,GAAG,aAAa,GAAG,cAAc,GAAG,UAAU;AAAA,IAChD;AAEA,eAAY,MAAM,IAAI,KAAK;AAE3B,UAAM,IAAI,UAAU,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAMO,MAAM,cAAc,MAAM;AAC/B,QAAM,MAAM;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -69,7 +69,13 @@ const BubbleLayer = (props) => {
|
|
|
69
69
|
radius,
|
|
70
70
|
radiusScale
|
|
71
71
|
);
|
|
72
|
-
const
|
|
72
|
+
const {
|
|
73
|
+
handler: tooltipTemplate,
|
|
74
|
+
hidden: tooltipHidden,
|
|
75
|
+
symbolAlignment
|
|
76
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_BubbleLayerTooltip2.BubbleLayerTooltip, {
|
|
77
|
+
extractProps: true
|
|
78
|
+
});
|
|
73
79
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_size_interpolation_context.SizeInterpolationContext.Provider, { value: sizeInterpolation, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: dataGeoJson, generateId: true, children: [
|
|
74
80
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
81
|
import_BubbleCircleLayer.BubbleCircleLayer,
|
|
@@ -83,7 +89,9 @@ const BubbleLayer = (props) => {
|
|
|
83
89
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
90
|
import_BubbleLayerTooltip.BubbleLayerTooltip,
|
|
85
91
|
{
|
|
86
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isBubbleTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
92
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isBubbleTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
93
|
+
hidden: tooltipHidden,
|
|
94
|
+
symbolAlignment
|
|
87
95
|
}
|
|
88
96
|
) })
|
|
89
97
|
] }) });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { BubbleLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface BubbleLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: BubbleLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const BubbleLayerTooltip: {
|
|
6
8
|
(props: BubbleLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -27,9 +27,9 @@ var import_charts = require("@dynatrace/strato-components/charts");
|
|
|
27
27
|
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
28
28
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
29
29
|
const BubbleLayerTooltip = (props) => {
|
|
30
|
-
const { tooltipTemplate } = props;
|
|
30
|
+
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
31
31
|
const { data, inBounds, position } = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoBubble");
|
|
32
|
-
if (!tooltipTemplate || !inBounds || !position) {
|
|
32
|
+
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
if (!data || !data[0]) {
|
|
@@ -55,6 +55,12 @@ const BubbleLayerTooltip = (props) => {
|
|
|
55
55
|
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
56
56
|
return template;
|
|
57
57
|
}
|
|
58
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
import_charts._OverlayTooltip,
|
|
60
|
+
{
|
|
61
|
+
legacyTemplate: template,
|
|
62
|
+
symbolAlignment
|
|
63
|
+
}
|
|
64
|
+
);
|
|
59
65
|
};
|
|
60
66
|
BubbleLayerTooltip["displayName"] = "BubbleLayerTooltip";
|
|
@@ -51,10 +51,13 @@ const ChoroplethLayer = (props) => {
|
|
|
51
51
|
(0, import_use_legend_interaction_highlighting.useLegendInteractionHighlighting)(props, sourceId);
|
|
52
52
|
(0, import_use_legend_interaction_visibility.useLegendInteractionVisibility)(props, layerId);
|
|
53
53
|
const dataGeoJSON = mapSource && (0, import_parse_region_data_to_geo_json.parseRegionDataToGeoJSON)(mapSource, data, regionAccessor, choroplethColor);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const {
|
|
55
|
+
handler: tooltipTemplate,
|
|
56
|
+
hidden: tooltipHidden,
|
|
57
|
+
symbolAlignment
|
|
58
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_ChoroplethLayerTooltip2.ChoroplethLayerTooltip, {
|
|
59
|
+
extractProps: true
|
|
60
|
+
});
|
|
58
61
|
return dataGeoJSON && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true, children: [
|
|
59
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
63
|
import_react_maplibre.Layer,
|
|
@@ -86,7 +89,9 @@ const ChoroplethLayer = (props) => {
|
|
|
86
89
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
90
|
import_ChoroplethLayerTooltip.ChoroplethLayerTooltip,
|
|
88
91
|
{
|
|
89
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isChoroplethTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
92
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isChoroplethTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
93
|
+
hidden: tooltipHidden,
|
|
94
|
+
symbolAlignment
|
|
90
95
|
}
|
|
91
96
|
) })
|
|
92
97
|
] });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ChoroplethLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface ChoroplethLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: ChoroplethLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const ChoroplethLayerTooltip: {
|
|
6
8
|
(props: ChoroplethLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -26,9 +26,9 @@ var import_charts = require("@dynatrace/strato-components/charts");
|
|
|
26
26
|
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
27
27
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
28
28
|
const ChoroplethLayerTooltip = (props) => {
|
|
29
|
-
const { tooltipTemplate } = props;
|
|
29
|
+
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
30
30
|
const { data, inBounds, position } = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoChoropleth");
|
|
31
|
-
if (!tooltipTemplate || !inBounds || !position) {
|
|
31
|
+
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
if (!data || !data[0]) {
|
|
@@ -47,6 +47,12 @@ const ChoroplethLayerTooltip = (props) => {
|
|
|
47
47
|
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
48
48
|
return template;
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_charts._OverlayTooltip,
|
|
52
|
+
{
|
|
53
|
+
legacyTemplate: template,
|
|
54
|
+
symbolAlignment
|
|
55
|
+
}
|
|
56
|
+
);
|
|
51
57
|
};
|
|
52
58
|
ChoroplethLayerTooltip["displayName"] = "ChoroplethLayerTooltip";
|
|
@@ -62,10 +62,13 @@ const ConnectionLayer = (props) => {
|
|
|
62
62
|
connectionColor,
|
|
63
63
|
curve
|
|
64
64
|
);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const {
|
|
66
|
+
handler: tooltipTemplate,
|
|
67
|
+
hidden: tooltipHidden,
|
|
68
|
+
symbolAlignment
|
|
69
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_ConnectionLayerTooltip2.ConnectionLayerTooltip, {
|
|
70
|
+
extractProps: true
|
|
71
|
+
});
|
|
69
72
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
70
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
74
|
import_ConnectionLayerLine.ConnectionLayerLine,
|
|
@@ -78,7 +81,9 @@ const ConnectionLayer = (props) => {
|
|
|
78
81
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
82
|
import_ConnectionLayerTooltip.ConnectionLayerTooltip,
|
|
80
83
|
{
|
|
81
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isConnectionTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
84
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isConnectionTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
85
|
+
hidden: tooltipHidden,
|
|
86
|
+
symbolAlignment
|
|
82
87
|
}
|
|
83
88
|
) })
|
|
84
89
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ConnectionLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface ConnectionLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: ConnectionLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const ConnectionLayerTooltip: {
|
|
6
8
|
(props: ConnectionLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -27,14 +27,14 @@ var import_restore_null_props = require("./utils/restore-null-props.js");
|
|
|
27
27
|
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
28
28
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
29
29
|
const ConnectionLayerTooltip = (props) => {
|
|
30
|
-
const { tooltipTemplate } = props;
|
|
30
|
+
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
31
31
|
const {
|
|
32
32
|
data: rawData,
|
|
33
33
|
inBounds,
|
|
34
34
|
position
|
|
35
35
|
} = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoConnection");
|
|
36
36
|
const data = (0, import_restore_null_props.restoreNullProps)(rawData);
|
|
37
|
-
if (!tooltipTemplate || !inBounds || !position) {
|
|
37
|
+
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
if (!data || !data[0]) {
|
|
@@ -53,6 +53,12 @@ const ConnectionLayerTooltip = (props) => {
|
|
|
53
53
|
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
54
54
|
return template;
|
|
55
55
|
}
|
|
56
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
import_charts._OverlayTooltip,
|
|
58
|
+
{
|
|
59
|
+
legacyTemplate: template,
|
|
60
|
+
symbolAlignment
|
|
61
|
+
}
|
|
62
|
+
);
|
|
57
63
|
};
|
|
58
64
|
ConnectionLayerTooltip["displayName"] = "ConnectionLayerTooltip";
|
|
@@ -68,7 +68,11 @@ const DotLayer = (props) => {
|
|
|
68
68
|
props,
|
|
69
69
|
colorParser
|
|
70
70
|
);
|
|
71
|
-
const
|
|
71
|
+
const {
|
|
72
|
+
handler: tooltipTemplate,
|
|
73
|
+
hidden: tooltipHidden,
|
|
74
|
+
symbolAlignment
|
|
75
|
+
} = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_DotLayerTooltip2.DotLayerTooltip, { extractProps: true });
|
|
72
76
|
const sourceId = `source-${layerId}`;
|
|
73
77
|
(0, import_use_legend_interaction_highlighting.useLegendInteractionHighlighting)(props, sourceId);
|
|
74
78
|
(0, import_use_legend_interaction_visibility.useLegendInteractionVisibility)(props, layerId);
|
|
@@ -130,7 +134,9 @@ const DotLayer = (props) => {
|
|
|
130
134
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TooltipWrapper.TooltipWrapper, { layerId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
135
|
import_DotLayerTooltip.DotLayerTooltip,
|
|
132
136
|
{
|
|
133
|
-
tooltipTemplate: (0, import_tooltip_type_guards.isDotTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0
|
|
137
|
+
tooltipTemplate: (0, import_tooltip_type_guards.isDotTooltipTemplate)(tooltipTemplate) ? tooltipTemplate : void 0,
|
|
138
|
+
hidden: tooltipHidden,
|
|
139
|
+
symbolAlignment
|
|
134
140
|
}
|
|
135
141
|
) })
|
|
136
142
|
] });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { DotLayerTooltipHandler } from '../../types/tooltip.js';
|
|
2
2
|
export interface DotLayerTooltipProps {
|
|
3
3
|
tooltipTemplate?: DotLayerTooltipHandler;
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
symbolAlignment?: 'left' | 'right';
|
|
4
6
|
}
|
|
5
7
|
export declare const DotLayerTooltip: {
|
|
6
8
|
(props: DotLayerTooltipProps): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -26,9 +26,9 @@ var import_charts = require("@dynatrace/strato-components/charts");
|
|
|
26
26
|
var import_use_geo_layer_tooltip = require("../../hooks/use-geo-layer-tooltip.js");
|
|
27
27
|
var import_tooltip_type_guards = require("../../utils/tooltip-type-guards.js");
|
|
28
28
|
const DotLayerTooltip = (props) => {
|
|
29
|
-
const { tooltipTemplate } = props;
|
|
29
|
+
const { tooltipTemplate, hidden, symbolAlignment } = props;
|
|
30
30
|
const { data, inBounds, position } = (0, import_use_geo_layer_tooltip.useGeoLayerTooltip)("geoDot");
|
|
31
|
-
if (!tooltipTemplate || !inBounds || !position) {
|
|
31
|
+
if (hidden || !tooltipTemplate || !inBounds || !position) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
if (!data || !data[0]) {
|
|
@@ -47,6 +47,12 @@ const DotLayerTooltip = (props) => {
|
|
|
47
47
|
if ((0, import_tooltip_type_guards.isDefaultTooltipHandler)(tooltipTemplate)) {
|
|
48
48
|
return template;
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_charts._OverlayTooltip,
|
|
52
|
+
{
|
|
53
|
+
legacyTemplate: template,
|
|
54
|
+
symbolAlignment
|
|
55
|
+
}
|
|
56
|
+
);
|
|
51
57
|
};
|
|
52
58
|
DotLayerTooltip["displayName"] = "DotLayerTooltip";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var map_view_provider_context_exports = {};
|
|
20
|
+
__export(map_view_provider_context_exports, {
|
|
21
|
+
MapViewProviderContext: () => MapViewProviderContext
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(map_view_provider_context_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
const MapViewProviderContext = (0, import_react.createContext)({
|
|
26
|
+
countryCode: void 0,
|
|
27
|
+
displayWorldMap: void 0
|
|
28
|
+
});
|
|
@@ -22,6 +22,7 @@ __export(use_load_map_base_layer_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(use_load_map_base_layer_exports);
|
|
24
24
|
var import_react = require("react");
|
|
25
|
+
var import_use_map_view_provider_context = require("./use-map-view-provider-context.js");
|
|
25
26
|
var import_apply_feature_filter_rules = require("../utils/apply-feature-filter-rules.js");
|
|
26
27
|
var import_base_layer_rules = require("../utils/base-layer-rules.js");
|
|
27
28
|
var import_fetch_base_layer_features = require("../utils/fetch-base-layer-features.js");
|
|
@@ -34,13 +35,17 @@ const useLoadMapBaseLayer = (baseLayerConfig) => {
|
|
|
34
35
|
const [isMapEnabled, setIsMapEnabled] = (0, import_react.useState)(false);
|
|
35
36
|
const [baseFeatureCollection, setBaseFeatureCollection] = (0, import_react.useState)(void 0);
|
|
36
37
|
const [error, setError] = (0, import_react.useState)(false);
|
|
38
|
+
const {
|
|
39
|
+
countryCode: providerCountryCode,
|
|
40
|
+
displayWorldMap: providerDisplayWorldMap
|
|
41
|
+
} = (0, import_use_map_view_provider_context.useMapViewProviderContext)();
|
|
37
42
|
const getData = (0, import_react.useCallback)(async () => {
|
|
38
43
|
setIsFetchingFeatures(true);
|
|
39
|
-
const isMapEnabledResponse = await (0, import_fetch_client_config_map_enabled.fetchClientConfigMapEnabled)();
|
|
44
|
+
const isMapEnabledResponse = providerDisplayWorldMap ?? await (0, import_fetch_client_config_map_enabled.fetchClientConfigMapEnabled)();
|
|
40
45
|
setIsMapEnabled(isMapEnabledResponse);
|
|
41
46
|
try {
|
|
42
47
|
if (isMapEnabledResponse) {
|
|
43
|
-
const tenantCountryCode = await (0, import_get_tenant_country_code.getTenantCountryCode)();
|
|
48
|
+
const tenantCountryCode = providerCountryCode ?? await (0, import_get_tenant_country_code.getTenantCountryCode)();
|
|
44
49
|
const { includeWorldView, countryRegions } = (0, import_get_base_layer_shapes_request_config.getBaseLayerShapesRequestConfig)(baseLayerConfig.include);
|
|
45
50
|
const featuresRequests = [];
|
|
46
51
|
if (includeWorldView) {
|
|
@@ -71,7 +76,12 @@ const useLoadMapBaseLayer = (baseLayerConfig) => {
|
|
|
71
76
|
setError(true);
|
|
72
77
|
}
|
|
73
78
|
setIsFetchingFeatures(false);
|
|
74
|
-
}, [
|
|
79
|
+
}, [
|
|
80
|
+
baseLayerConfig.include,
|
|
81
|
+
baseLayerConfig.exclude,
|
|
82
|
+
providerCountryCode,
|
|
83
|
+
providerDisplayWorldMap
|
|
84
|
+
]);
|
|
75
85
|
(0, import_react.useEffect)(() => {
|
|
76
86
|
getData();
|
|
77
87
|
}, [getData]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useMapViewProviderContext: () => import("../index.js").MapViewProviderProps;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var use_map_view_provider_context_exports = {};
|
|
20
|
+
__export(use_map_view_provider_context_exports, {
|
|
21
|
+
useMapViewProviderContext: () => useMapViewProviderContext
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_map_view_provider_context_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_map_view_provider_context = require("../contexts/map-view-provider.context.js");
|
|
26
|
+
const useMapViewProviderContext = () => (0, import_react.useContext)(import_map_view_provider_context.MapViewProviderContext);
|
|
@@ -12,4 +12,12 @@ export declare const isDefaultTooltipHandler: (handler: LayerTooltipHandler) =>
|
|
|
12
12
|
* @param children -
|
|
13
13
|
* @param layerType -
|
|
14
14
|
*/
|
|
15
|
+
export interface TooltipTemplateResult {
|
|
16
|
+
handler: LayerTooltipHandler | undefined;
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
symbolAlignment?: 'left' | 'right';
|
|
19
|
+
}
|
|
15
20
|
export declare function useTooltipTemplate<T>(children: ReactNode | undefined, layerType: string | JSXElementConstructor<T>): LayerTooltipHandler | undefined;
|
|
21
|
+
export declare function useTooltipTemplate<T>(children: ReactNode | undefined, layerType: string | JSXElementConstructor<T>, options: {
|
|
22
|
+
extractProps: true;
|
|
23
|
+
}): TooltipTemplateResult;
|
|
@@ -42,10 +42,18 @@ const createDefaultHandlerWithActions = (seriesActions) => {
|
|
|
42
42
|
return handler;
|
|
43
43
|
};
|
|
44
44
|
const isDefaultTooltipHandler = (handler) => handler.__isDefault ?? false;
|
|
45
|
-
function useTooltipTemplate(children, layerType) {
|
|
45
|
+
function useTooltipTemplate(children, layerType, options) {
|
|
46
46
|
let template = void 0;
|
|
47
|
+
let hidden = void 0;
|
|
48
|
+
let symbolAlignment = void 0;
|
|
47
49
|
import_react.Children.forEach(children, (child) => {
|
|
48
50
|
if ((0, import_react.isValidElement)(child) && child.type === layerType) {
|
|
51
|
+
hidden = child.props.hidden;
|
|
52
|
+
symbolAlignment = child.props.symbolAlignment;
|
|
53
|
+
if (child.props.hidden) {
|
|
54
|
+
template = void 0;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
49
57
|
if ((0, import_lodash_es.isNil)(child.props.children)) {
|
|
50
58
|
template = child.props.seriesActions ? createDefaultHandlerWithActions(child.props.seriesActions) : defaultTooltipHandler;
|
|
51
59
|
} else {
|
|
@@ -53,5 +61,12 @@ function useTooltipTemplate(children, layerType) {
|
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
63
|
});
|
|
56
|
-
|
|
64
|
+
if (options?.extractProps) {
|
|
65
|
+
return {
|
|
66
|
+
handler: hidden ? void 0 : template ?? defaultTooltipHandler,
|
|
67
|
+
hidden,
|
|
68
|
+
symbolAlignment
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return hidden ? void 0 : template ?? defaultTooltipHandler;
|
|
57
72
|
}
|
package/map/index.d.ts
CHANGED
|
@@ -25,3 +25,5 @@ export { ThresholdLegend } from './slots/ThresholdLegend.js';
|
|
|
25
25
|
export { CategoricalLegend } from './slots/CategoricalLegend.js';
|
|
26
26
|
export type { BubbleLayerTooltipHandler, BubbleLayerTooltipHandlerProps, DotLayerTooltipHandler, DotLayerTooltipHandlerProps, ConnectionLayerTooltipHandler, ConnectionLayerTooltipHandlerProps, ChoroplethLayerTooltipHandlerProps, ChoroplethLayerTooltipHandler, ChartTooltip, DotLayerTooltipData, BubbleLayerTooltipData, ConnectionLayerTooltipData, ChoroplethLayerTooltipData, } from './types/tooltip.js';
|
|
27
27
|
export { getAllCountries } from './utils/get-all-countries.js';
|
|
28
|
+
export { MapViewProvider } from './providers/map-view.provider.js';
|
|
29
|
+
export type { MapViewProviderProps } from './types/map-view-provider.js';
|
package/map/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(map_exports, {
|
|
|
27
27
|
DotLayer: () => import_DotLayer.DotLayer,
|
|
28
28
|
DownloadCSV: () => import_DownloadCSV.DownloadCSV,
|
|
29
29
|
MapView: () => import_MapView.MapView,
|
|
30
|
+
MapViewProvider: () => import_map_view_provider.MapViewProvider,
|
|
30
31
|
SequentialLegend: () => import_SequentialLegend.SequentialLegend,
|
|
31
32
|
ThresholdLegend: () => import_ThresholdLegend.ThresholdLegend,
|
|
32
33
|
Tooltip: () => import_Tooltip.Tooltip,
|
|
@@ -47,3 +48,4 @@ var import_SequentialLegend = require("./slots/SequentialLegend.js");
|
|
|
47
48
|
var import_ThresholdLegend = require("./slots/ThresholdLegend.js");
|
|
48
49
|
var import_CategoricalLegend = require("./slots/CategoricalLegend.js");
|
|
49
50
|
var import_get_all_countries = require("./utils/get-all-countries.js");
|
|
51
|
+
var import_map_view_provider = require("./providers/map-view.provider.js");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import type { MapViewProviderProps } from '../types/map-view-provider.js';
|
|
3
|
+
/**
|
|
4
|
+
* The `MapViewProvider` is a component that provides shared configuration to nested `MapView` instances.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const MapViewProvider: ({ children, countryCode, displayWorldMap, }: PropsWithChildren<MapViewProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var map_view_provider_exports = {};
|
|
20
|
+
__export(map_view_provider_exports, {
|
|
21
|
+
MapViewProvider: () => MapViewProvider
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(map_view_provider_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_map_view_provider_context = require("../contexts/map-view-provider.context.js");
|
|
27
|
+
const MapViewProvider = ({
|
|
28
|
+
children,
|
|
29
|
+
countryCode,
|
|
30
|
+
displayWorldMap
|
|
31
|
+
}) => {
|
|
32
|
+
const value = (0, import_react.useMemo)(
|
|
33
|
+
() => ({ countryCode, displayWorldMap }),
|
|
34
|
+
[countryCode, displayWorldMap]
|
|
35
|
+
);
|
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_map_view_provider_context.MapViewProviderContext.Provider, { value, children });
|
|
37
|
+
};
|