@dynatrace/strato-geo 2.2.2 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/map/MapView.js +6 -1
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/DefaultTooltip/DefaultTooltip.js +3 -1
- package/esm/map/components/DefaultTooltip/DefaultTooltip.js.map +2 -2
- package/map/MapView.js +6 -1
- package/map/components/DefaultTooltip/DefaultTooltip.js +3 -1
- package/map/types/map-view.d.ts +2 -10
- package/package.json +5 -6
package/esm/map/MapView.js
CHANGED
|
@@ -39,6 +39,9 @@ const _MapView = forwardRef(
|
|
|
39
39
|
loading = false,
|
|
40
40
|
style: costumerStyle,
|
|
41
41
|
className: customerClassNames,
|
|
42
|
+
"data-dtrum-mask": dataDtrumMask,
|
|
43
|
+
"data-dtrum-allow": dataDtrumAllow,
|
|
44
|
+
"data-testid": dataTestId,
|
|
42
45
|
formatter,
|
|
43
46
|
truncationMode,
|
|
44
47
|
...remaining
|
|
@@ -74,7 +77,9 @@ const _MapView = forwardRef(
|
|
|
74
77
|
{
|
|
75
78
|
style: containerStyles,
|
|
76
79
|
className: customerClassNames,
|
|
77
|
-
"data-
|
|
80
|
+
"data-dtrum-mask": dataDtrumMask,
|
|
81
|
+
"data-dtrum-allow": dataDtrumAllow,
|
|
82
|
+
"data-testid": dataTestId,
|
|
78
83
|
role: "img",
|
|
79
84
|
"aria-label": MAP_VIEW_ARIA_LABEL,
|
|
80
85
|
// TODO: Error boundaries global fix needed - this error state only purpose is to make map not rendering when there error in response
|
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 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-
|
|
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 { 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": "AA0GY,cAwBoB,YAxBpB;AA1GZ,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,SAAS,mCAAmC;AAC5C,SAAS,+BAA+B;AACxC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AAC3C,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AAEjC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,OAAO;AAKP,MAAM,WAAW;AAAA,EACf,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,WAAW;AAAA,MACX,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,eAAe;AAAA,MACf;AAAA,MAC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|
|
|
41
41
|
{
|
|
42
42
|
latitude: location.latitude,
|
|
43
43
|
longitude: location.longitude,
|
|
44
|
-
|
|
44
|
+
defaultActions: getDefaultActions(
|
|
45
|
+
() => handleCopyToClipboard(location)
|
|
46
|
+
)
|
|
45
47
|
},
|
|
46
48
|
`${location.latitude}-${location.longitude}`
|
|
47
49
|
))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/DefaultTooltip/DefaultTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isNil } from 'lodash-es';\n\nimport { _ChartTooltip as ChartTooltip } from '@dynatrace/strato-components-preview/charts';\n\nimport { getDefaultActions } from './utils/get-default-actions.js';\nimport { handleCopyToClipboard } from './utils/handle-copy-to-clipboard.js';\nimport { useTruncationMode } from '../../hooks/use-truncation-mode.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n DotLayerTooltipData,\n LayerTooltipData,\n} from '../../types/tooltip.js';\nimport { ChoroplethLayerTooltipData } from '../../types/tooltip.js';\nimport { isConnection, isRegion } from '../../utils/tooltip-type-guards.js';\n\nconst isChoroplethTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: ChoroplethLayerTooltipData;\n} => isRegion(props.closestPoint);\nconst isConnectionTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: ConnectionLayerTooltipData;\n} => isConnection(props.closestPoint);\nconst isBubbleTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: BubbleLayerTooltipData;\n layerData: BubbleLayerTooltipData[];\n} => !isNil(props.layerData);\n\nconst isDotTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: DotLayerTooltipData;\n} => true; // if it's not any of the other tooltips, it will be Dot\n\ninterface DefaultTooltipProps {\n closestPoint: LayerTooltipData;\n layerData?: LayerTooltipData[];\n}\n\nexport const DefaultTooltip = (props: DefaultTooltipProps) => {\n let locations: Location[] = [];\n const truncationMode = useTruncationMode();\n\n if (isChoroplethTooltip(props)) {\n const { closestPoint } = props;\n\n return (\n <ChartTooltip.Body data-testid=\"default-tooltip-template\">\n <ChartTooltip.SeriesItem\n color={closestPoint.color}\n name={closestPoint.name}\n truncationMode={truncationMode}\n value={\n closestPoint.data.value && closestPoint.data.value.toString()\n ? closestPoint.data.value.toString()\n : undefined\n }\n />\n </ChartTooltip.Body>\n );\n } else if (isConnectionTooltip(props)) {\n locations = props.closestPoint.data.path;\n } else if (isBubbleTooltip(props)) {\n const { closestPoint, layerData } = props;\n locations =\n layerData === undefined || layerData === null || layerData.length === 0\n ? [closestPoint.data]\n : layerData.map((point) => point.data);\n } else if (isDotTooltip(props)) {\n locations = [props.closestPoint.data];\n }\n\n return (\n <ChartTooltip.Body\n data-testid=\"default-tooltip-template\"\n virtualization={false}\n >\n {locations.map((location) => (\n <ChartTooltip.GeoItem\n key={`${location.latitude}-${location.longitude}`}\n latitude={location.latitude}\n longitude={location.longitude}\n
|
|
5
|
-
"mappings": "AAsDQ;AAtDR,SAAS,aAAa;AAEtB,SAAS,iBAAiB,oBAAoB;AAE9C,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AASlC,SAAS,cAAc,gBAAgB;AAEvC,MAAM,sBAAsB,CAC1B,UAGG,SAAS,MAAM,YAAY;AAChC,MAAM,sBAAsB,CAC1B,UAGG,aAAa,MAAM,YAAY;AACpC,MAAM,kBAAkB,CACtB,UAIG,CAAC,MAAM,MAAM,SAAS;AAE3B,MAAM,eAAe,CACnB,UAGG;AAOE,MAAM,iBAAiB,CAAC,UAA+B;AAC5D,MAAI,YAAwB,CAAC;AAC7B,QAAM,iBAAiB,kBAAkB;AAEzC,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,EAAE,aAAa,IAAI;AAEzB,WACE,oBAAC,aAAa,MAAb,EAAkB,eAAY,4BAC7B;AAAA,MAAC,aAAa;AAAA,MAAb;AAAA,QACC,OAAO,aAAa;AAAA,QACpB,MAAM,aAAa;AAAA,QACnB;AAAA,QACA,OACE,aAAa,KAAK,SAAS,aAAa,KAAK,MAAM,SAAS,IACxD,aAAa,KAAK,MAAM,SAAS,IACjC;AAAA;AAAA,IAER,GACF;AAAA,EAEJ,WAAW,oBAAoB,KAAK,GAAG;AACrC,gBAAY,MAAM,aAAa,KAAK;AAAA,EACtC,WAAW,gBAAgB,KAAK,GAAG;AACjC,UAAM,EAAE,cAAc,UAAU,IAAI;AACpC,gBACE,cAAc,UAAa,cAAc,QAAQ,UAAU,WAAW,IAClE,CAAC,aAAa,IAAI,IAClB,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI;AAAA,EAC3C,WAAW,aAAa,KAAK,GAAG;AAC9B,gBAAY,CAAC,MAAM,aAAa,IAAI;AAAA,EACtC;AAEA,SACE;AAAA,IAAC,aAAa;AAAA,IAAb;AAAA,MACC,eAAY;AAAA,MACZ,gBAAgB;AAAA,MAEf,oBAAU,IAAI,CAAC,aACd;AAAA,QAAC,aAAa;AAAA,QAAb;AAAA,UAEC,UAAU,SAAS;AAAA,UACnB,WAAW,SAAS;AAAA,UACpB,
|
|
4
|
+
"sourcesContent": ["import { isNil } from 'lodash-es';\n\nimport { _ChartTooltip as ChartTooltip } from '@dynatrace/strato-components-preview/charts';\n\nimport { getDefaultActions } from './utils/get-default-actions.js';\nimport { handleCopyToClipboard } from './utils/handle-copy-to-clipboard.js';\nimport { useTruncationMode } from '../../hooks/use-truncation-mode.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n DotLayerTooltipData,\n LayerTooltipData,\n} from '../../types/tooltip.js';\nimport { ChoroplethLayerTooltipData } from '../../types/tooltip.js';\nimport { isConnection, isRegion } from '../../utils/tooltip-type-guards.js';\n\nconst isChoroplethTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: ChoroplethLayerTooltipData;\n} => isRegion(props.closestPoint);\nconst isConnectionTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: ConnectionLayerTooltipData;\n} => isConnection(props.closestPoint);\nconst isBubbleTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: BubbleLayerTooltipData;\n layerData: BubbleLayerTooltipData[];\n} => !isNil(props.layerData);\n\nconst isDotTooltip = (\n props: DefaultTooltipProps,\n): props is {\n closestPoint: DotLayerTooltipData;\n} => true; // if it's not any of the other tooltips, it will be Dot\n\ninterface DefaultTooltipProps {\n closestPoint: LayerTooltipData;\n layerData?: LayerTooltipData[];\n}\n\nexport const DefaultTooltip = (props: DefaultTooltipProps) => {\n let locations: Location[] = [];\n const truncationMode = useTruncationMode();\n\n if (isChoroplethTooltip(props)) {\n const { closestPoint } = props;\n\n return (\n <ChartTooltip.Body data-testid=\"default-tooltip-template\">\n <ChartTooltip.SeriesItem\n color={closestPoint.color}\n name={closestPoint.name}\n truncationMode={truncationMode}\n value={\n closestPoint.data.value && closestPoint.data.value.toString()\n ? closestPoint.data.value.toString()\n : undefined\n }\n />\n </ChartTooltip.Body>\n );\n } else if (isConnectionTooltip(props)) {\n locations = props.closestPoint.data.path;\n } else if (isBubbleTooltip(props)) {\n const { closestPoint, layerData } = props;\n locations =\n layerData === undefined || layerData === null || layerData.length === 0\n ? [closestPoint.data]\n : layerData.map((point) => point.data);\n } else if (isDotTooltip(props)) {\n locations = [props.closestPoint.data];\n }\n\n return (\n <ChartTooltip.Body\n data-testid=\"default-tooltip-template\"\n virtualization={false}\n >\n {locations.map((location) => (\n <ChartTooltip.GeoItem\n key={`${location.latitude}-${location.longitude}`}\n latitude={location.latitude}\n longitude={location.longitude}\n defaultActions={getDefaultActions(() =>\n handleCopyToClipboard(location),\n )}\n />\n ))}\n </ChartTooltip.Body>\n );\n};\n\nDefaultTooltip['displayName'] = 'DefaultTooltip';\n"],
|
|
5
|
+
"mappings": "AAsDQ;AAtDR,SAAS,aAAa;AAEtB,SAAS,iBAAi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B,WAAW,SAAS;AAAA,UACpB,gBAAgB;AAAA,YAAkB,MAChC,sBAAsB,QAAQ;AAAA,UAChC;AAAA;AAAA,QALK,GAAG,SAAS,QAAQ,IAAI,SAAS,SAAS;AAAA,MAMjD,CACD;AAAA;AAAA,EACH;AAEJ;AAEA,eAAe,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/map/MapView.js
CHANGED
|
@@ -53,6 +53,9 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
53
53
|
loading = false,
|
|
54
54
|
style: costumerStyle,
|
|
55
55
|
className: customerClassNames,
|
|
56
|
+
"data-dtrum-mask": dataDtrumMask,
|
|
57
|
+
"data-dtrum-allow": dataDtrumAllow,
|
|
58
|
+
"data-testid": dataTestId,
|
|
56
59
|
formatter,
|
|
57
60
|
truncationMode,
|
|
58
61
|
...remaining
|
|
@@ -88,7 +91,9 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
88
91
|
{
|
|
89
92
|
style: containerStyles,
|
|
90
93
|
className: customerClassNames,
|
|
91
|
-
"data-
|
|
94
|
+
"data-dtrum-mask": dataDtrumMask,
|
|
95
|
+
"data-dtrum-allow": dataDtrumAllow,
|
|
96
|
+
"data-testid": dataTestId,
|
|
92
97
|
role: "img",
|
|
93
98
|
"aria-label": import_constants.MAP_VIEW_ARIA_LABEL,
|
|
94
99
|
// TODO: Error boundaries global fix needed - this error state only purpose is to make map not rendering when there error in response
|
|
@@ -64,7 +64,9 @@ const DefaultTooltip = (props) => {
|
|
|
64
64
|
{
|
|
65
65
|
latitude: location.latitude,
|
|
66
66
|
longitude: location.longitude,
|
|
67
|
-
|
|
67
|
+
defaultActions: (0, import_get_default_actions.getDefaultActions)(
|
|
68
|
+
() => (0, import_handle_copy_to_clipboard.handleCopyToClipboard)(location)
|
|
69
|
+
)
|
|
68
70
|
},
|
|
69
71
|
`${location.latitude}-${location.longitude}`
|
|
70
72
|
))
|
package/map/types/map-view.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
-
import {
|
|
2
|
+
import type { DataTestId, MaskingProps, StylingProps } from '@dynatrace/strato-components/core';
|
|
3
3
|
import type { TruncationMode } from '@dynatrace/strato-components/typography';
|
|
4
4
|
import { Formatter } from '@dynatrace/strato-components-preview/charts';
|
|
5
5
|
import { ConvertibleUnit, FormatOptions, Unit } from '@dynatrace-sdk/units';
|
|
@@ -50,11 +50,7 @@ export interface MapViewUncontrolledProps extends DisallowAll<ViewState> {
|
|
|
50
50
|
* Props present in both ways of controlling a Map
|
|
51
51
|
* @public
|
|
52
52
|
*/
|
|
53
|
-
export interface MapViewBaseProps {
|
|
54
|
-
/**
|
|
55
|
-
* CSS styles to override the inline styles of main container of the component
|
|
56
|
-
*/
|
|
57
|
-
style?: CSSProperties;
|
|
53
|
+
export interface MapViewBaseProps extends DataTestId, StylingProps, MaskingProps {
|
|
58
54
|
/**
|
|
59
55
|
* Styles of maplibre to be overridden
|
|
60
56
|
*/
|
|
@@ -74,10 +70,6 @@ export interface MapViewBaseProps {
|
|
|
74
70
|
* @defaultValue 400px
|
|
75
71
|
*/
|
|
76
72
|
height?: number | string;
|
|
77
|
-
/**
|
|
78
|
-
* CSS class to append to the class list of the main container of the component
|
|
79
|
-
*/
|
|
80
|
-
className?: string;
|
|
81
73
|
/**
|
|
82
74
|
* The truncation mode to be used as start, middle or end in the long legend
|
|
83
75
|
* labels
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-geo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"lang": "lang/uncompiled",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jest/globals": "^29.7.0",
|
|
25
24
|
"@turf/bearing": "^6.5.0",
|
|
26
25
|
"@turf/destination": "^6.5.0",
|
|
27
26
|
"@turf/distance": "^6.5.0",
|
|
@@ -47,10 +46,10 @@
|
|
|
47
46
|
"react-dom": "^18.0.0",
|
|
48
47
|
"react-intl": "^6.0.8 || ^7.0.0",
|
|
49
48
|
"react-is": "^18.0.0",
|
|
50
|
-
"@dynatrace/strato-
|
|
51
|
-
"@dynatrace/strato-icons": "^1.6.
|
|
52
|
-
"@dynatrace/strato-components": "^
|
|
53
|
-
"@dynatrace/strato-
|
|
49
|
+
"@dynatrace/strato-components": "^1.9.1",
|
|
50
|
+
"@dynatrace/strato-icons": "^1.6.1",
|
|
51
|
+
"@dynatrace/strato-components-preview": "^2.4.1",
|
|
52
|
+
"@dynatrace/strato-design-tokens": "^1.1.1"
|
|
54
53
|
},
|
|
55
54
|
"sideEffects": [
|
|
56
55
|
"./map/styles/react-mapgl-styles.css",
|