@dynatrace/strato-geo 1.0.3 → 1.2.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/index.js.map +2 -2
- package/esm/map/MapView.js +14 -10
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleCircleLayer.js +6 -6
- package/esm/map/components/BubbleLayer/BubbleCircleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleLayer.js +1 -1
- package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/BubbleOutlineLayer.js +1 -1
- package/esm/map/components/BubbleLayer/BubbleOutlineLayer.js.map +2 -2
- package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +47 -24
- package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
- package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +2 -1
- package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js +30 -48
- package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerDirection.js +10 -3
- package/esm/map/components/ConnectionLayer/ConnectionLayerDirection.js.map +2 -2
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +44 -0
- package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +7 -0
- package/esm/map/components/ConnectionLayer/utils/{get-arc-line-features.js → get-arc-line-feature.js} +4 -8
- package/esm/map/components/ConnectionLayer/utils/{get-arc-line-features.js.map → get-arc-line-feature.js.map} +3 -3
- package/esm/map/components/ConnectionLayer/utils/get-straight-line-feature.js +11 -0
- package/esm/map/components/ConnectionLayer/utils/get-straight-line-feature.js.map +7 -0
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +24 -19
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.js.map +1 -1
- package/esm/map/components/DotLayer/BackgroundLayer.js +1 -1
- package/esm/map/components/DotLayer/BackgroundLayer.js.map +2 -2
- package/esm/map/components/DotLayer/DotLayer.js +5 -5
- package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
- package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js.map +2 -2
- package/esm/map/components/MapContent.js +33 -7
- package/esm/map/components/MapContent.js.map +2 -2
- package/esm/map/components/MapUnavailable.js +2 -2
- package/esm/map/components/MapUnavailable.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapResetButton.js +1 -1
- package/esm/map/components/toolbar/buttons/MapResetButton.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js +1 -1
- package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js +1 -1
- package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js.map +2 -2
- package/esm/map/constants.js +23 -17
- package/esm/map/constants.js.map +2 -2
- package/esm/map/contexts/map-data-bounding-box.context.js +2 -2
- package/esm/map/contexts/map-data-bounding-box.context.js.map +2 -2
- package/esm/map/hooks/use-active-interaction.js +14 -1
- package/esm/map/hooks/use-active-interaction.js.map +2 -2
- package/esm/map/hooks/use-attach-image-from-icon.js +4 -1
- package/esm/map/hooks/use-attach-image-from-icon.js.map +2 -2
- package/esm/map/hooks/use-attach-symbol-to-map.js +2 -2
- package/esm/map/hooks/use-attach-symbol-to-map.js.map +2 -2
- package/esm/map/hooks/use-hover-interaction.js +1 -1
- package/esm/map/hooks/use-hover-interaction.js.map +2 -2
- package/esm/map/hooks/use-legend-interaction-highlighting.js +30 -1
- package/esm/map/hooks/use-legend-interaction-highlighting.js.map +2 -2
- package/esm/map/hooks/use-legend-interaction-visibility.js +10 -1
- package/esm/map/hooks/use-legend-interaction-visibility.js.map +2 -2
- package/esm/map/hooks/use-load-map-base-layer.js +4 -4
- package/esm/map/hooks/use-load-map-base-layer.js.map +2 -2
- package/esm/map/hooks/use-map-mouse-move.js +1 -1
- package/esm/map/hooks/use-map-mouse-move.js.map +2 -2
- package/esm/map/hooks/use-resolve-color.js +4 -0
- package/esm/map/hooks/use-resolve-color.js.map +2 -2
- package/esm/map/providers/imperative-handler.provider.js +1 -1
- package/esm/map/providers/imperative-handler.provider.js.map +2 -2
- package/esm/map/providers/map-initial-view.provider.js +1 -1
- package/esm/map/providers/map-initial-view.provider.js.map +2 -2
- package/esm/map/slots/BaseLayer.js.map +2 -2
- package/esm/map/slots/BubbleLayer.js.map +2 -2
- package/esm/map/slots/CategoricalLegend.js.map +2 -2
- package/esm/map/slots/ChartInteractions.js +3 -3
- package/esm/map/slots/ChartInteractions.js.map +2 -2
- package/esm/map/slots/ChoroplethLayer.js.map +2 -2
- package/esm/map/slots/ConnectionLayer.js.map +2 -2
- package/esm/map/slots/DotLayer.js.map +2 -2
- package/esm/map/slots/SequentialLegend.js.map +2 -2
- package/esm/map/slots/ThresholdLegend.js.map +2 -2
- package/esm/map/slots/states/ErrorStateSlot.js.map +2 -2
- package/esm/map/types/bubble-layer.js.map +2 -2
- package/esm/map/types/coloring.js.map +2 -2
- package/esm/map/utils/attach-image-from-shape.js +3 -0
- package/esm/map/utils/attach-image-from-shape.js.map +2 -2
- package/esm/map/utils/attach-image-from-string.js.map +1 -1
- package/esm/map/utils/attach-image-from-text.js.map +1 -1
- package/esm/map/utils/attach-image-to-map.js +12 -5
- package/esm/map/utils/attach-image-to-map.js.map +2 -2
- package/esm/map/utils/build-scale-from-legend-config.js +5 -1
- package/esm/map/utils/build-scale-from-legend-config.js.map +2 -2
- package/esm/map/utils/create-categorical-color-scheme-from-custom-color-object.js +17 -0
- package/esm/map/utils/create-categorical-color-scheme-from-custom-color-object.js.map +7 -0
- package/esm/map/utils/extract-layers-data.js +50 -13
- package/esm/map/utils/extract-layers-data.js.map +2 -2
- package/esm/map/utils/iterate-config-slots.js +4 -2
- package/esm/map/utils/iterate-config-slots.js.map +2 -2
- package/esm/map/utils/set-layers-id.js +12 -4
- package/esm/map/utils/set-layers-id.js.map +2 -2
- package/esm/map/utils/tooltip-type-guards.js +1 -1
- package/esm/map/utils/tooltip-type-guards.js.map +2 -2
- package/esm/map/utils/use-set-map-initial-configuration.js.map +2 -2
- package/index.d.ts +2 -2
- package/map/MapView.d.ts +1 -1
- package/map/MapView.js +13 -9
- package/map/components/BubbleLayer/BubbleCircleLayer.js +5 -5
- package/map/components/BubbleLayer/BubbleLayer.js +2 -2
- package/map/components/BubbleLayer/BubbleOutlineLayer.js +2 -2
- package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.d.ts +2 -18
- package/map/components/ChoroplethLayer/ChoroplethLayer.d.ts +1 -1
- package/map/components/ChoroplethLayer/ChoroplethLayer.js +42 -22
- package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +2 -1
- package/map/components/ConnectionLayer/ConnectionLayer.d.ts +2 -2
- package/map/components/ConnectionLayer/ConnectionLayer.js +29 -41
- package/map/components/ConnectionLayer/ConnectionLayerDirection.d.ts +1 -1
- package/map/components/ConnectionLayer/ConnectionLayerDirection.js +9 -4
- package/map/components/ConnectionLayer/ConnectionLayerLine.d.ts +12 -0
- package/map/components/ConnectionLayer/ConnectionLayerLine.js +66 -0
- package/map/components/ConnectionLayer/utils/{get-arc-line-features.d.ts → get-arc-line-feature.d.ts} +1 -1
- package/map/components/ConnectionLayer/utils/{get-arc-line-features.js → get-arc-line-feature.js} +6 -10
- package/map/components/ConnectionLayer/utils/{get-straight-line-features.d.ts → get-straight-line-feature.d.ts} +1 -1
- package/map/components/ConnectionLayer/utils/{get-straight-line-features.js → get-straight-line-feature.js} +6 -7
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.d.ts +1 -1
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +24 -19
- package/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.d.ts +1 -1
- package/map/components/DotLayer/BackgroundLayer.js +2 -2
- package/map/components/DotLayer/DotLayer.js +5 -5
- package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.d.ts +2 -19
- package/map/components/MapContent.d.ts +5 -1
- package/map/components/MapContent.js +28 -8
- package/map/components/MapUnavailable.d.ts +2 -2
- package/map/components/MapUnavailable.js +2 -2
- package/map/components/toolbar/buttons/MapResetButton.js +2 -2
- package/map/components/toolbar/buttons/MapZoomInOutButtons.js +2 -2
- package/map/components/toolbar/buttons/MapZoomToFitButton.js +2 -2
- package/map/constants.d.ts +13 -10
- package/map/constants.js +23 -17
- package/map/contexts/map-data-bounding-box.context.js +1 -1
- package/map/hooks/use-active-interaction.js +15 -2
- package/map/hooks/use-attach-image-from-icon.js +5 -2
- package/map/hooks/use-attach-symbol-to-map.js +2 -2
- package/map/hooks/use-hover-interaction.js +2 -2
- package/map/hooks/use-legend-interaction-highlighting.d.ts +2 -1
- package/map/hooks/use-legend-interaction-highlighting.js +31 -2
- package/map/hooks/use-legend-interaction-visibility.d.ts +2 -1
- package/map/hooks/use-legend-interaction-visibility.js +11 -2
- package/map/hooks/use-load-map-base-layer.d.ts +1 -1
- package/map/hooks/use-load-map-base-layer.js +4 -4
- package/map/hooks/use-map-mouse-move.js +2 -2
- package/map/hooks/use-resolve-color.d.ts +4 -2
- package/map/hooks/use-resolve-color.js +4 -0
- package/map/providers/imperative-handler.provider.js +2 -2
- package/map/providers/map-initial-view.provider.js +2 -2
- package/map/slots/BaseLayer.d.ts +4 -1
- package/map/slots/BubbleLayer.d.ts +1 -0
- package/map/slots/CategoricalLegend.d.ts +4 -1
- package/map/slots/ChartInteractions.d.ts +4 -1
- package/map/slots/ChartInteractions.js +3 -3
- package/map/slots/ChoroplethLayer.d.ts +1 -0
- package/map/slots/ConnectionLayer.d.ts +2 -1
- package/map/slots/DotLayer.d.ts +1 -0
- package/map/slots/SequentialLegend.d.ts +4 -1
- package/map/slots/ThresholdLegend.d.ts +4 -1
- package/map/slots/states/ErrorStateSlot.d.ts +6 -0
- package/map/types/base-layer.d.ts +4 -0
- package/map/types/bubble-layer.d.ts +4 -0
- package/map/types/choropleth-layer.d.ts +2 -0
- package/map/types/coloring.d.ts +16 -0
- package/map/types/connection-layer.d.ts +11 -7
- package/map/types/dot-layer.d.ts +2 -0
- package/map/types/legend.d.ts +18 -6
- package/map/types/location.d.ts +4 -1
- package/map/types/map-view.d.ts +10 -1
- package/map/types/shapes.d.ts +5 -1
- package/map/types/toolbar.d.ts +4 -1
- package/map/types/tooltip.d.ts +16 -1
- package/map/utils/attach-image-from-shape.d.ts +1 -1
- package/map/utils/attach-image-from-shape.js +3 -0
- package/map/utils/attach-image-from-string.d.ts +1 -1
- package/map/utils/attach-image-from-text.d.ts +1 -1
- package/map/utils/attach-image-to-map.d.ts +1 -1
- package/map/utils/attach-image-to-map.js +12 -5
- package/map/utils/build-scale-from-legend-config.js +5 -1
- package/map/utils/create-categorical-color-scheme-from-custom-color-object.d.ts +5 -0
- package/map/utils/create-categorical-color-scheme-from-custom-color-object.js +35 -0
- package/map/utils/extract-layers-data.d.ts +3 -2
- package/map/utils/extract-layers-data.js +50 -13
- package/map/utils/iterate-config-slots.d.ts +2 -1
- package/map/utils/iterate-config-slots.js +4 -2
- package/map/utils/set-layers-id.d.ts +1 -1
- package/map/utils/set-layers-id.js +12 -4
- package/map/utils/tooltip-type-guards.js +1 -1
- package/map/utils/use-set-map-initial-configuration.d.ts +1 -1
- package/package.json +8 -9
- package/esm/map/components/ConnectionLayer/utils/get-straight-line-features.js +0 -12
- package/esm/map/components/ConnectionLayer/utils/get-straight-line-features.js.map +0 -7
package/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { ChartInteractions } from './map/slots/ChartInteractions.js';\nexport { MapView } from './map/MapView.js';\nexport { ConnectionLayer } from './map/slots/ConnectionLayer.js';\nexport { DotLayer } from './map/slots/DotLayer.js';\nexport { BubbleLayer } from './map/slots/BubbleLayer.js';\nexport { BaseLayer } from './map/slots/BaseLayer.js';\nexport { ChoroplethLayer } from './map/slots/ChoroplethLayer.js';\nexport { Tooltip, TooltipAtoms } from './map/slots/Tooltip.js';\n\nexport type {\n MapViewProps,\n MapViewBaseProps,\n MapViewUncontrolledProps,\n MapViewControlledProps,\n DisallowAll,\n ViewState,\n MapViewRef,\n} from './map/types/map-view.js';\n\nexport type { BaseLayerProps } from './map/types/base-layer.js';\n\nexport type {\n Connection,\n ConnectionLayerProps,\n CurvedLine,\n} from './map/types/connection-layer.js';\n\nexport type {\n DotLayerBaseProps,\n DotLayerProps,\n} from './map/types/dot-layer.js';\n\nexport type {\n BubbleLayerBaseProps,\n BubbleLayerProps,\n ScaleNoneProps,\n ScaleRadiusProps,\n} from './map/types/bubble-layer.js';\n\nexport type {\n ChoroplethLayerBaseProps,\n ChoroplethLayerProps,\n} from './map/types/choropleth-layer.js';\n\nexport type { Location } from './map/types/location.js';\nexport type { MapShape } from './map/types/shapes.js';\nexport type { ChartInteractionsProps } from './map/types/toolbar.js';\nexport type { ErrorStateSlotProps } from './map/slots/states/ErrorStateSlot.js';\n\nexport type {\n BaseLegendProps,\n CategoricalLegendProps,\n SequentialLegendProps,\n ThresholdLegendProps,\n} from './map/types/legend.js';\n\nexport type {\n LocationColorProps,\n LegendColorLayerProps,\n ChoroplethCustomColorProps,\n} from './map/types/coloring.js';\n\nexport { SequentialLegend } from './map/slots/SequentialLegend.js';\nexport { ThresholdLegend } from './map/slots/ThresholdLegend.js';\nexport { CategoricalLegend } from './map/slots/CategoricalLegend.js';\n\nexport type {\n BubbleLayerTooltipHandler,\n BubbleLayerTooltipHandlerProps,\n DotLayerTooltipHandler,\n DotLayerTooltipHandlerProps,\n ConnectionLayerTooltipHandler,\n ConnectionLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandler,\n ChartTooltip,\n DotLayerTooltipData,\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n ChoroplethLayerTooltipData,\n} from './map/types/tooltip.js';\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["export { ChartInteractions } from './map/slots/ChartInteractions.js';\nexport { MapView } from './map/MapView.js';\nexport { ConnectionLayer } from './map/slots/ConnectionLayer.js';\nexport { DotLayer } from './map/slots/DotLayer.js';\nexport { BubbleLayer } from './map/slots/BubbleLayer.js';\nexport { BaseLayer } from './map/slots/BaseLayer.js';\nexport { ChoroplethLayer } from './map/slots/ChoroplethLayer.js';\nexport { Tooltip, TooltipAtoms } from './map/slots/Tooltip.js';\n\nexport type {\n MapViewProps,\n MapViewBaseProps,\n MapViewUncontrolledProps,\n MapViewControlledProps,\n DisallowAll,\n ViewState,\n MapViewRef,\n} from './map/types/map-view.js';\n\nexport type { BaseLayerProps } from './map/types/base-layer.js';\n\nexport type {\n Connection,\n ConnectionLayerBaseProps,\n ConnectionLayerProps,\n CurvedLine,\n} from './map/types/connection-layer.js';\n\nexport type {\n DotLayerBaseProps,\n DotLayerProps,\n} from './map/types/dot-layer.js';\n\nexport type {\n BubbleLayerBaseProps,\n BubbleLayerProps,\n ScaleNoneProps,\n ScaleRadiusProps,\n} from './map/types/bubble-layer.js';\n\nexport type {\n ChoroplethLayerBaseProps,\n ChoroplethLayerProps,\n} from './map/types/choropleth-layer.js';\n\nexport type { Location } from './map/types/location.js';\nexport type { MapShape } from './map/types/shapes.js';\nexport type { ChartInteractionsProps } from './map/types/toolbar.js';\nexport type { ErrorStateSlotProps } from './map/slots/states/ErrorStateSlot.js';\n\nexport type {\n BaseLegendProps,\n CategoricalLegendProps,\n SequentialLegendProps,\n ThresholdLegendProps,\n} from './map/types/legend.js';\n\nexport type {\n LocationColorProps,\n LegendColorLayerProps,\n ChoroplethCustomColorProps,\n ConnectionColorProps,\n} from './map/types/coloring.js';\n\nexport { SequentialLegend } from './map/slots/SequentialLegend.js';\nexport { ThresholdLegend } from './map/slots/ThresholdLegend.js';\nexport { CategoricalLegend } from './map/slots/CategoricalLegend.js';\n\nexport type {\n BubbleLayerTooltipHandler,\n BubbleLayerTooltipHandlerProps,\n DotLayerTooltipHandler,\n DotLayerTooltipHandlerProps,\n ConnectionLayerTooltipHandler,\n ConnectionLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandler,\n ChartTooltip,\n DotLayerTooltipData,\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n ChoroplethLayerTooltipData,\n} from './map/types/tooltip.js';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,SAAS,oBAAoB;AAyDtC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/esm/map/MapView.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import React, { forwardRef, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
_ChartLayout as ChartLayout,
|
|
4
4
|
_coerceSizeValue as coerceSizeValue,
|
|
@@ -40,22 +40,25 @@ const _MapView = forwardRef(
|
|
|
40
40
|
truncationMode,
|
|
41
41
|
...remaining
|
|
42
42
|
} = props;
|
|
43
|
-
const { layerIds, parsedChildren,
|
|
44
|
-
const {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const { layerIds, parsedChildren, valueAccessors } = setLayersId(children);
|
|
44
|
+
const {
|
|
45
|
+
flattenData: layersData,
|
|
46
|
+
categories,
|
|
47
|
+
legendDomain
|
|
48
|
+
} = extractLayersData(parsedChildren, valueAccessors);
|
|
49
|
+
const config = iterateConfigSlots(children, legendDomain);
|
|
49
50
|
const isLegendHidden = !config.legend || !!config.legend.hidden;
|
|
50
51
|
const legendPosition = config.legend?.position;
|
|
51
52
|
const legendRatio = config.legend?.ratio;
|
|
52
53
|
const legendOnRatioChange = config.legend?.onRatioChange;
|
|
53
|
-
const { isMapEnabled,
|
|
54
|
+
const { isMapEnabled, isFetchingFeatures, baseFeatureCollection, error } = useLoadMapBaseLayer(config.baseLayer);
|
|
55
|
+
const [isMapLoaded, setIsMapLoaded] = useState(false);
|
|
54
56
|
const { errorState } = getMapStatesTemplates(children);
|
|
55
57
|
const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;
|
|
56
58
|
const containerStyles = { width: "100%", ...costumerStyle };
|
|
57
59
|
const chartLayoutRef = useAutoLegendRefresh(layersData);
|
|
58
|
-
const mapUnavailable = !
|
|
60
|
+
const mapUnavailable = !isFetchingFeatures && !isMapEnabled || error;
|
|
61
|
+
const isLoading = isFetchingFeatures || !isMapLoaded;
|
|
59
62
|
return /* @__PURE__ */ React.createElement(
|
|
60
63
|
"div",
|
|
61
64
|
{
|
|
@@ -67,7 +70,7 @@ const _MapView = forwardRef(
|
|
|
67
70
|
mapUnavailable ? /* @__PURE__ */ React.createElement(
|
|
68
71
|
MapUnavailable,
|
|
69
72
|
{
|
|
70
|
-
|
|
73
|
+
isFetchingFeatures,
|
|
71
74
|
isDisabled: !isMapEnabled,
|
|
72
75
|
chartHeight,
|
|
73
76
|
error
|
|
@@ -94,6 +97,7 @@ const _MapView = forwardRef(
|
|
|
94
97
|
MapContent,
|
|
95
98
|
{
|
|
96
99
|
ref: forwardedRef,
|
|
100
|
+
onMapLoad: () => setIsMapLoaded(true),
|
|
97
101
|
...remaining
|
|
98
102
|
},
|
|
99
103
|
parsedChildren
|
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, { forwardRef, type PropsWithChildren } 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} 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 { 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';\n\n// eslint-disable-next-line no-restricted-imports\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,
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,
|
|
4
|
+
"sourcesContent": ["import React, { 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} 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 { 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';\n\n// eslint-disable-next-line no-restricted-imports\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 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-testid=\"mapview-container\"\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 categories={categories}>\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": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { Layer } from "@vis.gl/react-maplibre";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import { Layer } from "react-map-gl/maplibre";
|
|
3
3
|
import { useSizeInterpolation } from "./hooks/use-size-interpolation.js";
|
|
4
4
|
import { buildCircleStickToDistanceExpression } from "./utils/build-stick-to-distance-expressions.js";
|
|
5
5
|
import {
|
|
6
6
|
BUBBLE_DEFAULT_OPACITY,
|
|
7
7
|
BUBBLE_STROKE,
|
|
8
8
|
DEFAULT_RADIUS_EXPRESSION,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
SHAPE_OPACITY_DIMMED,
|
|
10
|
+
SHAPE_OPACITY_DEFAULT
|
|
11
11
|
} from "../../constants.js";
|
|
12
12
|
const BubbleCircleLayer = ({
|
|
13
13
|
id,
|
|
@@ -33,7 +33,7 @@ const BubbleCircleLayer = ({
|
|
|
33
33
|
"case",
|
|
34
34
|
["boolean", ["feature-state", "legendHover"], true],
|
|
35
35
|
BUBBLE_DEFAULT_OPACITY,
|
|
36
|
-
|
|
36
|
+
SHAPE_OPACITY_DIMMED
|
|
37
37
|
],
|
|
38
38
|
"circle-stroke-width": BUBBLE_STROKE,
|
|
39
39
|
"circle-stroke-color": [
|
|
@@ -45,8 +45,8 @@ const BubbleCircleLayer = ({
|
|
|
45
45
|
"circle-stroke-opacity": [
|
|
46
46
|
"case",
|
|
47
47
|
["boolean", ["feature-state", "legendHover"], true],
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
SHAPE_OPACITY_DEFAULT,
|
|
49
|
+
SHAPE_OPACITY_DIMMED
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/BubbleLayer/BubbleCircleLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { Layer } from '@vis.gl/react-maplibre';\nimport React from 'react';\n\nimport { useSizeInterpolation } from './hooks/use-size-interpolation.js';\nimport { buildCircleStickToDistanceExpression } from './utils/build-stick-to-distance-expressions.js';\nimport {\n BUBBLE_DEFAULT_OPACITY,\n BUBBLE_STROKE,\n DEFAULT_RADIUS_EXPRESSION,\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n} from '../../constants.js';\n\nexport const BubbleCircleLayer = ({\n id,\n source,\n}: {\n id: string;\n source: string;\n}) => {\n const sizeInterpolation = useSizeInterpolation();\n\n const radiusExpression =\n sizeInterpolation === 'fixed'\n ? DEFAULT_RADIUS_EXPRESSION\n : buildCircleStickToDistanceExpression();\n\n return (\n <Layer\n type=\"circle\"\n id={id}\n source={source}\n paint={{\n 'circle-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__hoveredColor'],\n ['get', '__color'],\n ],\n 'circle-radius': radiusExpression,\n 'circle-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n BUBBLE_DEFAULT_OPACITY,\n SHAPE_OPACITY_DIMMED,\n ],\n 'circle-stroke-width': BUBBLE_STROKE,\n 'circle-stroke-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n ['get', '__hoveredColor'],\n ['get', '__color'],\n ],\n 'circle-stroke-opacity': [\n 'case',\n ['boolean', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n SHAPE_OPACITY_DIMMED,\n ],\n }}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,WAAW;AAElB,SAAS,4BAA4B;AACrC,SAAS,4CAA4C;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AACF,MAGM;AACJ,QAAM,oBAAoB,qBAAqB;AAE/C,QAAM,mBACJ,sBAAsB,UAClB,4BACA,qCAAqC;AAE3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO;AAAA,QACL,gBAAgB;AAAA,UACd;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C,CAAC,OAAO,gBAAgB;AAAA,UACxB,CAAC,OAAO,SAAS;AAAA,QACnB;AAAA,QACA,iBAAiB;AAAA,QACjB,kBAAkB;AAAA,UAChB;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,UAClD;AAAA,UACA;AAAA,QACF;AAAA,QACA,uBAAuB;AAAA,QACvB,uBAAuB;AAAA,UACrB;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,OAAO,GAAG,KAAK;AAAA,UAC7C,CAAC,OAAO,gBAAgB;AAAA,UACxB,CAAC,OAAO,SAAS;AAAA,QACnB;AAAA,QACA,yBAAyB;AAAA,UACvB;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,aAAa,GAAG,IAAI;AAAA,UAClD;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Source } from "@vis.gl/react-maplibre";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import { Source } from "react-map-gl/maplibre";
|
|
3
3
|
import { BubbleCircleLayer } from "./BubbleCircleLayer.js";
|
|
4
4
|
import { BubbleLayerTooltip } from "./BubbleLayerTooltip.js";
|
|
5
5
|
import { BubbleOutlineLayer } from "./BubbleOutlineLayer.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/BubbleLayer/BubbleLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { Source } from '@vis.gl/react-maplibre';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { BubbleCircleLayer } from './BubbleCircleLayer.js';\nimport { BubbleLayerTooltip } from './BubbleLayerTooltip.js';\nimport { BubbleOutlineLayer } from './BubbleOutlineLayer.js';\nimport { SizeInterpolationContext } from './contexts/size-interpolation.context.js';\nimport { buildRadiusScale } from './utils/build-radius-scale.js';\nimport { parseBubbleDataToGeoJSON } from './utils/parse-bubble-data-to-geo-json.js';\nimport { DEFAULT_BUBBLE_COLOR, DEFAULT_RADIUS } from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useResolveLocationColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { BubbleLayerTooltip as BubbleLayerTooltipSlot } from '../../slots/BubbleLayerTooltip.js';\nimport {\n type InternalBubbleLayerProps,\n isScaleRadius,\n} from '../../types/bubble-layer.js';\nimport type { Location } from '../../types/location.js';\nimport { isBubbleTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\nexport const BubbleLayer = <T extends Location>(\n props: PropsWithChildren<InternalBubbleLayerProps<T>>,\n) => {\n const {\n data,\n layerId,\n radius = DEFAULT_RADIUS,\n children,\n sizeInterpolation = 'fixed',\n } = props;\n\n const colorParser = useLayerColoringStrategy();\n const bubbleColor = useResolveLocationColor(\n DEFAULT_BUBBLE_COLOR,\n props,\n colorParser,\n );\n\n const sourceId = `source-${layerId}`;\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n let radiusScale = (value: number) => value;\n\n if (isScaleRadius(props)) {\n const { radiusRange = [10, 100], radius, scale = 'linear' } = props;\n\n radiusScale = buildRadiusScale(data, radius, scale, radiusRange);\n }\n\n const dataGeoJson = parseBubbleDataToGeoJSON(\n data,\n bubbleColor,\n radius,\n radiusScale,\n );\n\n const tooltipTemplate = useTooltipTemplate(children, BubbleLayerTooltipSlot);\n\n return (\n <>\n <SizeInterpolationContext.Provider value={sizeInterpolation}>\n <Source id={sourceId} type=\"geojson\" data={dataGeoJson} generateId>\n <BubbleCircleLayer id={layerId} source={sourceId} />\n <BubbleOutlineLayer beforeId={layerId} source={sourceId} />\n </Source>\n </SizeInterpolationContext.Provider>\n\n <BubbleLayerTooltip\n layerId={layerId}\n tooltipTemplate={\n isBubbleTooltipTemplate(tooltipTemplate) ? tooltipTemplate : undefined\n }\n />\n </>\n );\n};\n\nBubbleLayer['displayName'] = 'BubbleLayer';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,WAAuC;AAE9C,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,sBAAsB,sBAAsB;AACrD,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,sCAAsC;AAC/C,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB,8BAA8B;AAC7D;AAAA,EAEE;AAAA,OACK;AAEP,SAAS,+BAA+B;AAEjC,MAAM,cAAc,CACzB,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,oBAAoB;AAAA,EACtB,IAAI;AAEJ,QAAM,cAAc,yBAAyB;AAC7C,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW,UAAU,OAAO;AAClC,mCAAiC,OAAO,QAAQ;AAChD,iCAA+B,OAAO,OAAO;AAE7C,MAAI,cAAc,CAAC,UAAkB;AAErC,MAAI,cAAc,KAAK,GAAG;AACxB,UAAM,EAAE,cAAc,CAAC,IAAI,GAAG,GAAG,QAAAA,SAAQ,QAAQ,SAAS,IAAI;AAE9D,kBAAc,iBAAiB,MAAMA,SAAQ,OAAO,WAAW;AAAA,EACjE;AAEA,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAAkB,mBAAmB,UAAU,sBAAsB;AAE3E,SACE,0DACE,oCAAC,yBAAyB,UAAzB,EAAkC,OAAO,qBACxC,oCAAC,UAAO,IAAI,UAAU,MAAK,WAAU,MAAM,aAAa,YAAU,QAChE,oCAAC,qBAAkB,IAAI,SAAS,QAAQ,UAAU,GAClD,oCAAC,sBAAmB,UAAU,SAAS,QAAQ,UAAU,CAC3D,CACF,GAEA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,iBACE,wBAAwB,eAAe,IAAI,kBAAkB;AAAA;AAAA,EAEjE,CACF;AAEJ;AAEA,YAAY,aAAa,IAAI;",
|
|
6
6
|
"names": ["radius"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Layer } from "@vis.gl/react-maplibre";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import { Layer } from "react-map-gl/maplibre";
|
|
3
3
|
import { _getCanvasColor as getCanvasColor } from "@dynatrace/strato-components-preview/charts";
|
|
4
4
|
import { useSizeInterpolation } from "./hooks/use-size-interpolation.js";
|
|
5
5
|
import { addOutlineSize } from "./utils/add-outline-size.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/BubbleLayer/BubbleOutlineLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { Layer } from '@vis.gl/react-maplibre';\nimport React from 'react';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { useSizeInterpolation } from './hooks/use-size-interpolation.js';\nimport { addOutlineSize } from './utils/add-outline-size.js';\nimport { buildOutlineStickToDistanceExpression } from './utils/build-stick-to-distance-expressions.js';\nimport {\n ACTIVE_COLOR,\n BUBBLE_OUTLINE_STROKE,\n DEFAULT_RADIUS_EXPRESSION,\n} from '../../constants.js';\n\nconst DEFAULT_OUTLINE_RADIUS_EXPRESSION = addOutlineSize(\n DEFAULT_RADIUS_EXPRESSION,\n);\n\nexport const BubbleOutlineLayer = ({\n beforeId,\n source,\n}: {\n beforeId: string;\n source: string;\n}) => {\n const sizeInterpolation = useSizeInterpolation();\n\n const outlineRadiusExpression =\n sizeInterpolation === 'fixed'\n ? DEFAULT_OUTLINE_RADIUS_EXPRESSION\n : buildOutlineStickToDistanceExpression();\n\n return (\n <Layer\n type=\"circle\"\n beforeId={beforeId}\n source={source}\n paint={{\n 'circle-radius': outlineRadiusExpression,\n 'circle-opacity': 0,\n 'circle-stroke-width': BUBBLE_OUTLINE_STROKE,\n 'circle-stroke-color': getCanvasColor(ACTIVE_COLOR),\n 'circle-stroke-opacity': [\n 'case',\n ['boolean', ['feature-state', 'active'], false],\n 1,\n 0,\n ],\n }}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,WAAW;AAElB,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,6CAA6C;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,oCAAoC;AAAA,EACxC;AACF;AAEO,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAGM;AACJ,QAAM,oBAAoB,qBAAqB;AAE/C,QAAM,0BACJ,sBAAsB,UAClB,oCACA,sCAAsC;AAE5C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO;AAAA,QACL,iBAAiB;AAAA,QACjB,kBAAkB;AAAA,QAClB,uBAAuB;AAAA,QACvB,uBAAuB,eAAe,YAAY;AAAA,QAClD,yBAAyB;AAAA,UACvB;AAAA,UACA,CAAC,WAAW,CAAC,iBAAiB,QAAQ,GAAG,KAAK;AAAA,UAC9C;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ScaleLinear, ScaleLogarithmic } from 'd3-scale';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { defineRadius } from './define-radius.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\ntype RadiusScale =\n | ScaleLinear<number, number>\n | ScaleLogarithmic<number, number>\n | ((value: number) => number);\n\nexport const parseBubbleDataToGeoJSON = <T extends Location>(\n data: T[],\n color: string | ((item: T) => string),\n radius: number | ((item: T) => number),\n scale: RadiusScale,\n) => {\n return {\n type: 'FeatureCollection',\n features: data.map((feature) => {\n const { longitude, latitude, ...properties } = feature;\n const canvasColor = getCanvasColor(defineColor(color, feature));\n const hoveredColor = calculateHoveredColor(canvasColor);\n const scaledRadius = scale(defineRadius(radius, feature));\n\n return {\n type: 'Feature',\n properties: {\n data: feature,\n ...properties,\n __color: canvasColor,\n __hoveredColor: hoveredColor,\n __radius: scaledRadius,\n __lat: latitude,\n },\n geometry: { type: 'Point', coordinates: [longitude, latitude] },\n };\n }),\n };\n};\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { ScaleLinear, ScaleLogarithmic } from 'd3-scale';\nimport type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { defineRadius } from './define-radius.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\ntype RadiusScale =\n | ScaleLinear<number, number>\n | ScaleLogarithmic<number, number>\n | ((value: number) => number);\n\nexport const parseBubbleDataToGeoJSON = <T extends Location>(\n data: T[],\n color: string | ((item: T) => string),\n radius: number | ((item: T) => number),\n scale: RadiusScale,\n): GeoJSON.FeatureCollection => {\n return {\n type: 'FeatureCollection',\n features: data.map((feature) => {\n const { longitude, latitude, ...properties } = feature;\n const canvasColor = getCanvasColor(defineColor(color, feature));\n const hoveredColor = calculateHoveredColor(canvasColor);\n const scaledRadius = scale(defineRadius(radius, feature));\n\n return {\n type: 'Feature',\n properties: {\n data: feature,\n ...properties,\n __color: canvasColor,\n __hoveredColor: hoveredColor,\n __radius: scaledRadius,\n __lat: latitude,\n },\n geometry: { type: 'Point', coordinates: [longitude, latitude] },\n };\n }),\n };\n};\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAOrB,MAAM,2BAA2B,CACtC,MACA,OACA,QACA,UAC8B;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU,KAAK,IAAI,CAAC,YAAY;AAC9B,YAAM,EAAE,WAAW,UAAU,GAAG,WAAW,IAAI;AAC/C,YAAM,cAAc,eAAe,YAAY,OAAO,OAAO,CAAC;AAC9D,YAAM,eAAe,sBAAsB,WAAW;AACtD,YAAM,eAAe,MAAM,aAAa,QAAQ,OAAO,CAAC;AAExD,aAAO;AAAA,QACL,MAAM;AAAA,QACN,YAAY;AAAA,UACV,MAAM;AAAA,UACN,GAAG;AAAA,UACH,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,UAAU;AAAA,UACV,OAAO;AAAA,QACT;AAAA,QACA,UAAU,EAAE,MAAM,SAAS,aAAa,CAAC,WAAW,QAAQ,EAAE;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { Layer, Source } from "@vis.gl/react-maplibre";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import { Layer, Source } from "react-map-gl/maplibre";
|
|
3
3
|
import { _getCanvasColor as getCanvasColor } from "@dynatrace/strato-components-preview/charts";
|
|
4
4
|
import { ChoroplethLayerTooltip } from "./ChoroplethLayerTooltip.js";
|
|
5
5
|
import { parseRegionDataToGeoJSON } from "./utils/parse-region-data-to-geo-json.js";
|
|
6
6
|
import {
|
|
7
7
|
ACTIVE_COLOR,
|
|
8
|
-
|
|
8
|
+
ACTIVE_BORDER_WIDTH_OUTER,
|
|
9
|
+
COUNTRY_BORDER_WIDTH,
|
|
10
|
+
REGION_BORDER_WIDTH,
|
|
9
11
|
DEFAULT_CHOROPLETH_COLOR,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
TRANSPARENT_BORDER_COLOR
|
|
12
|
+
DEFAULT_BOUNDARIES_BORDER_COLOR,
|
|
13
|
+
SHAPE_OPACITY_DIMMED,
|
|
14
|
+
SHAPE_OPACITY_DEFAULT,
|
|
15
|
+
TRANSPARENT_BORDER_COLOR,
|
|
16
|
+
ACTIVE_BORDER_WIDTH_INNER
|
|
14
17
|
} from "../../constants.js";
|
|
15
18
|
import { useLayerColoringStrategy } from "../../hooks/use-layer-coloring-strategy.js";
|
|
16
19
|
import { useLegendInteractionHighlighting } from "../../hooks/use-legend-interaction-highlighting.js";
|
|
@@ -37,51 +40,71 @@ const ChoroplethLayer = (props) => {
|
|
|
37
40
|
children,
|
|
38
41
|
ChoroplethLayerTooltipSlot
|
|
39
42
|
);
|
|
40
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true }, /* @__PURE__ */ React.createElement(
|
|
43
|
+
return dataGeoJSON && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true }, /* @__PURE__ */ React.createElement(
|
|
41
44
|
Layer,
|
|
42
45
|
{
|
|
43
46
|
id: layerId,
|
|
44
|
-
type: "fill",
|
|
45
47
|
source: sourceId,
|
|
48
|
+
type: "fill",
|
|
46
49
|
paint: {
|
|
47
|
-
"fill-color": [
|
|
48
|
-
"case",
|
|
49
|
-
["boolean", ["feature-state", "active"], false],
|
|
50
|
-
["get", "__color"],
|
|
51
|
-
["boolean", ["feature-state", "hover"], false],
|
|
52
|
-
["get", "__hoveredColor"],
|
|
53
|
-
["get", "__color"]
|
|
54
|
-
],
|
|
50
|
+
"fill-color": ["get", "__color"],
|
|
55
51
|
"fill-opacity": [
|
|
56
52
|
"case",
|
|
57
|
-
["
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
["==", ["feature-state", "legendHover"], false],
|
|
54
|
+
SHAPE_OPACITY_DIMMED,
|
|
55
|
+
["==", ["feature-state", "active"], true],
|
|
56
|
+
SHAPE_OPACITY_DEFAULT,
|
|
57
|
+
["==", ["feature-state", "hover"], true],
|
|
58
|
+
SHAPE_OPACITY_DEFAULT,
|
|
59
|
+
["==", ["feature-state", "legendHover"], true],
|
|
60
|
+
SHAPE_OPACITY_DEFAULT,
|
|
61
|
+
["==", ["feature-state", "isAnyActive"], true],
|
|
62
|
+
SHAPE_OPACITY_DIMMED,
|
|
63
|
+
SHAPE_OPACITY_DEFAULT
|
|
60
64
|
]
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
), /* @__PURE__ */ React.createElement(
|
|
64
68
|
Layer,
|
|
65
69
|
{
|
|
66
|
-
type: "line",
|
|
67
70
|
source: sourceId,
|
|
71
|
+
type: "line",
|
|
68
72
|
paint: {
|
|
69
|
-
"line-color":
|
|
73
|
+
"line-color": [
|
|
74
|
+
"case",
|
|
75
|
+
["==", ["feature-state", "active"], true],
|
|
76
|
+
getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),
|
|
77
|
+
["==", ["feature-state", "hover"], true],
|
|
78
|
+
getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),
|
|
79
|
+
getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR)
|
|
80
|
+
],
|
|
81
|
+
"line-width": [
|
|
82
|
+
"case",
|
|
83
|
+
["==", ["feature-state", "active"], true],
|
|
84
|
+
ACTIVE_BORDER_WIDTH_OUTER,
|
|
85
|
+
["==", ["feature-state", "hover"], true],
|
|
86
|
+
ACTIVE_BORDER_WIDTH_OUTER,
|
|
87
|
+
["==", ["get", "region_type"], "REGION"],
|
|
88
|
+
REGION_BORDER_WIDTH,
|
|
89
|
+
COUNTRY_BORDER_WIDTH
|
|
90
|
+
]
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
), /* @__PURE__ */ React.createElement(
|
|
73
94
|
Layer,
|
|
74
95
|
{
|
|
75
|
-
type: "line",
|
|
76
96
|
source: sourceId,
|
|
97
|
+
type: "line",
|
|
77
98
|
paint: {
|
|
78
99
|
"line-color": [
|
|
79
100
|
"case",
|
|
80
|
-
["
|
|
101
|
+
["==", ["feature-state", "active"], true],
|
|
102
|
+
getCanvasColor(ACTIVE_COLOR),
|
|
103
|
+
["==", ["feature-state", "hover"], true],
|
|
81
104
|
getCanvasColor(ACTIVE_COLOR),
|
|
82
105
|
getCanvasColor(TRANSPARENT_BORDER_COLOR)
|
|
83
106
|
],
|
|
84
|
-
"line-width":
|
|
107
|
+
"line-width": ACTIVE_BORDER_WIDTH_INNER
|
|
85
108
|
}
|
|
86
109
|
}
|
|
87
110
|
)), /* @__PURE__ */ React.createElement(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ChoroplethLayer/ChoroplethLayer.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,OAAO,
|
|
4
|
+
"sourcesContent": ["import { Layer, Source } from '@vis.gl/react-maplibre';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { ChoroplethLayerTooltip } from './ChoroplethLayerTooltip.js';\nimport { parseRegionDataToGeoJSON } from './utils/parse-region-data-to-geo-json.js';\nimport {\n ACTIVE_COLOR,\n ACTIVE_BORDER_WIDTH_OUTER,\n COUNTRY_BORDER_WIDTH,\n REGION_BORDER_WIDTH,\n DEFAULT_CHOROPLETH_COLOR,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n TRANSPARENT_BORDER_COLOR,\n ACTIVE_BORDER_WIDTH_INNER,\n} from '../../constants.js';\nimport { useLayerColoringStrategy } from '../../hooks/use-layer-coloring-strategy.js';\nimport { useLegendInteractionHighlighting } from '../../hooks/use-legend-interaction-highlighting.js';\nimport { useLegendInteractionVisibility } from '../../hooks/use-legend-interaction-visibility.js';\nimport { useMapBaseLayerFeatures } from '../../hooks/use-map-base-layer-features.js';\nimport { useResolveChoroplethColor } from '../../hooks/use-resolve-color.js';\nimport { useTooltipTemplate } from '../../hooks/use-tooltip-template.js';\nimport { ChoroplethLayerTooltip as ChoroplethLayerTooltipSlot } from '../../slots/ChoroplethLayerTooltip.js';\nimport type { InternalChoroplethLayerProps } from '../../types/choropleth-layer.js';\nimport { isChoroplethTooltipTemplate } from '../../utils/tooltip-type-guards.js';\n\nexport const ChoroplethLayer = <T extends Record<string, unknown>>(\n props: PropsWithChildren<InternalChoroplethLayerProps<T>>,\n) => {\n const { layerId, data, regionAccessor, children } = props;\n\n const mapSource = useMapBaseLayerFeatures();\n\n const colorParser = useLayerColoringStrategy();\n const choroplethColor = useResolveChoroplethColor(\n DEFAULT_CHOROPLETH_COLOR,\n props,\n colorParser,\n );\n const sourceId = layerId.replace('layer', 'source');\n useLegendInteractionHighlighting(props, sourceId);\n useLegendInteractionVisibility(props, layerId);\n\n const dataGeoJSON =\n mapSource &&\n parseRegionDataToGeoJSON(mapSource, data, regionAccessor, choroplethColor);\n\n const tooltipTemplate = useTooltipTemplate(\n children,\n ChoroplethLayerTooltipSlot,\n );\n\n return (\n dataGeoJSON && (\n <>\n <Source id={sourceId} type=\"geojson\" data={dataGeoJSON} generateId>\n <Layer\n id={layerId}\n source={sourceId}\n type=\"fill\"\n paint={{\n 'fill-color': ['get', '__color'],\n 'fill-opacity': [\n 'case',\n ['==', ['feature-state', 'legendHover'], false],\n SHAPE_OPACITY_DIMMED,\n ['==', ['feature-state', 'active'], true],\n SHAPE_OPACITY_DEFAULT,\n ['==', ['feature-state', 'hover'], true],\n SHAPE_OPACITY_DEFAULT,\n ['==', ['feature-state', 'legendHover'], true],\n SHAPE_OPACITY_DEFAULT,\n ['==', ['feature-state', 'isAnyActive'], true],\n SHAPE_OPACITY_DIMMED,\n SHAPE_OPACITY_DEFAULT,\n ],\n }}\n />\n\n <Layer\n source={sourceId}\n type=\"line\"\n paint={{\n 'line-color': [\n 'case',\n ['==', ['feature-state', 'active'], true],\n getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),\n ['==', ['feature-state', 'hover'], true],\n getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),\n getCanvasColor(DEFAULT_BOUNDARIES_BORDER_COLOR),\n ],\n 'line-width': [\n 'case',\n ['==', ['feature-state', 'active'], true],\n ACTIVE_BORDER_WIDTH_OUTER,\n ['==', ['feature-state', 'hover'], true],\n ACTIVE_BORDER_WIDTH_OUTER,\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n\n <Layer\n source={sourceId}\n type=\"line\"\n paint={{\n 'line-color': [\n 'case',\n ['==', ['feature-state', 'active'], true],\n getCanvasColor(ACTIVE_COLOR),\n ['==', ['feature-state', 'hover'], true],\n getCanvasColor(ACTIVE_COLOR),\n getCanvasColor(TRANSPARENT_BORDER_COLOR),\n ],\n 'line-width': ACTIVE_BORDER_WIDTH_INNER,\n }}\n />\n </Source>\n\n <ChoroplethLayerTooltip\n layerId={layerId}\n tooltipTemplate={\n isChoroplethTooltipTemplate(tooltipTemplate)\n ? tooltipTemplate\n : undefined\n }\n />\n </>\n )\n );\n};\n\nChoroplethLayer['displayName'] = 'ChoroplethLayer';\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,11 +15,12 @@ const parseRegionDataToGeoJSON = (mapSource, data, regionAccessor, color) => {
|
|
|
15
15
|
const regionColor = defineColor(color, item);
|
|
16
16
|
const canvasColor = getCanvasColor(regionColor);
|
|
17
17
|
const hoveredColor = calculateHoveredColor(canvasColor);
|
|
18
|
-
const { name } = feature.properties;
|
|
18
|
+
const { name, region_type } = feature.properties;
|
|
19
19
|
const feat = {
|
|
20
20
|
...feature,
|
|
21
21
|
properties: {
|
|
22
22
|
name,
|
|
23
|
+
region_type,
|
|
23
24
|
data: item,
|
|
24
25
|
...item,
|
|
25
26
|
__color: canvasColor,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.ts"],
|
|
4
|
-
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\nimport { _accessValue as accessValue } from '@dynatrace/strato-components-preview/core';\n\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nexport const parseRegionDataToGeoJSON = <T extends Record<string, unknown>>(\n mapSource: GeoJSON.FeatureCollection,\n data: T[],\n regionAccessor: string | ((i: T) => string),\n color: string | ((i: T) => string),\n): GeoJSON.FeatureCollection => {\n const features = data.reduce((features: GeoJSON.Feature[], item) => {\n let id: string | undefined = '';\n\n if (typeof regionAccessor === 'function') {\n id = regionAccessor(item);\n } else {\n id = accessValue<string>(item, regionAccessor);\n }\n\n const feature = mapSource.features.find((region) => region.id === id);\n if (feature !== undefined) {\n const regionColor = defineColor(color, item);\n const canvasColor = getCanvasColor(regionColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n const { name } = feature.properties as {
|
|
5
|
-
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAClD,SAAS,gBAAgB,mBAAmB;AAE5C,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAErB,MAAM,2BAA2B,CACtC,WACA,MACA,gBACA,UAC8B;AAC9B,QAAM,WAAW,KAAK,OAAO,CAACA,WAA6B,SAAS;AAClE,QAAI,KAAyB;AAE7B,QAAI,OAAO,mBAAmB,YAAY;AACxC,WAAK,eAAe,IAAI;AAAA,IAC1B,OAAO;AACL,WAAK,YAAoB,MAAM,cAAc;AAAA,IAC/C;AAEA,UAAM,UAAU,UAAU,SAAS,KAAK,CAAC,WAAW,OAAO,OAAO,EAAE;AACpE,QAAI,YAAY,QAAW;AACzB,YAAM,cAAc,YAAY,OAAO,IAAI;AAC3C,YAAM,cAAc,eAAe,WAAW;AAC9C,YAAM,eAAe,sBAAsB,WAAW;AACtD,YAAM,EAAE,
|
|
4
|
+
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\nimport { _accessValue as accessValue } from '@dynatrace/strato-components-preview/core';\n\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nexport const parseRegionDataToGeoJSON = <T extends Record<string, unknown>>(\n mapSource: GeoJSON.FeatureCollection,\n data: T[],\n regionAccessor: string | ((i: T) => string),\n color: string | ((i: T) => string),\n): GeoJSON.FeatureCollection => {\n const features = data.reduce((features: GeoJSON.Feature[], item) => {\n let id: string | undefined = '';\n\n if (typeof regionAccessor === 'function') {\n id = regionAccessor(item);\n } else {\n id = accessValue<string>(item, regionAccessor);\n }\n\n const feature = mapSource.features.find((region) => region.id === id);\n if (feature !== undefined) {\n const regionColor = defineColor(color, item);\n const canvasColor = getCanvasColor(regionColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n const { name, region_type } = feature.properties as {\n name: string;\n region_type: string;\n };\n const feat = {\n ...feature,\n properties: {\n name,\n region_type,\n data: item,\n ...item,\n __color: canvasColor,\n __hoveredColor: hoveredColor,\n },\n };\n\n features.push(feat);\n }\n\n return features;\n }, []);\n\n return {\n type: 'FeatureCollection',\n features,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAClD,SAAS,gBAAgB,mBAAmB;AAE5C,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAErB,MAAM,2BAA2B,CACtC,WACA,MACA,gBACA,UAC8B;AAC9B,QAAM,WAAW,KAAK,OAAO,CAACA,WAA6B,SAAS;AAClE,QAAI,KAAyB;AAE7B,QAAI,OAAO,mBAAmB,YAAY;AACxC,WAAK,eAAe,IAAI;AAAA,IAC1B,OAAO;AACL,WAAK,YAAoB,MAAM,cAAc;AAAA,IAC/C;AAEA,UAAM,UAAU,UAAU,SAAS,KAAK,CAAC,WAAW,OAAO,OAAO,EAAE;AACpE,QAAI,YAAY,QAAW;AACzB,YAAM,cAAc,YAAY,OAAO,IAAI;AAC3C,YAAM,cAAc,eAAe,WAAW;AAC9C,YAAM,eAAe,sBAAsB,WAAW;AACtD,YAAM,EAAE,MAAM,YAAY,IAAI,QAAQ;AAItC,YAAM,OAAO;AAAA,QACX,GAAG;AAAA,QACH,YAAY;AAAA,UACV;AAAA,UACA;AAAA,UACA,MAAM;AAAA,UACN,GAAG;AAAA,UACH,SAAS;AAAA,UACT,gBAAgB;AAAA,QAClB;AAAA,MACF;AAEA,MAAAA,UAAS,KAAK,IAAI;AAAA,IACpB;AAEA,WAAOA;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["features"]
|
|
7
7
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Layer, Source } from "react-map-gl/maplibre";
|
|
3
2
|
import { ConnectionLayerDirection } from "./ConnectionLayerDirection.js";
|
|
3
|
+
import { ConnectionLayerLine } from "./ConnectionLayerLine.js";
|
|
4
4
|
import { ConnectionLayerTooltip } from "./ConnectionLayerTooltip.js";
|
|
5
|
-
import { useConnectionLayerMouseMove } from "./hooks/use-connection-layer-mouse-move.js";
|
|
6
5
|
import { parseConnectionDataToGeoJSON } from "./utils/parse-connection-data-to-geo-json.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
DEFAULT_LINE_THICKNESS
|
|
13
|
-
} from "../../constants.js";
|
|
6
|
+
import { DEFAULT_LINE_COLOR, DEFAULT_LINE_THICKNESS } from "../../constants.js";
|
|
7
|
+
import { useLayerColoringStrategy } from "../../hooks/use-layer-coloring-strategy.js";
|
|
8
|
+
import { useLegendInteractionHighlighting } from "../../hooks/use-legend-interaction-highlighting.js";
|
|
9
|
+
import { useLegendInteractionVisibility } from "../../hooks/use-legend-interaction-visibility.js";
|
|
10
|
+
import { useResolveConnectionColor } from "../../hooks/use-resolve-color.js";
|
|
14
11
|
import { useTooltipTemplate } from "../../hooks/use-tooltip-template.js";
|
|
15
12
|
import { ConnectionLayerTooltip as ConnectionLayerTooltipSlot } from "../../slots/ConnectionLayerTooltip.js";
|
|
16
13
|
import { isConnectionTooltipTemplate } from "../../utils/tooltip-type-guards.js";
|
|
@@ -19,67 +16,52 @@ const ConnectionLayer = (props) => {
|
|
|
19
16
|
data,
|
|
20
17
|
layerId,
|
|
21
18
|
children,
|
|
22
|
-
color = DEFAULT_LINE_COLOR,
|
|
23
19
|
curve,
|
|
24
20
|
directionIndicator,
|
|
25
21
|
line,
|
|
26
22
|
thickness = DEFAULT_LINE_THICKNESS
|
|
27
23
|
} = props;
|
|
24
|
+
const colorParser = useLayerColoringStrategy();
|
|
25
|
+
const connectionColor = useResolveConnectionColor(
|
|
26
|
+
DEFAULT_LINE_COLOR,
|
|
27
|
+
props,
|
|
28
|
+
colorParser
|
|
29
|
+
);
|
|
28
30
|
const sourceId = `source-${layerId}`;
|
|
31
|
+
useLegendInteractionHighlighting(props, sourceId);
|
|
32
|
+
useLegendInteractionVisibility(props, layerId);
|
|
29
33
|
const geoJsonData = parseConnectionDataToGeoJSON(
|
|
30
34
|
data,
|
|
31
35
|
thickness,
|
|
32
|
-
|
|
36
|
+
connectionColor,
|
|
33
37
|
curve
|
|
34
38
|
);
|
|
35
39
|
const tooltipTemplate = useTooltipTemplate(
|
|
36
40
|
children,
|
|
37
41
|
ConnectionLayerTooltipSlot
|
|
38
42
|
);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Source,
|
|
43
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
44
|
+
ConnectionLayerLine,
|
|
42
45
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
/* @__PURE__ */ React.createElement(
|
|
49
|
-
Layer,
|
|
50
|
-
{
|
|
51
|
-
type: "line",
|
|
52
|
-
id: layerIds[index],
|
|
53
|
-
layout: {
|
|
54
|
-
"line-cap": DEFAULT_LINE_CAP,
|
|
55
|
-
"line-join": DEFAULT_LINE_JOIN
|
|
56
|
-
},
|
|
57
|
-
paint: {
|
|
58
|
-
"line-color": [
|
|
59
|
-
"case",
|
|
60
|
-
["boolean", ["feature-state", "hover"], false],
|
|
61
|
-
["get", "__lineHoveredColor"],
|
|
62
|
-
["get", "__lineColor"]
|
|
63
|
-
],
|
|
64
|
-
"line-width": ["get", "__lineWidth"],
|
|
65
|
-
...line && line === "dashed" ? { "line-dasharray": DEFAULT_LINE_DASH_ARRAY } : null
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
), /* @__PURE__ */ React.createElement(
|
|
70
|
-
ConnectionLayerTooltip,
|
|
71
|
-
{
|
|
72
|
-
layerId: layerIds[index],
|
|
73
|
-
tooltipTemplate: isConnectionTooltipTemplate(tooltipTemplate) ? tooltipTemplate : void 0
|
|
46
|
+
geoJsonData,
|
|
47
|
+
layerId,
|
|
48
|
+
sourceId,
|
|
49
|
+
line
|
|
74
50
|
}
|
|
75
51
|
), directionIndicator && /* @__PURE__ */ React.createElement(
|
|
76
52
|
ConnectionLayerDirection,
|
|
77
53
|
{
|
|
78
|
-
geoJsonData
|
|
79
|
-
layerId
|
|
54
|
+
geoJsonData,
|
|
55
|
+
layerId,
|
|
80
56
|
directionIndicator
|
|
81
57
|
}
|
|
82
|
-
)
|
|
58
|
+
), /* @__PURE__ */ React.createElement(
|
|
59
|
+
ConnectionLayerTooltip,
|
|
60
|
+
{
|
|
61
|
+
layerId,
|
|
62
|
+
tooltipTemplate: isConnectionTooltipTemplate(tooltipTemplate) ? tooltipTemplate : void 0
|
|
63
|
+
}
|
|
64
|
+
));
|
|
83
65
|
};
|
|
84
66
|
ConnectionLayer["displayName"] = "ConnectionLayer";
|
|
85
67
|
export {
|