@dynatrace/strato-geo 0.9.17 → 0.9.25
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 +3 -0
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/hooks/useAutoLegendRefresh.js +12 -0
- package/esm/map/hooks/useAutoLegendRefresh.js.map +7 -0
- package/map/MapView.js +3 -0
- package/map/components/BubbleLayer/BubbleLayer.d.ts +1 -1
- package/map/components/ChoroplethLayer/ChoroplethLayer.d.ts +1 -1
- package/map/components/DotLayer/DotLayer.d.ts +1 -1
- package/map/hooks/use-resolve-color.d.ts +1 -1
- package/map/hooks/useAutoLegendRefresh.d.ts +6 -0
- package/map/hooks/useAutoLegendRefresh.js +30 -0
- package/package.json +4 -4
package/esm/map/MapView.js
CHANGED
|
@@ -23,6 +23,7 @@ import { getMapStatesTemplates } from "./functions/get-map-states-template.js";
|
|
|
23
23
|
import { iterateConfigSlots } from "./functions/iterate-config-slots.js";
|
|
24
24
|
import { setLayersId } from "./functions/set-layers-id.js";
|
|
25
25
|
import { useMapSettings } from "./hooks/use-map-settings.js";
|
|
26
|
+
import { useAutoLegendRefresh } from "./hooks/useAutoLegendRefresh.js";
|
|
26
27
|
import { ColorScaleProvider } from "./providers/color-scale.provider.js";
|
|
27
28
|
import { LayerColorStrategyProvider } from "./providers/layer-color-strategy.provider.js";
|
|
28
29
|
import { DisabledState } from "./slots/states/DisabledState.js";
|
|
@@ -65,6 +66,7 @@ const _MapView = forwardRef(
|
|
|
65
66
|
} = useMapSettings();
|
|
66
67
|
const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;
|
|
67
68
|
const containerStyles = { width: "100%", ...costumerStyle };
|
|
69
|
+
const chartLayoutRef = useAutoLegendRefresh(layersData);
|
|
68
70
|
return /* @__PURE__ */ React.createElement(
|
|
69
71
|
"div",
|
|
70
72
|
{
|
|
@@ -75,6 +77,7 @@ const _MapView = forwardRef(
|
|
|
75
77
|
!isLoadingSettings && !isMapEnabled ? /* @__PURE__ */ React.createElement(DisabledState, { height: chartHeight }) : /* @__PURE__ */ React.createElement(MapCountryCodeContext.Provider, { value: countryCode }, /* @__PURE__ */ React.createElement(MapConfigurationContext.Provider, { value: config }, /* @__PURE__ */ React.createElement(LayerIdsContext.Provider, { value: layerIds }, /* @__PURE__ */ React.createElement(MapRawDataContext.Provider, { value: layersData }, /* @__PURE__ */ React.createElement(MapDataBoundingBoxContext.Provider, { value: dataLayersBBox }, /* @__PURE__ */ React.createElement(MapStoreProvider, null, /* @__PURE__ */ React.createElement(ColorScaleProvider, null, /* @__PURE__ */ React.createElement(LayerColorStrategyProvider, null, /* @__PURE__ */ React.createElement(
|
|
76
78
|
ChartLayout,
|
|
77
79
|
{
|
|
80
|
+
ref: chartLayoutRef,
|
|
78
81
|
chartHeight,
|
|
79
82
|
errorState,
|
|
80
83
|
showLoader: loading || isLoadingSettings
|
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 React, {\n forwardRef,\n type PropsWithChildren,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport {\n _ChartLayout as ChartLayout,\n _coerceSizeValue as coerceSizeValue,\n} from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport { MapLegendRenderer } from './components/legend/MapLegendRenderer.js';\nimport { MapContent } from './components/MapContent.js';\nimport { DEFAULT_LEGEND_SIZES, DEFAULT_MAP_HEIGHT } from './constants.js';\nimport { LayerIdsContext } from './contexts/layer-ids.context.js';\nimport { MapConfigurationContext } from './contexts/map-configuration.context.js';\nimport { MapCountryCodeContext } from './contexts/map-country-code.context.js';\nimport { MapDataBoundingBoxContext } from './contexts/map-data-bounding-box.context.js';\nimport { MapRawDataContext } from './contexts/map-raw-data.context.js';\nimport { buildAndDownloadCsv } from './functions/build-and-download-csv.js';\nimport { extractLayersData } from './functions/extract-layers-data.js';\nimport { getDataLayersBoundingBox } from './functions/get-data-layers-bounding-box.js';\nimport { getMapStatesTemplates } from './functions/get-map-states-template.js';\nimport { iterateConfigSlots } from './functions/iterate-config-slots.js';\nimport { setLayersId } from './functions/set-layers-id.js';\nimport { useMapSettings } from './hooks/use-map-settings.js';\nimport { ColorScaleProvider } from './providers/color-scale.provider.js';\nimport { LayerColorStrategyProvider } from './providers/layer-color-strategy.provider.js';\nimport { DisabledState } from './slots/states/DisabledState.js';\nimport { ErrorStateSlot } from './slots/states/ErrorStateSlot.js';\nimport { MapStoreProvider } from './store/map-store.provider.js';\n// eslint-disable-next-line no-restricted-imports\nimport './styles/react-mapgl-styles.css';\nimport type { MapViewProps, MapViewRef } from './types/map-view.js';\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 ...remaining\n } = props;\n const { layerIds, parsedChildren } = setLayersId(children);\n\n const layersData = extractLayersData(parsedChildren);\n const dataLayersBBox = getDataLayersBoundingBox(children);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const rootRef = useMergeRefs<MapViewRef | HTMLDivElement>([\n forwardedRef,\n containerRef,\n ]);\n\n useImperativeHandle(forwardedRef, () => ({\n element: containerRef.current,\n downloadData: () => {\n buildAndDownloadCsv(layersData);\n },\n }));\n\n const config = iterateConfigSlots(children);\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 { errorState } = getMapStatesTemplates(children);\n\n const {\n isLoading: isLoadingSettings,\n isMapEnabled,\n countryCode,\n } = useMapSettings();\n\n const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;\n\n const containerStyles = { width: '100%', ...costumerStyle };\n\n return (\n <div\n style={containerStyles}\n className={customerClassNames}\n data-testid=\"mapview-container\"\n >\n {!isLoadingSettings && !isMapEnabled ? (\n <DisabledState height={chartHeight} />\n ) : (\n <MapCountryCodeContext.Provider value={countryCode}>\n <MapConfigurationContext.Provider value={config}>\n <LayerIdsContext.Provider value={layerIds}>\n <MapRawDataContext.Provider value={layersData}>\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapStoreProvider>\n <ColorScaleProvider>\n <LayerColorStrategyProvider>\n <ChartLayout\n chartHeight={chartHeight}\n errorState={errorState}\n showLoader={loading || isLoadingSettings}\n >\n <ChartLayout.Graph>\n {!isLoadingSettings && (\n <MapContent ref={rootRef} {...remaining}>\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 </MapDataBoundingBoxContext.Provider>\n </MapRawDataContext.Provider>\n </LayerIdsContext.Provider>\n </MapConfigurationContext.Provider>\n </MapCountryCodeContext.Provider>\n )}\n </div>\n );\n },\n);\n\n_MapView['displayName'] = 'MapView';\n\n/**\n * The `MapView` is a component that renders a map with various geospatial data layers.\n * @beta\n */\nexport const MapView = Object.assign(_MapView, {\n ErrorState: ErrorStateSlot,\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO;AAAA,EACL;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,OACf;AACP,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB,0BAA0B;AACzD,SAAS,uBAAuB;AAChC,SA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AAQ,GAAG,cAAc;AAE1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,WAAW;AAAA,QACX,eAAY;AAAA;AAAA,MAEX,CAAC,qBAAqB,CAAC,eACtB,oCAAC,iBAAc,QAAQ,aAAa,IAEpC,oCAAC,sBAAsB,UAAtB,EAA+B,OAAO,eACrC,oCAAC,wBAAwB,UAAxB,EAAiC,OAAO,UACvC,oCAAC,gBAAgB,UAAhB,EAAyB,OAAO,YAC/B,oCAAC,kBAAkB,UAAlB,EAA2B,OAAO,cACjC,oCAAC,0BAA0B,UAA1B,EAAmC,OAAO,kBACzC,oCAAC,wBACC,oCAAC,0BACC,oCAAC,kCACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY,WAAW;AAAA;AAAA,QAEvB,oCAAC,YAAY,OAAZ,MACE,CAAC,qBACA,oCAAC,cAAW,KAAK,SAAU,GAAG,aAC3B,cACH,CAEJ;AAAA,QACC,CAAC,kBACA;AAAA,UAAC,YAAY;AAAA,UAAZ;AAAA,YACC,UAAU;AAAA,YACV,OAAO;AAAA,YACP,iBAAiB;AAAA,YACjB,UAAU;AAAA;AAAA,UAEV,oCAAC,uBAAkB;AAAA,QACrB;AAAA,MAEJ,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,SAAS,aAAa,IAAI;AAMnB,MAAM,UAAU,OAAO,OAAO,UAAU;AAAA,EAC7C,YAAY;AACd,CAAC;",
|
|
4
|
+
"sourcesContent": ["import React, {\n forwardRef,\n type PropsWithChildren,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport {\n _ChartLayout as ChartLayout,\n _coerceSizeValue as coerceSizeValue,\n} from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport { MapLegendRenderer } from './components/legend/MapLegendRenderer.js';\nimport { MapContent } from './components/MapContent.js';\nimport { DEFAULT_LEGEND_SIZES, DEFAULT_MAP_HEIGHT } from './constants.js';\nimport { LayerIdsContext } from './contexts/layer-ids.context.js';\nimport { MapConfigurationContext } from './contexts/map-configuration.context.js';\nimport { MapCountryCodeContext } from './contexts/map-country-code.context.js';\nimport { MapDataBoundingBoxContext } from './contexts/map-data-bounding-box.context.js';\nimport { MapRawDataContext } from './contexts/map-raw-data.context.js';\nimport { buildAndDownloadCsv } from './functions/build-and-download-csv.js';\nimport { extractLayersData } from './functions/extract-layers-data.js';\nimport { getDataLayersBoundingBox } from './functions/get-data-layers-bounding-box.js';\nimport { getMapStatesTemplates } from './functions/get-map-states-template.js';\nimport { iterateConfigSlots } from './functions/iterate-config-slots.js';\nimport { setLayersId } from './functions/set-layers-id.js';\nimport { useMapSettings } from './hooks/use-map-settings.js';\nimport { useAutoLegendRefresh } from './hooks/useAutoLegendRefresh.js';\nimport { ColorScaleProvider } from './providers/color-scale.provider.js';\nimport { LayerColorStrategyProvider } from './providers/layer-color-strategy.provider.js';\nimport { DisabledState } from './slots/states/DisabledState.js';\nimport { ErrorStateSlot } from './slots/states/ErrorStateSlot.js';\nimport { MapStoreProvider } from './store/map-store.provider.js';\n// eslint-disable-next-line no-restricted-imports\nimport './styles/react-mapgl-styles.css';\nimport type { MapViewProps, MapViewRef } from './types/map-view.js';\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 ...remaining\n } = props;\n const { layerIds, parsedChildren } = setLayersId(children);\n\n const layersData = extractLayersData(parsedChildren);\n const dataLayersBBox = getDataLayersBoundingBox(children);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const rootRef = useMergeRefs<MapViewRef | HTMLDivElement>([\n forwardedRef,\n containerRef,\n ]);\n\n useImperativeHandle(forwardedRef, () => ({\n element: containerRef.current,\n downloadData: () => {\n buildAndDownloadCsv(layersData);\n },\n }));\n\n const config = iterateConfigSlots(children);\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 { errorState } = getMapStatesTemplates(children);\n\n const {\n isLoading: isLoadingSettings,\n isMapEnabled,\n countryCode,\n } = useMapSettings();\n\n const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;\n\n const containerStyles = { width: '100%', ...costumerStyle };\n\n const chartLayoutRef = useAutoLegendRefresh(layersData);\n\n return (\n <div\n style={containerStyles}\n className={customerClassNames}\n data-testid=\"mapview-container\"\n >\n {!isLoadingSettings && !isMapEnabled ? (\n <DisabledState height={chartHeight} />\n ) : (\n <MapCountryCodeContext.Provider value={countryCode}>\n <MapConfigurationContext.Provider value={config}>\n <LayerIdsContext.Provider value={layerIds}>\n <MapRawDataContext.Provider value={layersData}>\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapStoreProvider>\n <ColorScaleProvider>\n <LayerColorStrategyProvider>\n <ChartLayout\n ref={chartLayoutRef}\n chartHeight={chartHeight}\n errorState={errorState}\n showLoader={loading || isLoadingSettings}\n >\n <ChartLayout.Graph>\n {!isLoadingSettings && (\n <MapContent ref={rootRef} {...remaining}>\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 </MapDataBoundingBoxContext.Provider>\n </MapRawDataContext.Provider>\n </LayerIdsContext.Provider>\n </MapConfigurationContext.Provider>\n </MapCountryCodeContext.Provider>\n )}\n </div>\n );\n },\n);\n\n_MapView['displayName'] = 'MapView';\n\n/**\n * The `MapView` is a component that renders a map with various geospatial data layers.\n * @beta\n */\nexport const MapView = Object.assign(_MapView, {\n ErrorState: ErrorStateSlot,\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AAAA,EACL;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,OACf;AACP,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB,0BAA0B;AACzD,SAAS,uBAAuB;AAChC,SAAS,+BAA+B;AACxC,SAAS,6BAA6B;AACtC,SAAS,iCAAiC;AAC1C,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AAEjC,OAAO;AAMP,MAAM,WAAW;AAAA,EACf,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,WAAW;AAAA,MACX,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,EAAE,UAAU,eAAe,IAAI,YAAY,QAAQ;AAEzD,UAAM,aAAa,kBAAkB,cAAc;AACnD,UAAM,iBAAiB,yBAAyB,QAAQ;AAExD,UAAM,eAAe,OAAuB,IAAI;AAChD,UAAM,UAAU,aAA0C;AAAA,MACxD;AAAA,MACA;AAAA,IACF,CAAC;AAED,wBAAoB,cAAc,OAAO;AAAA,MACvC,SAAS,aAAa;AAAA,MACtB,cAAc,MAAM;AAClB,4BAAoB,UAAU;AAAA,MAChC;AAAA,IACF,EAAE;AAEF,UAAM,SAAS,mBAAmB,QAAQ;AAE1C,U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AAA,IAEJ;AAAA,EAEJ;AACF;AAEA,SAAS,aAAa,IAAI;AAMnB,MAAM,UAAU,OAAO,OAAO,UAAU;AAAA,EAC7C,YAAY;AACd,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
const useAutoLegendRefresh = (data) => {
|
|
3
|
+
const chartLayoutRef = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
chartLayoutRef?.current?.refreshLegendSize();
|
|
6
|
+
}, [data]);
|
|
7
|
+
return chartLayoutRef;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
useAutoLegendRefresh
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useAutoLegendRefresh.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/map/hooks/useAutoLegendRefresh.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useRef } from 'react';\n\nimport { _ChartLayoutRef as ChartLayoutRef } from '@dynatrace/strato-components-preview/charts';\n\n/**\n * Hook responsible of re-trigger the automatic ratio calculation on dataset changes\n * @param data\n */\nexport const useAutoLegendRefresh = (\n data?: never[],\n): React.RefObject<ChartLayoutRef> => {\n const chartLayoutRef = useRef<ChartLayoutRef>(null);\n\n useEffect(() => {\n chartLayoutRef?.current?.refreshLegendSize();\n }, [data]);\n\n return chartLayoutRef;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW,cAAc;AAQ3B,MAAM,uBAAuB,CAClC,SACoC;AACpC,QAAM,iBAAiB,OAAuB,IAAI;AAElD,YAAU,MAAM;AACd,oBAAgB,SAAS,kBAAkB;AAAA,EAC7C,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/map/MapView.js
CHANGED
|
@@ -48,6 +48,7 @@ var import_get_map_states_template = require("./functions/get-map-states-templat
|
|
|
48
48
|
var import_iterate_config_slots = require("./functions/iterate-config-slots.js");
|
|
49
49
|
var import_set_layers_id = require("./functions/set-layers-id.js");
|
|
50
50
|
var import_use_map_settings = require("./hooks/use-map-settings.js");
|
|
51
|
+
var import_useAutoLegendRefresh = require("./hooks/useAutoLegendRefresh.js");
|
|
51
52
|
var import_color_scale_provider = require("./providers/color-scale.provider.js");
|
|
52
53
|
var import_layer_color_strategy_provider = require("./providers/layer-color-strategy.provider.js");
|
|
53
54
|
var import_DisabledState = require("./slots/states/DisabledState.js");
|
|
@@ -90,6 +91,7 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
90
91
|
} = (0, import_use_map_settings.useMapSettings)();
|
|
91
92
|
const chartHeight = (0, import_charts._coerceSizeValue)(props.height) || import_constants.DEFAULT_MAP_HEIGHT;
|
|
92
93
|
const containerStyles = { width: "100%", ...costumerStyle };
|
|
94
|
+
const chartLayoutRef = (0, import_useAutoLegendRefresh.useAutoLegendRefresh)(layersData);
|
|
93
95
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
94
96
|
"div",
|
|
95
97
|
{
|
|
@@ -100,6 +102,7 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
100
102
|
!isLoadingSettings && !isMapEnabled ? /* @__PURE__ */ import_react.default.createElement(import_DisabledState.DisabledState, { height: chartHeight }) : /* @__PURE__ */ import_react.default.createElement(import_map_country_code_context.MapCountryCodeContext.Provider, { value: countryCode }, /* @__PURE__ */ import_react.default.createElement(import_map_configuration_context.MapConfigurationContext.Provider, { value: config }, /* @__PURE__ */ import_react.default.createElement(import_layer_ids_context.LayerIdsContext.Provider, { value: layerIds }, /* @__PURE__ */ import_react.default.createElement(import_map_raw_data_context.MapRawDataContext.Provider, { value: layersData }, /* @__PURE__ */ import_react.default.createElement(import_map_data_bounding_box_context.MapDataBoundingBoxContext.Provider, { value: dataLayersBBox }, /* @__PURE__ */ import_react.default.createElement(import_map_store_provider.MapStoreProvider, null, /* @__PURE__ */ import_react.default.createElement(import_color_scale_provider.ColorScaleProvider, null, /* @__PURE__ */ import_react.default.createElement(import_layer_color_strategy_provider.LayerColorStrategyProvider, null, /* @__PURE__ */ import_react.default.createElement(
|
|
101
103
|
import_charts._ChartLayout,
|
|
102
104
|
{
|
|
105
|
+
ref: chartLayoutRef,
|
|
103
106
|
chartHeight,
|
|
104
107
|
errorState,
|
|
105
108
|
showLoader: loading || isLoadingSettings
|
|
@@ -2,6 +2,6 @@ import React, { type PropsWithChildren } from 'react';
|
|
|
2
2
|
import { type InternalBubbleLayerProps } from '../../types/bubble-layer.js';
|
|
3
3
|
import type { Location } from '../../types/location.js';
|
|
4
4
|
export declare const BubbleLayer: {
|
|
5
|
-
<T extends Location>(props:
|
|
5
|
+
<T extends Location>(props: PropsWithChildren<InternalBubbleLayerProps<T>>): React.JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import type { InternalChoroplethLayerProps } from '../../types/choropleth-layer.js';
|
|
3
3
|
export declare const ChoroplethLayer: {
|
|
4
|
-
<T extends Record<string, unknown>>(props:
|
|
4
|
+
<T extends Record<string, unknown>>(props: PropsWithChildren<InternalChoroplethLayerProps<T>>): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
@@ -5,6 +5,6 @@ import type { Location } from '../../types/location.js';
|
|
|
5
5
|
* DotLayer Component
|
|
6
6
|
*/
|
|
7
7
|
export declare const DotLayer: {
|
|
8
|
-
<T extends Location>(props:
|
|
8
|
+
<T extends Location>(props: PropsWithChildren<InternalDotLayerProps<T>>): React.JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useResolveColor: (defaultColor: string, props: any, colorParser?: (
|
|
1
|
+
export declare const useResolveColor: (defaultColor: string, props: any, colorParser?: (value: string | number) => string | undefined) => any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { _ChartLayoutRef as ChartLayoutRef } from '@dynatrace/strato-components-preview/charts';
|
|
2
|
+
/**
|
|
3
|
+
* Hook responsible of re-trigger the automatic ratio calculation on dataset changes
|
|
4
|
+
* @param data
|
|
5
|
+
*/
|
|
6
|
+
export declare const useAutoLegendRefresh: (data?: never[]) => React.RefObject<ChartLayoutRef>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var useAutoLegendRefresh_exports = {};
|
|
19
|
+
__export(useAutoLegendRefresh_exports, {
|
|
20
|
+
useAutoLegendRefresh: () => useAutoLegendRefresh
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(useAutoLegendRefresh_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
const useAutoLegendRefresh = (data) => {
|
|
25
|
+
const chartLayoutRef = (0, import_react.useRef)(null);
|
|
26
|
+
(0, import_react.useEffect)(() => {
|
|
27
|
+
chartLayoutRef?.current?.refreshLegendSize();
|
|
28
|
+
}, [data]);
|
|
29
|
+
return chartLayoutRef;
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-geo",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"lang": "lang/uncompiled",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"maplibre-gl": "^3.1.0",
|
|
41
41
|
"react-map-gl": "^7.1.7",
|
|
42
42
|
"@dynatrace/strato-design-tokens": "0.20.30",
|
|
43
|
-
"@dynatrace/strato-icons": "0.
|
|
43
|
+
"@dynatrace/strato-icons": "0.38.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@dynatrace-sdk/client-classic-environment-v2": "^1.1.0",
|
|
47
|
-
"@dynatrace-sdk/client-platform-management-service": "^0.0.6",
|
|
47
|
+
"@dynatrace-sdk/client-platform-management-service": "^0.0.6 || ^0.0.8",
|
|
48
48
|
"react": "^18.0.0",
|
|
49
49
|
"react-dom": "^18.0.0",
|
|
50
50
|
"react-intl": "^6.0.8",
|
|
51
51
|
"react-is": "^18.0.0",
|
|
52
|
-
"@dynatrace/strato-components-preview": "~0.115.
|
|
52
|
+
"@dynatrace/strato-components-preview": "~0.115.25"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": [
|
|
55
55
|
"./map/styles/react-mapgl-styles.css",
|