@dynatrace/strato-geo 0.9.2 → 0.9.17
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 +8 -10
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/constants.js +4 -2
- package/esm/map/constants.js.map +2 -2
- package/esm/map/functions/iterate-config-slots.js +10 -1
- package/esm/map/functions/iterate-config-slots.js.map +2 -2
- package/esm/map/functions/set-layers-id.js +1 -0
- package/esm/map/functions/set-layers-id.js.map +2 -2
- package/esm/map/hooks/use-map-performance.js +0 -15
- package/esm/map/hooks/use-map-performance.js.map +2 -2
- package/map/MapView.js +7 -5
- package/map/constants.d.ts +2 -1
- package/map/constants.js +4 -2
- package/map/functions/iterate-config-slots.js +5 -0
- package/map/functions/set-layers-id.js +1 -0
- package/map/hooks/use-map-performance.d.ts +0 -15
- package/map/hooks/use-map-performance.js +0 -15
- package/map/types/legend.d.ts +3 -25
- package/map/types/map-view.d.ts +1 -1
- package/package.json +3 -3
package/esm/map/MapView.js
CHANGED
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
import { useMergeRefs } from "@dynatrace/strato-components-preview/core";
|
|
11
11
|
import { MapLegendRenderer } from "./components/legend/MapLegendRenderer.js";
|
|
12
12
|
import { MapContent } from "./components/MapContent.js";
|
|
13
|
-
import {
|
|
14
|
-
DEFAULT_LEGEND_SIZES,
|
|
15
|
-
DEFAULT_MAP_HEIGHT,
|
|
16
|
-
DEFAULT_MAP_LEGEND_RATIO
|
|
17
|
-
} from "./constants.js";
|
|
13
|
+
import { DEFAULT_LEGEND_SIZES, DEFAULT_MAP_HEIGHT } from "./constants.js";
|
|
18
14
|
import { LayerIdsContext } from "./contexts/layer-ids.context.js";
|
|
19
15
|
import { MapConfigurationContext } from "./contexts/map-configuration.context.js";
|
|
20
16
|
import { MapCountryCodeContext } from "./contexts/map-country-code.context.js";
|
|
@@ -57,15 +53,16 @@ const _MapView = forwardRef(
|
|
|
57
53
|
}
|
|
58
54
|
}));
|
|
59
55
|
const config = iterateConfigSlots(children);
|
|
60
|
-
const
|
|
56
|
+
const isLegendHidden = !config.legend || !!config.legend.hidden;
|
|
57
|
+
const legendPosition = config.legend?.position;
|
|
58
|
+
const legendRatio = config.legend?.ratio;
|
|
59
|
+
const legendOnRatioChange = config.legend?.onRatioChange;
|
|
61
60
|
const { errorState } = getMapStatesTemplates(children);
|
|
62
61
|
const {
|
|
63
62
|
isLoading: isLoadingSettings,
|
|
64
63
|
isMapEnabled,
|
|
65
64
|
countryCode
|
|
66
65
|
} = useMapSettings();
|
|
67
|
-
const { position: legendPosition } = config.legend ?? { position: "auto" };
|
|
68
|
-
const legendRatio = config?.legend?.type === "sequential" || config?.legend?.type === "threshold" ? DEFAULT_MAP_LEGEND_RATIO : void 0;
|
|
69
66
|
const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;
|
|
70
67
|
const containerStyles = { width: "100%", ...costumerStyle };
|
|
71
68
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -83,12 +80,13 @@ const _MapView = forwardRef(
|
|
|
83
80
|
showLoader: loading || isLoadingSettings
|
|
84
81
|
},
|
|
85
82
|
/* @__PURE__ */ React.createElement(ChartLayout.Graph, null, !isLoadingSettings && /* @__PURE__ */ React.createElement(MapContent, { ref: rootRef, ...remaining }, parsedChildren)),
|
|
86
|
-
!
|
|
83
|
+
!isLegendHidden && /* @__PURE__ */ React.createElement(
|
|
87
84
|
ChartLayout.Legend,
|
|
88
85
|
{
|
|
89
86
|
position: legendPosition,
|
|
90
87
|
ratio: legendRatio,
|
|
91
|
-
ratioBoundaries: DEFAULT_LEGEND_SIZES
|
|
88
|
+
ratioBoundaries: DEFAULT_LEGEND_SIZES,
|
|
89
|
+
onResize: legendOnRatioChange
|
|
92
90
|
},
|
|
93
91
|
/* @__PURE__ */ React.createElement(MapLegendRenderer, null)
|
|
94
92
|
)
|
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 {
|
|
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
|
|
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,SAAS,+BAA+B;AACxC,SAAS,6BAA6B;AACtC,SAAS,iCAAiC;AAC1C,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,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,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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/esm/map/constants.js
CHANGED
|
@@ -15,8 +15,9 @@ const WHOLE_WORLD_VIEW_BOUNDARIES = [
|
|
|
15
15
|
];
|
|
16
16
|
const DEFAULT_COUNTRY_CODE = "default";
|
|
17
17
|
const FIT_BOUNDS_OPTIONS = { padding: 20 };
|
|
18
|
-
const DEFAULT_MAP_HEIGHT =
|
|
18
|
+
const DEFAULT_MAP_HEIGHT = 400;
|
|
19
19
|
const DEFAULT_MAP_LEGEND_RATIO = 12;
|
|
20
|
+
const DEFAULT_MAP_POSITION = "auto";
|
|
20
21
|
const DEFAULT_INPUT_ICON_SIZE = 20;
|
|
21
22
|
const ACTIVE_COLOR = Colors.Border.Neutral.AccentActive;
|
|
22
23
|
const BASE_LAYER_IDS = ["geojson-line", "geojson-fill"];
|
|
@@ -62,7 +63,7 @@ const DEFAULT_LINE_DASH_ARRAY = [5, 2.5];
|
|
|
62
63
|
const MIN_LINE_THICKNESS = 1;
|
|
63
64
|
const MAX_LINE_THICKNESS = 64;
|
|
64
65
|
const DIRECTION_ICON_OUTPUT_SIZE = 128;
|
|
65
|
-
const DIRECTION_ICON_SHRINK_RATIO = 1 /
|
|
66
|
+
const DIRECTION_ICON_SHRINK_RATIO = 1 / 15;
|
|
66
67
|
const ACTIVE_STATE_BORDERS_WIDTH = 1.8;
|
|
67
68
|
const DEFAULT_CHOROPLETH_COLOR = Colors.Charts.Sequential.Blue.Color05.Default;
|
|
68
69
|
const COPY_TO_CLIPBOARD_MESSAGES = defineMessages({
|
|
@@ -99,6 +100,7 @@ export {
|
|
|
99
100
|
DEFAULT_LINE_THICKNESS,
|
|
100
101
|
DEFAULT_MAP_HEIGHT,
|
|
101
102
|
DEFAULT_MAP_LEGEND_RATIO,
|
|
103
|
+
DEFAULT_MAP_POSITION,
|
|
102
104
|
DEFAULT_RADIUS,
|
|
103
105
|
DEFAULT_RADIUS_EXPRESSION,
|
|
104
106
|
DEFAULT_RANGE_COLOR,
|
package/esm/map/constants.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/map/constants.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ExpressionSpecification } from '@maplibre/maplibre-gl-style-spec';\nimport { defineMessages } from 'react-intl';\n\nimport Colors from '@dynatrace/strato-design-tokens/colors';\n\n//region GENERAL\nexport const DEFAULT_COUNTRIES_FILL_COLOR = Colors.Theme.Neutral['50'];\nexport const DEFAULT_COUNTRIES_BORDER_COLOR = Colors.Background.Surface.Default;\nexport const TRANSPARENT_BORDER_COLOR = '#00000000';\nexport const MAX_LATITUDE = 90;\nexport const MIN_LATITUDE = -90;\nexport const MAX_LONGITUDE = 180;\nexport const MIN_LONGITUDE = -180;\nexport const WHOLE_WORLD_VIEW_BOUNDARIES: [number, number, number, number] = [\n MAX_LONGITUDE,\n MAX_LATITUDE,\n MIN_LONGITUDE,\n MIN_LATITUDE,\n];\nexport const DEFAULT_COUNTRY_CODE = 'default';\nexport const FIT_BOUNDS_OPTIONS = { padding: 20 };\nexport const DEFAULT_MAP_HEIGHT =
|
|
5
|
-
"mappings": "AACA,SAAS,sBAAsB;AAE/B,OAAO,YAAY;AAGZ,MAAM,+BAA+B,OAAO,MAAM,QAAQ,IAAI;AAC9D,MAAM,iCAAiC,OAAO,WAAW,QAAQ;AACjE,MAAM,2BAA2B;AACjC,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AACtB,MAAM,8BAAgE;AAAA,EAC3E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB,EAAE,SAAS,GAAG;AACzC,MAAM,qBAAqB;AAC3B,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;AAChC,MAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,MAAM,iBAAiB,CAAC,gBAAgB,cAAc;AACtD,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAI5B,MAAM,kCACX,OAAO,OAAO,kBAAkB,WAAW;AACtC,MAAM,uBAAuB;AAAA;AAAA,EAElC,UAAU;AAAA;AAAA,EAEV,WAAW;AAAA;AAAA,EAEX,UAAU;AAAA;AAAA,EAEV,WAAW;AACb;AACO,MAAM,oBAAoB;AAAA,EAC/B,uBAAuB;AACzB;AACO,MAAM,sBAAsB,OAAO,WAAW,MAAM,QAAQ;AAC5D,MAAM,qBAAqB;AAC3B,MAAM,0CAA0C;AAIhD,MAAM,0BAA0B;AAChC,MAAM,yBAAyB;AAC/B,MAAM,gCACX,OAAO,WAAW,UAAU,QAAQ;AAC/B,MAAM,0BAA0B;AAChC,MAAM,sBAAsB,OAAO,OAAO,YAAY,QAAQ;AAC9D,MAAM,qBAAqB,OAAO,KAAK,QAAQ;AAI/C,MAAM,uBAAuB,OAAO,OAAO,YAAY,QAAQ;AAC/D,MAAM,iBAAiB;AACvB,MAAM,yBAAyB;AAC/B,MAAM,gBAAgB;AACtB,MAAM,wBAAwB;AAC9B,MAAM,4BAAqD;AAAA,EAChE;AAAA,EACA;AACF;AAIO,MAAM,oBAAiD;AACvD,MAAM,mBAAgD;AACtD,MAAM,yBAAyB;AAC/B,MAAM,qBAAqB,OAAO,OAAO,YAAY,QAAQ;AAC7D,MAAM,0BAA0B,CAAC,GAAG,GAAG;AACvC,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,6BAA6B;AACnC,MAAM,8BAA8B,IAAI;AAKxC,MAAM,6BAA6B;AAEnC,MAAM,2BACX,OAAO,OAAO,WAAW,KAAK,QAAQ;AAEjC,MAAM,6BAA6B,eAAe;AAAA,EACvD,kBAAkB;AAAA,IAChB,IAAI;AAAA,IACJ,gBAAgB;AAAA,IAChB,aACE;AAAA,EACJ;AACF,CAAC;",
|
|
4
|
+
"sourcesContent": ["import type { ExpressionSpecification } from '@maplibre/maplibre-gl-style-spec';\nimport { defineMessages } from 'react-intl';\n\nimport Colors from '@dynatrace/strato-design-tokens/colors';\n\n//region GENERAL\nexport const DEFAULT_COUNTRIES_FILL_COLOR = Colors.Theme.Neutral['50'];\nexport const DEFAULT_COUNTRIES_BORDER_COLOR = Colors.Background.Surface.Default;\nexport const TRANSPARENT_BORDER_COLOR = '#00000000';\nexport const MAX_LATITUDE = 90;\nexport const MIN_LATITUDE = -90;\nexport const MAX_LONGITUDE = 180;\nexport const MIN_LONGITUDE = -180;\nexport const WHOLE_WORLD_VIEW_BOUNDARIES: [number, number, number, number] = [\n MAX_LONGITUDE,\n MAX_LATITUDE,\n MIN_LONGITUDE,\n MIN_LATITUDE,\n];\nexport const DEFAULT_COUNTRY_CODE = 'default';\nexport const FIT_BOUNDS_OPTIONS = { padding: 20 };\nexport const DEFAULT_MAP_HEIGHT = 400;\nexport const DEFAULT_MAP_LEGEND_RATIO = 12;\nexport const DEFAULT_MAP_POSITION = 'auto';\nexport const DEFAULT_INPUT_ICON_SIZE = 20;\nexport const ACTIVE_COLOR = Colors.Border.Neutral.AccentActive;\nexport const BASE_LAYER_IDS = ['geojson-line', 'geojson-fill'];\nexport const SHAPE_OPACITY = 1;\nexport const DEFAULT_SYMBOL_SIZE = 32;\n//endregion\n\n//region LEGEND\nexport const DEFAULT_BASIC_SHAPE_COLOR_TOKEN =\n Colors.Charts.CategoricalThemed.PurpleRain.Color01;\nexport const DEFAULT_LEGEND_SIZES = {\n // Minimum size in which the legend can be resized (vertical layout)\n minWidth: 0.1,\n // Minimum size in which the legend can be resized (horizontal layout)\n minHeight: 0.1,\n // Maximum size in which the legend can be resized (vertical layout). 80% represent 4 / 5ths of the container.\n maxWidth: 0.8,\n // Maximum size in which the legend can be resized (horizontal layout). 80% represent 4 / 5ths of the container.\n maxHeight: 0.8,\n};\nexport const DEFAULT_FORMATTER = {\n maximumFractionDigits: 1,\n};\nexport const DEFAULT_RANGE_COLOR = Colors.Background.Field.Neutral.Disabled;\nexport const LEGEND_DIM_OPACITY = 0.2;\nexport const DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE = 'blue';\n//endregion\n\n//region DOT LAYER\nexport const ICON_BACKGROUND_OPACITY = 0.7;\nexport const ICON_BACKGROUND_RADIUS = 16;\nexport const DEFAULT_ICON_BACKGROUND_COLOR =\n Colors.Background.Container.Neutral.Subdued;\nexport const DEFAULT_ICON_SIZE_RATIO = 0.6;\nexport const DEFAULT_SHAPE_COLOR = Colors.Charts.Categorical.Color15.Default;\nexport const DEFAULT_ICON_COLOR = Colors.Icon.Neutral.Default;\n//endregion\n\n//region BUBBLE LAYER\nexport const DEFAULT_BUBBLE_COLOR = Colors.Charts.Categorical.Color07.Default;\nexport const DEFAULT_RADIUS = 12;\nexport const BUBBLE_DEFAULT_OPACITY = 0.4;\nexport const BUBBLE_STROKE = 1;\nexport const BUBBLE_OUTLINE_STROKE = 1;\nexport const DEFAULT_RADIUS_EXPRESSION: ExpressionSpecification = [\n 'get',\n '__radius',\n];\n//endregion\n\n//region CONNECTION LAYER\nexport const DEFAULT_LINE_JOIN: 'bevel' | 'round' | 'miter' = 'miter';\nexport const DEFAULT_LINE_CAP: 'butt' | 'round' | 'square' = 'butt';\nexport const DEFAULT_LINE_THICKNESS = 2;\nexport const DEFAULT_LINE_COLOR = Colors.Charts.Categorical.Color03.Default;\nexport const DEFAULT_LINE_DASH_ARRAY = [5, 2.5];\nexport const MIN_LINE_THICKNESS = 1;\nexport const MAX_LINE_THICKNESS = 64;\nexport const DIRECTION_ICON_OUTPUT_SIZE = 128;\nexport const DIRECTION_ICON_SHRINK_RATIO = 1 / 15;\n//endregion\n\n//region CHOROPLETH LAYER\n\nexport const ACTIVE_STATE_BORDERS_WIDTH = 1.8;\n\nexport const DEFAULT_CHOROPLETH_COLOR =\n Colors.Charts.Sequential.Blue.Color05.Default;\n\nexport const COPY_TO_CLIPBOARD_MESSAGES = defineMessages({\n copyActionCoords: {\n id: 'g2qESM+ibB5sUyjf',\n defaultMessage: 'Copy coordinates',\n description:\n 'Text in a tooltip shown when hovering a tooltip item and hovering the copy button next to its coordinates',\n },\n});\n//endregion\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,sBAAsB;AAE/B,OAAO,YAAY;AAGZ,MAAM,+BAA+B,OAAO,MAAM,QAAQ,IAAI;AAC9D,MAAM,iCAAiC,OAAO,WAAW,QAAQ;AACjE,MAAM,2BAA2B;AACjC,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AACtB,MAAM,8BAAgE;AAAA,EAC3E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB,EA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Ae;AAAA,EACvD,kBAAkB;AAAA,IAChB,IAAI;AAAA,IACJ,gBAAgB;AAAA,IAChB,aACE;AAAA,EACJ;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { isElement } from "react-is";
|
|
3
3
|
import { ChartToolbar } from "@dynatrace/strato-components-preview/charts";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_MAP_LEGEND_RATIO,
|
|
6
|
+
DEFAULT_MAP_POSITION,
|
|
7
|
+
DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE
|
|
8
|
+
} from "../constants.js";
|
|
5
9
|
import { CategoricalLegend } from "../slots/CategoricalLegend.js";
|
|
6
10
|
import { ChartInteractions } from "../slots/ChartInteractions.js";
|
|
7
11
|
import { SequentialLegend } from "../slots/SequentialLegend.js";
|
|
@@ -46,6 +50,8 @@ const iterateConfigSlots = (children) => {
|
|
|
46
50
|
legend: {
|
|
47
51
|
type: "sequential",
|
|
48
52
|
colorPalette: DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,
|
|
53
|
+
position: DEFAULT_MAP_POSITION,
|
|
54
|
+
ratio: DEFAULT_MAP_LEGEND_RATIO,
|
|
49
55
|
...legend
|
|
50
56
|
}
|
|
51
57
|
};
|
|
@@ -57,6 +63,7 @@ const iterateConfigSlots = (children) => {
|
|
|
57
63
|
...slots,
|
|
58
64
|
legend: {
|
|
59
65
|
type: "categorical",
|
|
66
|
+
position: DEFAULT_MAP_POSITION,
|
|
60
67
|
...legend
|
|
61
68
|
}
|
|
62
69
|
};
|
|
@@ -68,6 +75,8 @@ const iterateConfigSlots = (children) => {
|
|
|
68
75
|
...slots,
|
|
69
76
|
legend: {
|
|
70
77
|
type: "threshold",
|
|
78
|
+
position: DEFAULT_MAP_POSITION,
|
|
79
|
+
ratio: DEFAULT_MAP_LEGEND_RATIO,
|
|
71
80
|
...legend
|
|
72
81
|
}
|
|
73
82
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/functions/iterate-config-slots.ts"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { isElement } from 'react-is';\n\nimport { ChartToolbar } from '@dynatrace/strato-components-preview/charts';\n\nimport {
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAE1B,SAAS,oBAAoB;AAE7B,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { isElement } from 'react-is';\n\nimport { ChartToolbar } from '@dynatrace/strato-components-preview/charts';\n\nimport {\n DEFAULT_MAP_LEGEND_RATIO,\n DEFAULT_MAP_POSITION,\n DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n} from '../constants.js';\nimport { CategoricalLegend } from '../slots/CategoricalLegend.js';\nimport { ChartInteractions } from '../slots/ChartInteractions.js';\nimport { SequentialLegend } from '../slots/SequentialLegend.js';\nimport { ThresholdLegend } from '../slots/ThresholdLegend.js';\nimport type { MapConfig } from '../types/configuration.js';\nimport type { ChartInteractionsConfig } from '../types/toolbar.js';\n\n/**\n * Generate map config based on slots\n * @param children - Map children\n * @returns Map slot config\n */\nexport const iterateConfigSlots = (children: React.ReactNode) => {\n let slots: MapConfig = {\n toolbar: undefined,\n interactions: undefined,\n legend: undefined,\n };\n\n React.Children.forEach(children, (child) => {\n if (isElement(child)) {\n switch (child.type) {\n case ChartInteractions: {\n const { children, ...previousInteractions } = child.props;\n\n const interactions = iterateChartInteractionsSlots(children);\n\n slots = {\n ...slots,\n interactions: {\n ...previousInteractions,\n ...interactions,\n },\n };\n break;\n }\n\n case ChartToolbar: {\n const { children, ...toolbar } = child.props;\n const childrenToolbar = iterateChartToolbarSlots(children);\n\n slots = {\n ...slots,\n toolbar: {\n ...toolbar,\n ...childrenToolbar,\n },\n };\n break;\n }\n\n case SequentialLegend: {\n const { children, ...legend } = child.props;\n\n slots = {\n ...slots,\n legend: {\n type: 'sequential',\n colorPalette: DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n position: DEFAULT_MAP_POSITION,\n ratio: DEFAULT_MAP_LEGEND_RATIO,\n ...legend,\n },\n };\n break;\n }\n\n case CategoricalLegend: {\n const { children, ...legend } = child.props;\n\n slots = {\n ...slots,\n legend: {\n type: 'categorical',\n position: DEFAULT_MAP_POSITION,\n ...legend,\n },\n };\n break;\n }\n\n case ThresholdLegend: {\n const { children, ...legend } = child.props;\n\n slots = {\n ...slots,\n legend: {\n type: 'threshold',\n position: DEFAULT_MAP_POSITION,\n ratio: DEFAULT_MAP_LEGEND_RATIO,\n ...legend,\n },\n };\n break;\n }\n }\n }\n });\n\n return slots;\n};\n\nconst iterateChartInteractionsSlots = (children: React.ReactElement[]) => {\n let interactions: ChartInteractionsConfig = {};\n\n React.Children.forEach(children, (childInteractions) => {\n if (isElement(childInteractions)) {\n switch (childInteractions.type) {\n case ChartInteractions.Zoom:\n interactions = { ...interactions, zoom: { enabled: true } };\n break;\n case ChartInteractions.ZoomToFit:\n interactions = { ...interactions, zoomToFit: { enabled: true } };\n break;\n }\n }\n });\n\n return interactions;\n};\n\n/**\n * Generates chart config based on slots\n * @param children - CharInteraction children\n * @returns ChartInteraction slot config\n */\nconst iterateChartToolbarSlots = (children: React.ReactElement[]) => {\n let toolbar = {};\n\n React.Children.forEach(children, (childToolbar) => {\n if (\n isElement(childToolbar) &&\n childToolbar.type === ChartToolbar.DownloadData\n ) {\n toolbar = {\n ...toolbar,\n downloadData: { enabled: true },\n };\n }\n });\n\n return toolbar;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAE1B,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAA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AE,UAAAA,WAAU,GAAG,OAAO,IAAI,MAAM;AAEtC,kBAAQ;AAAA,YACN,GAAG;AAAA,YACH,QAAQ;AAAA,cACN,MAAM;AAAA,cACN,UAAU;AAAA,cACV,OAAO;AAAA,cACP,GAAG;AAAA,YACL;AAAA,UACF;AACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEA,MAAM,gCAAgC,CAAC,aAAmC;AACxE,MAAI,eAAwC,CAAC;AAE7C,QAAM,SAAS,QAAQ,UAAU,CAAC,sBAAsB;AACtD,QAAI,UAAU,iBAAiB,GAAG;AAChC,cAAQ,kBAAkB,MAAM;AAAA,QAC9B,KAAK,kBAAkB;AACrB,yBAAe,EAAE,GAAG,cAAc,MAAM,EAAE,SAAS,KAAK,EAAE;AAC1D;AAAA,QACF,KAAK,kBAAkB;AACrB,yBAAe,EAAE,GAAG,cAAc,WAAW,EAAE,SAAS,KAAK,EAAE;AAC/D;AAAA,MACJ;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAOA,MAAM,2BAA2B,CAAC,aAAmC;AACnE,MAAI,UAAU,CAAC;AAEf,QAAM,SAAS,QAAQ,UAAU,CAAC,iBAAiB;AACjD,QACE,UAAU,YAAY,KACtB,aAAa,SAAS,aAAa,cACnC;AACA,gBAAU;AAAA,QACR,GAAG;AAAA,QACH,cAAc,EAAE,SAAS,KAAK;AAAA,MAChC;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": ["children"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/functions/set-layers-id.ts"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { isElement } from 'react-is';\n\nimport { BubbleLayer as _BubbleLayer } from '../components/BubbleLayer/BubbleLayer.js';\nimport { ChoroplethLayer as _ChoroplethLayer } from '../components/ChoroplethLayer/ChoroplethLayer.js';\nimport { ConnectionLayer as _ConnectionLayer } from '../components/ConnectionLayer/ConnectionLayer.js';\nimport { DotLayer as _DotLayer } from '../components/DotLayer/DotLayer.js';\nimport { BubbleLayer } from '../slots/BubbleLayer.js';\nimport { ChoroplethLayer } from '../slots/ChoroplethLayer.js';\nimport { ConnectionLayer } from '../slots/ConnectionLayer.js';\nimport { DotLayer } from '../slots/DotLayer.js';\nimport type { InternalBubbleLayerProps } from '../types/bubble-layer.js';\nimport type { InternalChoroplethLayerProps } from '../types/choropleth-layer.js';\nimport type { InternalConnectionLayerProps } from '../types/connection-layer.js';\nimport type { InternalDotLayerProps } from '../types/dot-layer.js';\n\nconst layers = new WeakMap<\n React.JSXElementConstructor<never>,\n { prefix: string; component: React.JSXElementConstructor<never> }\n>([\n [BubbleLayer, { component: _BubbleLayer, prefix: 'bubble' }],\n [DotLayer, { component: _DotLayer, prefix: 'dot' }],\n [ChoroplethLayer, { component: _ChoroplethLayer, prefix: 'choropleth' }],\n [ConnectionLayer, { component: _ConnectionLayer, prefix: 'connection' }],\n]);\n\n/**\n * Set layers id to layer slots provided by the consumer.\n * @param children - MapView children\n * @returns An array with all the layers IDs and the children using the layer component\n */\nexport const setLayersId = (children: React.ReactNode) => {\n const layerIds: string[] = [];\n let index = 0;\n\n const parsedChildren = React.Children.map(children, (child) => {\n if (isElement(child)) {\n switch (child.type) {\n case BubbleLayer:\n case ConnectionLayer:\n case ChoroplethLayer:\n case DotLayer: {\n const layer = layers.get(child.type);\n\n const layerId = `${layer?.prefix}-${index}`;\n index += 1;\n\n layerIds.push(layerId);\n\n const newProps: React.PropsWithChildren<\n | InternalBubbleLayerProps<never>\n | InternalConnectionLayerProps<never>\n | InternalDotLayerProps<never>\n | InternalChoroplethLayerProps<never>\n > = {\n ...child.props,\n layerId,\n };\n\n return {\n ...child,\n props: newProps,\n type: layer?.component,\n };\n }\n default: {\n return child;\n }\n }\n }\n\n return child;\n }) as React.ReactNode;\n\n return {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AAE,UAAU,eAAe;AACpC;",
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { isElement } from 'react-is';\n\nimport { BubbleLayer as _BubbleLayer } from '../components/BubbleLayer/BubbleLayer.js';\nimport { ChoroplethLayer as _ChoroplethLayer } from '../components/ChoroplethLayer/ChoroplethLayer.js';\nimport { ConnectionLayer as _ConnectionLayer } from '../components/ConnectionLayer/ConnectionLayer.js';\nimport { DotLayer as _DotLayer } from '../components/DotLayer/DotLayer.js';\nimport { BubbleLayer } from '../slots/BubbleLayer.js';\nimport { ChoroplethLayer } from '../slots/ChoroplethLayer.js';\nimport { ConnectionLayer } from '../slots/ConnectionLayer.js';\nimport { DotLayer } from '../slots/DotLayer.js';\nimport type { InternalBubbleLayerProps } from '../types/bubble-layer.js';\nimport type { InternalChoroplethLayerProps } from '../types/choropleth-layer.js';\nimport type { InternalConnectionLayerProps } from '../types/connection-layer.js';\nimport type { InternalDotLayerProps } from '../types/dot-layer.js';\n\nconst layers = new WeakMap<\n React.JSXElementConstructor<never>,\n { prefix: string; component: React.JSXElementConstructor<never> }\n>([\n [BubbleLayer, { component: _BubbleLayer, prefix: 'bubble' }],\n [DotLayer, { component: _DotLayer, prefix: 'dot' }],\n [ChoroplethLayer, { component: _ChoroplethLayer, prefix: 'choropleth' }],\n [ConnectionLayer, { component: _ConnectionLayer, prefix: 'connection' }],\n]);\n\n/**\n * Set layers id to layer slots provided by the consumer.\n * @param children - MapView children\n * @returns An array with all the layers IDs and the children using the layer component\n */\nexport const setLayersId = (children: React.ReactNode) => {\n const layerIds: string[] = [];\n let index = 0;\n\n const parsedChildren = React.Children.map(children, (child) => {\n if (isElement(child)) {\n switch (child.type) {\n case BubbleLayer:\n case ConnectionLayer:\n case ChoroplethLayer:\n case DotLayer: {\n const layer = layers.get(child.type);\n\n const layerId = `${layer?.prefix}-${index}`;\n index += 1;\n\n layerIds.push(layerId);\n\n const newProps: React.PropsWithChildren<\n | InternalBubbleLayerProps<never>\n | InternalConnectionLayerProps<never>\n | InternalDotLayerProps<never>\n | InternalChoroplethLayerProps<never>\n > = {\n ...child.props,\n layerId,\n };\n\n return {\n ...child,\n key: layerId,\n props: newProps,\n type: layer?.component,\n };\n }\n default: {\n return child;\n }\n }\n }\n\n return child;\n }) as React.ReactNode;\n\n return { layerIds, parsedChildren };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAE1B,SAAS,eAAe,oBAAoB;AAC5C,SAAS,mBAAmB,wBAAwB;AACpD,SAAS,mBAAmB,wBAAwB;AACpD,SAAS,YAAY,iBAAiB;AACtC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AAMzB,MAAM,SAAS,IAAI,QAGjB;AAAA,EACA,CAAC,aAAa,EAAE,WAAW,cAAc,QAAQ,SAAS,CAAC;AAAA,EAC3D,CAAC,UAAU,EAAE,WAAW,WAAW,QAAQ,MAAM,CAAC;AAAA,EAClD,CAAC,iBAAiB,EAAE,WAAW,kBAAkB,QAAQ,aAAa,CAAC;AAAA,EACvE,CAAC,iBAAiB,EAAE,WAAW,kBAAkB,QAAQ,aAAa,CAAC;AACzE,CAAC;AAOM,MAAM,cAAc,CAAC,aAA8B;AACxD,QAAM,WAAqB,CAAC;AAC5B,MAAI,QAAQ;AAEZ,QAAM,iBAAiB,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AAC7D,QAAI,UAAU,KAAK,GAAG;AACpB,cAAQ,MAAM,MAAM;AAAA,QAClB,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK,UAAU;AACb,gBAAM,QAAQ,OAAO,IAAI,MAAM,IAAI;AAEnC,gBAAM,UAAU,GAAG,OAAO,MAAM,IAAI,KAAK;AACzC,mBAAS;AAET,mBAAS,KAAK,OAAO;AAErB,gBAAM,WAKF;AAAA,YACF,GAAG,MAAM;AAAA,YACT;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,KAAK;AAAA,YACL,OAAO;AAAA,YACP,MAAM,OAAO;AAAA,UACf;AAAA,QACF;AAAA,QACA,SAAS;AACP,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,EAAE,UAAU,eAAe;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2023 Dynatrace LLC
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
import { useEffect, useRef } from "react";
|
|
17
2
|
const useMapPerformance = (mapContainerRef) => {
|
|
18
3
|
const isDev = true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/hooks/use-map-performance.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "AAAA
|
|
4
|
+
"sourcesContent": ["import { useEffect, useRef } from 'react';\n\nexport const useMapPerformance = (\n mapContainerRef: React.RefObject<HTMLDivElement>,\n) => {\n const isDev = process.env.NODE_ENV === 'development';\n const isRendered = useRef(false);\n let startTime: number | null;\n\n const onRenderHandler = isDev\n ? () => {\n if (!isRendered.current) {\n if (!startTime) {\n startTime = performance.now();\n } else {\n mapContainerRef.current?.setAttribute(\n 'data-render',\n (performance.now() - startTime).toString(),\n );\n }\n }\n }\n : undefined;\n\n const onLoadHandler = isDev\n ? () => {\n startTime = null;\n isRendered.current = true;\n }\n : undefined;\n\n useEffect(\n () => () => {\n if (isDev) {\n isRendered.current = false;\n }\n },\n [isDev],\n );\n\n return {\n onLoadHandler,\n onRenderHandler,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW,cAAc;AAE3B,MAAM,oBAAoB,CAC/B,oBACG;AACH,QAAM,QAAQ;AACd,QAAM,aAAa,OAAO,KAAK;AAC/B,MAAI;AAEJ,QAAM,kBAAkB,QACpB,MAAM;AACJ,QAAI,CAAC,WAAW,SAAS;AACvB,UAAI,CAAC,WAAW;AACd,oBAAY,YAAY,IAAI;AAAA,MAC9B,OAAO;AACL,wBAAgB,SAAS;AAAA,UACvB;AAAA,WACC,YAAY,IAAI,IAAI,WAAW,SAAS;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF,IACA;AAEJ,QAAM,gBAAgB,QAClB,MAAM;AACJ,gBAAY;AACZ,eAAW,UAAU;AAAA,EACvB,IACA;AAEJ;AAAA,IACE,MAAM,MAAM;AACV,UAAI,OAAO;AACT,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/map/MapView.js
CHANGED
|
@@ -78,15 +78,16 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
78
78
|
}
|
|
79
79
|
}));
|
|
80
80
|
const config = (0, import_iterate_config_slots.iterateConfigSlots)(children);
|
|
81
|
-
const
|
|
81
|
+
const isLegendHidden = !config.legend || !!config.legend.hidden;
|
|
82
|
+
const legendPosition = config.legend?.position;
|
|
83
|
+
const legendRatio = config.legend?.ratio;
|
|
84
|
+
const legendOnRatioChange = config.legend?.onRatioChange;
|
|
82
85
|
const { errorState } = (0, import_get_map_states_template.getMapStatesTemplates)(children);
|
|
83
86
|
const {
|
|
84
87
|
isLoading: isLoadingSettings,
|
|
85
88
|
isMapEnabled,
|
|
86
89
|
countryCode
|
|
87
90
|
} = (0, import_use_map_settings.useMapSettings)();
|
|
88
|
-
const { position: legendPosition } = config.legend ?? { position: "auto" };
|
|
89
|
-
const legendRatio = config?.legend?.type === "sequential" || config?.legend?.type === "threshold" ? import_constants.DEFAULT_MAP_LEGEND_RATIO : void 0;
|
|
90
91
|
const chartHeight = (0, import_charts._coerceSizeValue)(props.height) || import_constants.DEFAULT_MAP_HEIGHT;
|
|
91
92
|
const containerStyles = { width: "100%", ...costumerStyle };
|
|
92
93
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -104,12 +105,13 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
104
105
|
showLoader: loading || isLoadingSettings
|
|
105
106
|
},
|
|
106
107
|
/* @__PURE__ */ import_react.default.createElement(import_charts._ChartLayout.Graph, null, !isLoadingSettings && /* @__PURE__ */ import_react.default.createElement(import_MapContent.MapContent, { ref: rootRef, ...remaining }, parsedChildren)),
|
|
107
|
-
!
|
|
108
|
+
!isLegendHidden && /* @__PURE__ */ import_react.default.createElement(
|
|
108
109
|
import_charts._ChartLayout.Legend,
|
|
109
110
|
{
|
|
110
111
|
position: legendPosition,
|
|
111
112
|
ratio: legendRatio,
|
|
112
|
-
ratioBoundaries: import_constants.DEFAULT_LEGEND_SIZES
|
|
113
|
+
ratioBoundaries: import_constants.DEFAULT_LEGEND_SIZES,
|
|
114
|
+
onResize: legendOnRatioChange
|
|
113
115
|
},
|
|
114
116
|
/* @__PURE__ */ import_react.default.createElement(import_MapLegendRenderer.MapLegendRenderer, null)
|
|
115
117
|
)
|
package/map/constants.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ export declare const DEFAULT_COUNTRY_CODE = "default";
|
|
|
11
11
|
export declare const FIT_BOUNDS_OPTIONS: {
|
|
12
12
|
padding: number;
|
|
13
13
|
};
|
|
14
|
-
export declare const DEFAULT_MAP_HEIGHT =
|
|
14
|
+
export declare const DEFAULT_MAP_HEIGHT = 400;
|
|
15
15
|
export declare const DEFAULT_MAP_LEGEND_RATIO = 12;
|
|
16
|
+
export declare const DEFAULT_MAP_POSITION = "auto";
|
|
16
17
|
export declare const DEFAULT_INPUT_ICON_SIZE = 20;
|
|
17
18
|
export declare const ACTIVE_COLOR: string;
|
|
18
19
|
export declare const BASE_LAYER_IDS: string[];
|
package/map/constants.js
CHANGED
|
@@ -53,6 +53,7 @@ __export(constants_exports, {
|
|
|
53
53
|
DEFAULT_LINE_THICKNESS: () => DEFAULT_LINE_THICKNESS,
|
|
54
54
|
DEFAULT_MAP_HEIGHT: () => DEFAULT_MAP_HEIGHT,
|
|
55
55
|
DEFAULT_MAP_LEGEND_RATIO: () => DEFAULT_MAP_LEGEND_RATIO,
|
|
56
|
+
DEFAULT_MAP_POSITION: () => DEFAULT_MAP_POSITION,
|
|
56
57
|
DEFAULT_RADIUS: () => DEFAULT_RADIUS,
|
|
57
58
|
DEFAULT_RADIUS_EXPRESSION: () => DEFAULT_RADIUS_EXPRESSION,
|
|
58
59
|
DEFAULT_RANGE_COLOR: () => DEFAULT_RANGE_COLOR,
|
|
@@ -93,8 +94,9 @@ const WHOLE_WORLD_VIEW_BOUNDARIES = [
|
|
|
93
94
|
];
|
|
94
95
|
const DEFAULT_COUNTRY_CODE = "default";
|
|
95
96
|
const FIT_BOUNDS_OPTIONS = { padding: 20 };
|
|
96
|
-
const DEFAULT_MAP_HEIGHT =
|
|
97
|
+
const DEFAULT_MAP_HEIGHT = 400;
|
|
97
98
|
const DEFAULT_MAP_LEGEND_RATIO = 12;
|
|
99
|
+
const DEFAULT_MAP_POSITION = "auto";
|
|
98
100
|
const DEFAULT_INPUT_ICON_SIZE = 20;
|
|
99
101
|
const ACTIVE_COLOR = import_colors.default.Border.Neutral.AccentActive;
|
|
100
102
|
const BASE_LAYER_IDS = ["geojson-line", "geojson-fill"];
|
|
@@ -140,7 +142,7 @@ const DEFAULT_LINE_DASH_ARRAY = [5, 2.5];
|
|
|
140
142
|
const MIN_LINE_THICKNESS = 1;
|
|
141
143
|
const MAX_LINE_THICKNESS = 64;
|
|
142
144
|
const DIRECTION_ICON_OUTPUT_SIZE = 128;
|
|
143
|
-
const DIRECTION_ICON_SHRINK_RATIO = 1 /
|
|
145
|
+
const DIRECTION_ICON_SHRINK_RATIO = 1 / 15;
|
|
144
146
|
const ACTIVE_STATE_BORDERS_WIDTH = 1.8;
|
|
145
147
|
const DEFAULT_CHOROPLETH_COLOR = import_colors.default.Charts.Sequential.Blue.Color05.Default;
|
|
146
148
|
const COPY_TO_CLIPBOARD_MESSAGES = (0, import_react_intl.defineMessages)({
|
|
@@ -78,6 +78,8 @@ const iterateConfigSlots = (children) => {
|
|
|
78
78
|
legend: {
|
|
79
79
|
type: "sequential",
|
|
80
80
|
colorPalette: import_constants.DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,
|
|
81
|
+
position: import_constants.DEFAULT_MAP_POSITION,
|
|
82
|
+
ratio: import_constants.DEFAULT_MAP_LEGEND_RATIO,
|
|
81
83
|
...legend
|
|
82
84
|
}
|
|
83
85
|
};
|
|
@@ -89,6 +91,7 @@ const iterateConfigSlots = (children) => {
|
|
|
89
91
|
...slots,
|
|
90
92
|
legend: {
|
|
91
93
|
type: "categorical",
|
|
94
|
+
position: import_constants.DEFAULT_MAP_POSITION,
|
|
92
95
|
...legend
|
|
93
96
|
}
|
|
94
97
|
};
|
|
@@ -100,6 +103,8 @@ const iterateConfigSlots = (children) => {
|
|
|
100
103
|
...slots,
|
|
101
104
|
legend: {
|
|
102
105
|
type: "threshold",
|
|
106
|
+
position: import_constants.DEFAULT_MAP_POSITION,
|
|
107
|
+
ratio: import_constants.DEFAULT_MAP_LEGEND_RATIO,
|
|
103
108
|
...legend
|
|
104
109
|
}
|
|
105
110
|
};
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2023 Dynatrace LLC
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
export declare const useMapPerformance: (mapContainerRef: React.RefObject<HTMLDivElement>) => {
|
|
17
2
|
onLoadHandler: (() => void) | undefined;
|
|
18
3
|
onRenderHandler: (() => void) | undefined;
|
|
@@ -21,21 +21,6 @@ __export(use_map_performance_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(use_map_performance_exports);
|
|
23
23
|
var import_react = require("react");
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2023 Dynatrace LLC
|
|
27
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
28
|
-
* you may not use this file except in compliance with the License.
|
|
29
|
-
* You may obtain a copy of the License at
|
|
30
|
-
*
|
|
31
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
32
|
-
*
|
|
33
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
34
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
35
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36
|
-
* See the License for the specific language governing permissions and
|
|
37
|
-
* limitations under the License.
|
|
38
|
-
*/
|
|
39
24
|
const useMapPerformance = (mapContainerRef) => {
|
|
40
25
|
const isDev = true;
|
|
41
26
|
const isRendered = (0, import_react.useRef)(false);
|
package/map/types/legend.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type { ColoredRange, ColorPalette,
|
|
1
|
+
import type { ColoredRange, ColorPalette, LegendProps } from '@dynatrace/strato-components-preview/charts';
|
|
2
2
|
/** The props common to all different legends */
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* The legend position relative to the map
|
|
6
|
-
* @defaultValue 'auto'
|
|
7
|
-
*/
|
|
8
|
-
position?: LegendPosition;
|
|
9
|
-
/**
|
|
10
|
-
* Hides the legend while keeping the coloring
|
|
11
|
-
* @defaultValue false
|
|
12
|
-
*/
|
|
13
|
-
hidden?: boolean;
|
|
14
|
-
}
|
|
3
|
+
export type BaseLegendProps = Omit<LegendProps, 'resizable'>;
|
|
15
4
|
/** The sequential legend props */
|
|
16
5
|
export interface SequentialLegendProps extends BaseLegendProps {
|
|
17
6
|
/** The min boundary */
|
|
@@ -34,18 +23,7 @@ export interface ThresholdLegendProps extends BaseLegendProps {
|
|
|
34
23
|
ranges: ColoredRange[];
|
|
35
24
|
}
|
|
36
25
|
/** The internal configs common to all different legends */
|
|
37
|
-
export
|
|
38
|
-
/**
|
|
39
|
-
* The legend position relative to the map
|
|
40
|
-
* @defaultValue 'auto'
|
|
41
|
-
*/
|
|
42
|
-
position: LegendPosition;
|
|
43
|
-
/**
|
|
44
|
-
* Hides the legend while keeping the coloring
|
|
45
|
-
* @defaultValue 'false'
|
|
46
|
-
*/
|
|
47
|
-
hidden: boolean;
|
|
48
|
-
}
|
|
26
|
+
export type BaseLegendConfig = Omit<LegendProps, 'resizable'>;
|
|
49
27
|
/** The sequential legend internal config */
|
|
50
28
|
export interface SequentialLegendConfig extends BaseLegendConfig {
|
|
51
29
|
type: 'sequential';
|
package/map/types/map-view.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-geo",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"lang": "lang/uncompiled",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"mapbox-gl": "npm:empty-npm-package@1.0.0",
|
|
40
40
|
"maplibre-gl": "^3.1.0",
|
|
41
41
|
"react-map-gl": "^7.1.7",
|
|
42
|
-
"@dynatrace/strato-design-tokens": "0.20.
|
|
42
|
+
"@dynatrace/strato-design-tokens": "0.20.30",
|
|
43
43
|
"@dynatrace/strato-icons": "0.37.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -49,7 +49,7 @@
|
|
|
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.17"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": [
|
|
55
55
|
"./map/styles/react-mapgl-styles.css",
|