@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
|
@@ -10,9 +10,20 @@ const addCategory = (extendedDataPoint, valueAccessor) => {
|
|
|
10
10
|
return extendedDataPoint[valueAccessor];
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
const
|
|
13
|
+
const updateDomain = (domain, value) => {
|
|
14
|
+
const [min, max] = domain;
|
|
15
|
+
if (value < min) {
|
|
16
|
+
return [value, max];
|
|
17
|
+
}
|
|
18
|
+
if (value > max) {
|
|
19
|
+
return [min, value];
|
|
20
|
+
}
|
|
21
|
+
return domain;
|
|
22
|
+
};
|
|
23
|
+
const extractLayersData = (children, valueAccessors) => {
|
|
14
24
|
let flattenData = [];
|
|
15
25
|
const categoriesSet = /* @__PURE__ */ new Set();
|
|
26
|
+
let legendDomain = [Infinity, -Infinity];
|
|
16
27
|
React.Children.forEach(children, (child) => {
|
|
17
28
|
if (isComponent(child, BubbleLayer) || isComponent(child, DotLayer)) {
|
|
18
29
|
const { data } = child.props;
|
|
@@ -21,22 +32,38 @@ const extractLayersData = (children, valueAccessor) => {
|
|
|
21
32
|
...dataPoint,
|
|
22
33
|
"layer-name": child.props.layerId
|
|
23
34
|
};
|
|
24
|
-
const category = addCategory(
|
|
35
|
+
const category = addCategory(
|
|
36
|
+
extendedDataPoint,
|
|
37
|
+
valueAccessors.get(child.props.layerId)
|
|
38
|
+
);
|
|
25
39
|
category && categoriesSet.add(category);
|
|
40
|
+
if (typeof category === "number") {
|
|
41
|
+
legendDomain = updateDomain(legendDomain, category);
|
|
42
|
+
}
|
|
26
43
|
flattenData = flattenData.concat(extendedDataPoint);
|
|
27
44
|
});
|
|
28
45
|
} else if (isComponent(child, ConnectionLayer)) {
|
|
29
46
|
const { data } = child.props;
|
|
30
47
|
data.forEach((connection, connectionIndex) => {
|
|
31
|
-
connection.path.
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
if (connection.path.length >= 2) {
|
|
49
|
+
const category = addCategory(
|
|
50
|
+
connection,
|
|
51
|
+
valueAccessors.get(child.props.layerId)
|
|
52
|
+
);
|
|
53
|
+
category && categoriesSet.add(category);
|
|
54
|
+
if (typeof category === "number") {
|
|
55
|
+
legendDomain = updateDomain(legendDomain, category);
|
|
56
|
+
}
|
|
57
|
+
connection.path.forEach((path, pathIndex) => {
|
|
58
|
+
const parsedPath = {
|
|
59
|
+
...path,
|
|
60
|
+
"connection-name": `connection-${connectionIndex + 1}`,
|
|
61
|
+
"connection-item-index": pathIndex,
|
|
62
|
+
"layer-name": child.props.layerId
|
|
63
|
+
};
|
|
64
|
+
flattenData.push(parsedPath);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
40
67
|
});
|
|
41
68
|
} else if (isComponent(child, ChoroplethLayer)) {
|
|
42
69
|
const { data, regionAccessor } = child.props;
|
|
@@ -47,13 +74,23 @@ const extractLayersData = (children, valueAccessor) => {
|
|
|
47
74
|
region,
|
|
48
75
|
"layer-name": child.props.layerId
|
|
49
76
|
};
|
|
50
|
-
const category = addCategory(
|
|
77
|
+
const category = addCategory(
|
|
78
|
+
choroplethLayerData,
|
|
79
|
+
valueAccessors.get(child.props.layerId)
|
|
80
|
+
);
|
|
51
81
|
category && categoriesSet.add(category);
|
|
82
|
+
if (typeof category === "number") {
|
|
83
|
+
legendDomain = updateDomain(legendDomain, category);
|
|
84
|
+
}
|
|
52
85
|
flattenData.push(choroplethLayerData);
|
|
53
86
|
});
|
|
54
87
|
}
|
|
55
88
|
});
|
|
56
|
-
return {
|
|
89
|
+
return {
|
|
90
|
+
flattenData,
|
|
91
|
+
categories: [...categoriesSet],
|
|
92
|
+
legendDomain
|
|
93
|
+
};
|
|
57
94
|
};
|
|
58
95
|
export {
|
|
59
96
|
extractLayersData
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/extract-layers-data.ts"],
|
|
4
|
-
"sourcesContent": ["import { isString } from 'lodash-es';\nimport React from 'react';\n\nimport { isComponent } from './is-component.js';\nimport { BubbleLayer } from '../components/BubbleLayer/BubbleLayer.js';\nimport { ChoroplethLayer } from '../components/ChoroplethLayer/ChoroplethLayer.js';\nimport { ConnectionLayer } from '../components/ConnectionLayer/ConnectionLayer.js';\nimport { DotLayer } from '../components/DotLayer/DotLayer.js';\n\nconst addCategory = (\n extendedDataPoint: Record<string, unknown>,\n valueAccessor?: string,\n) => {\n if (valueAccessor && extendedDataPoint[valueAccessor]) {\n return extendedDataPoint[valueAccessor];\n }\n};\n\n/**\n * Extract layers data\n * @param children - MapView children\n * @param
|
|
5
|
-
"mappings": "AAAA,SAAS,gBAAgB;AACzB,OAAO,WAAW;AAElB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AAEzB,MAAM,cAAc,CAClB,mBACA,kBACG;AACH,MAAI,iBAAiB,kBAAkB,aAAa,GAAG;AACrD,WAAO,kBAAkB,aAAa;AAAA,EACxC;AACF;AAQO,MAAM,oBAAoB,CAC/B,UACA,
|
|
4
|
+
"sourcesContent": ["import { isString } from 'lodash-es';\nimport React from 'react';\n\nimport { isComponent } from './is-component.js';\nimport { BubbleLayer } from '../components/BubbleLayer/BubbleLayer.js';\nimport { ChoroplethLayer } from '../components/ChoroplethLayer/ChoroplethLayer.js';\nimport { ConnectionLayer } from '../components/ConnectionLayer/ConnectionLayer.js';\nimport { DotLayer } from '../components/DotLayer/DotLayer.js';\n\nconst addCategory = (\n extendedDataPoint: Record<string, unknown>,\n valueAccessor?: string,\n) => {\n if (valueAccessor && extendedDataPoint[valueAccessor]) {\n return extendedDataPoint[valueAccessor];\n }\n};\n\nconst updateDomain = (\n domain: [number, number],\n value: number,\n): [number, number] => {\n const [min, max] = domain;\n if (value < min) {\n return [value, max];\n }\n if (value > max) {\n return [min, value];\n }\n return domain;\n};\n\n/**\n * Extract layers data\n * @param children - MapView children\n * @param valueAccessors - MapView Layer valueAccessor\n * @returns flattened data array\n */\nexport const extractLayersData = (\n children: React.ReactNode,\n valueAccessors: Map<string, string>,\n) => {\n let flattenData: Record<string, unknown>[] = [];\n const categoriesSet = new Set<string>();\n let legendDomain: [number, number] = [Infinity, -Infinity];\n\n React.Children.forEach(children, (child) => {\n if (isComponent(child, BubbleLayer) || isComponent(child, DotLayer)) {\n const { data } = child.props;\n\n data.forEach((dataPoint) => {\n const extendedDataPoint = {\n ...dataPoint,\n 'layer-name': child.props.layerId,\n };\n\n const category = addCategory(\n extendedDataPoint,\n valueAccessors.get(child.props.layerId),\n );\n\n category && categoriesSet.add(category as string);\n\n if (typeof category === 'number') {\n legendDomain = updateDomain(legendDomain, category);\n }\n\n flattenData = flattenData.concat(extendedDataPoint);\n });\n } else if (isComponent(child, ConnectionLayer)) {\n const { data } = child.props;\n\n data.forEach((connection, connectionIndex) => {\n if (connection.path.length >= 2) {\n const category = addCategory(\n connection,\n valueAccessors.get(child.props.layerId),\n );\n\n category && categoriesSet.add(category as string);\n\n if (typeof category === 'number') {\n legendDomain = updateDomain(legendDomain, category);\n }\n\n connection.path.forEach((path, pathIndex) => {\n const parsedPath = {\n ...path,\n 'connection-name': `connection-${connectionIndex + 1}`,\n 'connection-item-index': pathIndex,\n 'layer-name': child.props.layerId,\n };\n\n flattenData.push(parsedPath);\n });\n }\n });\n } else if (isComponent(child, ChoroplethLayer)) {\n const { data, regionAccessor } = child.props;\n\n data.forEach((dataEntry) => {\n const region = isString(regionAccessor)\n ? dataEntry[regionAccessor]\n : regionAccessor(dataEntry);\n\n const choroplethLayerData = {\n ...dataEntry,\n region,\n 'layer-name': child.props.layerId,\n };\n\n const category = addCategory(\n choroplethLayerData,\n valueAccessors.get(child.props.layerId),\n );\n\n category && categoriesSet.add(category as string);\n\n if (typeof category === 'number') {\n legendDomain = updateDomain(legendDomain, category);\n }\n\n flattenData.push(choroplethLayerData);\n });\n }\n });\n\n return {\n flattenData,\n categories: [...categoriesSet],\n legendDomain,\n };\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -12,7 +12,7 @@ import { CategoricalLegend } from "../slots/CategoricalLegend.js";
|
|
|
12
12
|
import { ChartInteractions } from "../slots/ChartInteractions.js";
|
|
13
13
|
import { SequentialLegend } from "../slots/SequentialLegend.js";
|
|
14
14
|
import { ThresholdLegend } from "../slots/ThresholdLegend.js";
|
|
15
|
-
const iterateConfigSlots = (children) => {
|
|
15
|
+
const iterateConfigSlots = (children, legendDomain) => {
|
|
16
16
|
let slots = {
|
|
17
17
|
toolbar: void 0,
|
|
18
18
|
interactions: void 0,
|
|
@@ -55,7 +55,9 @@ const iterateConfigSlots = (children) => {
|
|
|
55
55
|
colorPalette: DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,
|
|
56
56
|
position: DEFAULT_MAP_POSITION,
|
|
57
57
|
ratio: DEFAULT_MAP_LEGEND_RATIO,
|
|
58
|
-
...legend
|
|
58
|
+
...legend,
|
|
59
|
+
min: legend.min ?? legendDomain[0],
|
|
60
|
+
max: legend.max ?? legendDomain[1]
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/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 {\n DEFAULT_BASE_LAYER_RULES,\n DEFAULT_MAP_LEGEND_RATIO,\n DEFAULT_MAP_POSITION,\n DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n} from '../constants.js';\nimport { BaseLayer } from '../slots/BaseLayer.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 baseLayer: DEFAULT_BASE_LAYER_RULES,\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 case BaseLayer: {\n slots = {\n ...slots,\n baseLayer: {\n ...slots.baseLayer,\n ...child.props,\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,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { isElement } from 'react-is';\n\nimport { ChartToolbar } from '@dynatrace/strato-components-preview/charts';\n\nimport {\n DEFAULT_BASE_LAYER_RULES,\n DEFAULT_MAP_LEGEND_RATIO,\n DEFAULT_MAP_POSITION,\n DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n} from '../constants.js';\nimport { BaseLayer } from '../slots/BaseLayer.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 * @param legendDomain - Domain containing min and max value relevant for legend\n * @returns Map slot config\n */\nexport const iterateConfigSlots = (\n children: React.ReactNode,\n legendDomain: [number, number],\n) => {\n let slots: MapConfig = {\n toolbar: undefined,\n interactions: undefined,\n legend: undefined,\n baseLayer: DEFAULT_BASE_LAYER_RULES,\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 min: legend.min ?? legendDomain[0],\n max: legend.max ?? legendDomain[1],\n },\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 case BaseLayer: {\n slots = {\n ...slots,\n baseLayer: {\n ...slots.baseLayer,\n ...child.props,\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": "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",
|
|
6
6
|
"names": ["children"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isUndefined } from "lodash-es";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { isElement } from "react-is";
|
|
3
4
|
import { BubbleLayer as _BubbleLayer } from "../components/BubbleLayer/BubbleLayer.js";
|
|
@@ -8,6 +9,12 @@ import { BubbleLayer } from "../slots/BubbleLayer.js";
|
|
|
8
9
|
import { ChoroplethLayer } from "../slots/ChoroplethLayer.js";
|
|
9
10
|
import { ConnectionLayer } from "../slots/ConnectionLayer.js";
|
|
10
11
|
import { DotLayer } from "../slots/DotLayer.js";
|
|
12
|
+
const sanitizeData = (child, key) => {
|
|
13
|
+
return child.props.data.filter((datapoint) => {
|
|
14
|
+
const value = datapoint[key];
|
|
15
|
+
return !(value === null || isUndefined(value));
|
|
16
|
+
});
|
|
17
|
+
};
|
|
11
18
|
const layers = new WeakMap([
|
|
12
19
|
[BubbleLayer, { component: _BubbleLayer, prefix: "bubble" }],
|
|
13
20
|
[DotLayer, { component: _DotLayer, prefix: "dot" }],
|
|
@@ -17,7 +24,7 @@ const layers = new WeakMap([
|
|
|
17
24
|
const setLayersId = (children) => {
|
|
18
25
|
const layerIds = [];
|
|
19
26
|
let index = 0;
|
|
20
|
-
|
|
27
|
+
const valueAccessors = /* @__PURE__ */ new Map();
|
|
21
28
|
const parsedChildren = React.Children.map(children, (child) => {
|
|
22
29
|
if (isElement(child)) {
|
|
23
30
|
switch (child.type) {
|
|
@@ -26,14 +33,15 @@ const setLayersId = (children) => {
|
|
|
26
33
|
case ChoroplethLayer:
|
|
27
34
|
case DotLayer: {
|
|
28
35
|
const layer = layers.get(child.type);
|
|
36
|
+
const layerId = `${layer?.prefix}-${index}`;
|
|
29
37
|
if (child.props.color === "legend" && child.props.valueAccessor) {
|
|
30
|
-
|
|
38
|
+
valueAccessors.set(layerId, child.props.valueAccessor);
|
|
31
39
|
}
|
|
32
|
-
const layerId = `${layer?.prefix}-${index}`;
|
|
33
40
|
index += 1;
|
|
34
41
|
layerIds.push(layerId);
|
|
35
42
|
const newProps = {
|
|
36
43
|
...child.props,
|
|
44
|
+
data: valueAccessors.get(layerId) ? sanitizeData(child, valueAccessors.get(layerId)) : child.props.data,
|
|
37
45
|
layerId
|
|
38
46
|
};
|
|
39
47
|
return {
|
|
@@ -50,7 +58,7 @@ const setLayersId = (children) => {
|
|
|
50
58
|
}
|
|
51
59
|
return child;
|
|
52
60
|
});
|
|
53
|
-
return { layerIds, parsedChildren,
|
|
61
|
+
return { layerIds, parsedChildren, valueAccessors };
|
|
54
62
|
};
|
|
55
63
|
export {
|
|
56
64
|
setLayersId
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/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
|
|
5
|
-
"mappings": "AAAA,OAAO,
|
|
4
|
+
"sourcesContent": ["import { isUndefined } from 'lodash-es';\nimport React, { type ReactElement } 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 sanitizeData = (child: ReactElement, key: string) => {\n return child.props.data.filter((datapoint: Location) => {\n const value = datapoint[key as keyof Location];\n return !(value === null || isUndefined(value));\n });\n};\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 const valueAccessors = new Map<string, string>();\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\n if (child.props.color === 'legend' && child.props.valueAccessor) {\n valueAccessors.set(layerId, child.props.valueAccessor);\n }\n\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 data: valueAccessors.get(layerId)\n ? sanitizeData(child, valueAccessors.get(layerId)!)\n : child.props.data,\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, valueAccessors };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,OAAO,WAAkC;AACzC,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,eAAe,CAAC,OAAqB,QAAgB;AACzD,SAAO,MAAM,MAAM,KAAK,OAAO,CAAC,cAAwB;AACtD,UAAM,QAAQ,UAAU,GAAqB;AAC7C,WAAO,EAAE,UAAU,QAAQ,YAAY,KAAK;AAAA,EAC9C,CAAC;AACH;AAEA,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;AACZ,QAAM,iBAAiB,oBAAI,IAAoB;AAE/C,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;AAEzC,cAAI,MAAM,MAAM,UAAU,YAAY,MAAM,MAAM,eAAe;AAC/D,2BAAe,IAAI,SAAS,MAAM,MAAM,aAAa;AAAA,UACvD;AAEA,mBAAS;AAET,mBAAS,KAAK,OAAO;AAErB,gBAAM,WAKF;AAAA,YACF,GAAG,MAAM;AAAA,YACT,MAAM,eAAe,IAAI,OAAO,IAC5B,aAAa,OAAO,eAAe,IAAI,OAAO,CAAE,IAChD,MAAM,MAAM;AAAA,YAChB;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,gBAAgB,eAAe;AACpD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ const isDotTooltipTemplate = (template) => typeof template === typeof DotLayerTo
|
|
|
6
6
|
const isBubbleTooltipTemplate = (template) => typeof template === typeof BubbleLayerTooltip;
|
|
7
7
|
const isConnectionTooltipTemplate = (template) => typeof template === typeof ConnectionLayerTooltip;
|
|
8
8
|
const isChoroplethTooltipTemplate = (template) => typeof template === typeof ChoroplethLayerTooltip;
|
|
9
|
-
const isConnection = (data) => "path" in data;
|
|
9
|
+
const isConnection = (data) => "path" in data.data;
|
|
10
10
|
const isRegion = (data) => "name" in data;
|
|
11
11
|
export {
|
|
12
12
|
isBubbleTooltipTemplate,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/tooltip-type-guards.ts"],
|
|
4
|
-
"sourcesContent": ["import { BubbleLayerTooltip } from '../slots/BubbleLayerTooltip.js';\nimport { ChoroplethLayerTooltip } from '../slots/ChoroplethLayerTooltip.js';\nimport { ConnectionLayerTooltip } from '../slots/ConnectionLayerTooltip.js';\nimport { DotLayerTooltip } from '../slots/DotLayerTooltip.js';\nimport type {\n BubbleLayerTooltipHandler,\n ChoroplethLayerTooltipData,\n ChoroplethLayerTooltipHandler,\n ConnectionLayerTooltipData,\n ConnectionLayerTooltipHandler,\n DotLayerTooltipHandler,\n LayerTooltipData,\n LayerTooltipHandler,\n} from '../types/tooltip.js';\n\n/**\n * Type guards for tooltip template\n * @param template -\n */\nexport const isDotTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is DotLayerTooltipHandler =>\n typeof template === typeof DotLayerTooltip;\n\nexport const isBubbleTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is BubbleLayerTooltipHandler =>\n typeof template === typeof BubbleLayerTooltip;\n\nexport const isConnectionTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is ConnectionLayerTooltipHandler =>\n typeof template === typeof ConnectionLayerTooltip;\n\nexport const isChoroplethTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is ChoroplethLayerTooltipHandler =>\n typeof template === typeof ChoroplethLayerTooltip;\n\n/**\n * Type guards for map types in tooltip context\n * @param data -\n */\nexport const isConnection = (\n data: LayerTooltipData,\n): data is ConnectionLayerTooltipData => 'path' in data;\n\nexport const isRegion = (\n data: LayerTooltipData,\n): data is ChoroplethLayerTooltipData => 'name' in data;\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AACvC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAgBzB,MAAM,uBAAuB,CAClC,aAEA,OAAO,aAAa,OAAO;AAEtB,MAAM,0BAA0B,CACrC,aAEA,OAAO,aAAa,OAAO;AAEtB,MAAM,8BAA8B,CACzC,aAEA,OAAO,aAAa,OAAO;AAEtB,MAAM,8BAA8B,CACzC,aAEA,OAAO,aAAa,OAAO;AAMtB,MAAM,eAAe,CAC1B,SACuC,UAAU;
|
|
4
|
+
"sourcesContent": ["import { BubbleLayerTooltip } from '../slots/BubbleLayerTooltip.js';\nimport { ChoroplethLayerTooltip } from '../slots/ChoroplethLayerTooltip.js';\nimport { ConnectionLayerTooltip } from '../slots/ConnectionLayerTooltip.js';\nimport { DotLayerTooltip } from '../slots/DotLayerTooltip.js';\nimport type {\n BubbleLayerTooltipHandler,\n ChoroplethLayerTooltipData,\n ChoroplethLayerTooltipHandler,\n ConnectionLayerTooltipData,\n ConnectionLayerTooltipHandler,\n DotLayerTooltipHandler,\n LayerTooltipData,\n LayerTooltipHandler,\n} from '../types/tooltip.js';\n\n/**\n * Type guards for tooltip template\n * @param template -\n */\nexport const isDotTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is DotLayerTooltipHandler =>\n typeof template === typeof DotLayerTooltip;\n\nexport const isBubbleTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is BubbleLayerTooltipHandler =>\n typeof template === typeof BubbleLayerTooltip;\n\nexport const isConnectionTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is ConnectionLayerTooltipHandler =>\n typeof template === typeof ConnectionLayerTooltip;\n\nexport const isChoroplethTooltipTemplate = (\n template?: LayerTooltipHandler,\n): template is ChoroplethLayerTooltipHandler =>\n typeof template === typeof ChoroplethLayerTooltip;\n\n/**\n * Type guards for map types in tooltip context\n * @param data -\n */\nexport const isConnection = (\n data: LayerTooltipData,\n): data is ConnectionLayerTooltipData => 'path' in data.data;\n\nexport const isRegion = (\n data: LayerTooltipData,\n): data is ChoroplethLayerTooltipData => 'name' in data;\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AACvC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAgBzB,MAAM,uBAAuB,CAClC,aAEA,OAAO,aAAa,OAAO;AAEtB,MAAM,0BAA0B,CACrC,aAEA,OAAO,aAAa,OAAO;AAEtB,MAAM,8BAA8B,CACzC,aAEA,OAAO,aAAa,OAAO;AAEtB,MAAM,8BAA8B,CACzC,aAEA,OAAO,aAAa,OAAO;AAMtB,MAAM,eAAe,CAC1B,SACuC,UAAU,KAAK;AAEjD,MAAM,WAAW,CACtB,SACuC,UAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/utils/use-set-map-initial-configuration.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { MapRef } from '@vis.gl/react-maplibre';\nimport { isNil } from 'lodash-es';\nimport { useCallback } from 'react';\n\nexport const useSetMapInitialConfiguration = () =>\n useCallback((mapRef: MapRef) => {\n if (isNil(mapRef)) {\n return;\n }\n\n mapRef.getMap()?.touchZoomRotate?.disableRotation();\n }, []);\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAErB,MAAM,gCAAgC,MAC3C,YAAY,CAAC,WAAmB;AAC9B,MAAI,MAAM,MAAM,GAAG;AACjB;AAAA,EACF;AAEA,SAAO,OAAO,GAAG,iBAAiB,gBAAgB;AACpD,GAAG,CAAC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { ChoroplethLayer } from './map/slots/ChoroplethLayer.js';
|
|
|
8
8
|
export { Tooltip, TooltipAtoms } from './map/slots/Tooltip.js';
|
|
9
9
|
export type { MapViewProps, MapViewBaseProps, MapViewUncontrolledProps, MapViewControlledProps, DisallowAll, ViewState, MapViewRef, } from './map/types/map-view.js';
|
|
10
10
|
export type { BaseLayerProps } from './map/types/base-layer.js';
|
|
11
|
-
export type { Connection, ConnectionLayerProps, CurvedLine, } from './map/types/connection-layer.js';
|
|
11
|
+
export type { Connection, ConnectionLayerBaseProps, ConnectionLayerProps, CurvedLine, } from './map/types/connection-layer.js';
|
|
12
12
|
export type { DotLayerBaseProps, DotLayerProps, } from './map/types/dot-layer.js';
|
|
13
13
|
export type { BubbleLayerBaseProps, BubbleLayerProps, ScaleNoneProps, ScaleRadiusProps, } from './map/types/bubble-layer.js';
|
|
14
14
|
export type { ChoroplethLayerBaseProps, ChoroplethLayerProps, } from './map/types/choropleth-layer.js';
|
|
@@ -17,7 +17,7 @@ export type { MapShape } from './map/types/shapes.js';
|
|
|
17
17
|
export type { ChartInteractionsProps } from './map/types/toolbar.js';
|
|
18
18
|
export type { ErrorStateSlotProps } from './map/slots/states/ErrorStateSlot.js';
|
|
19
19
|
export type { BaseLegendProps, CategoricalLegendProps, SequentialLegendProps, ThresholdLegendProps, } from './map/types/legend.js';
|
|
20
|
-
export type { LocationColorProps, LegendColorLayerProps, ChoroplethCustomColorProps, } from './map/types/coloring.js';
|
|
20
|
+
export type { LocationColorProps, LegendColorLayerProps, ChoroplethCustomColorProps, ConnectionColorProps, } from './map/types/coloring.js';
|
|
21
21
|
export { SequentialLegend } from './map/slots/SequentialLegend.js';
|
|
22
22
|
export { ThresholdLegend } from './map/slots/ThresholdLegend.js';
|
|
23
23
|
export { CategoricalLegend } from './map/slots/CategoricalLegend.js';
|
package/map/MapView.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { MapViewProps, MapViewRef } from './types/map-view.js';
|
|
|
3
3
|
import './styles/react-mapgl-styles.css';
|
|
4
4
|
/**
|
|
5
5
|
* The `MapView` is a component that renders a map with various geospatial data layers.
|
|
6
|
-
* @
|
|
6
|
+
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare const MapView: ((props: React.PropsWithChildren<MapViewProps> & React.RefAttributes<MapViewRef>) => React.ReactElement | null) & {
|
|
9
9
|
ErrorState: (props: import("./slots/states/ErrorStateSlot.js").ErrorStateSlotProps) => null;
|
package/map/MapView.js
CHANGED
|
@@ -64,22 +64,25 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
64
64
|
truncationMode,
|
|
65
65
|
...remaining
|
|
66
66
|
} = props;
|
|
67
|
-
const { layerIds, parsedChildren,
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
const { layerIds, parsedChildren, valueAccessors } = (0, import_set_layers_id.setLayersId)(children);
|
|
68
|
+
const {
|
|
69
|
+
flattenData: layersData,
|
|
70
|
+
categories,
|
|
71
|
+
legendDomain
|
|
72
|
+
} = (0, import_extract_layers_data.extractLayersData)(parsedChildren, valueAccessors);
|
|
73
|
+
const config = (0, import_iterate_config_slots.iterateConfigSlots)(children, legendDomain);
|
|
73
74
|
const isLegendHidden = !config.legend || !!config.legend.hidden;
|
|
74
75
|
const legendPosition = config.legend?.position;
|
|
75
76
|
const legendRatio = config.legend?.ratio;
|
|
76
77
|
const legendOnRatioChange = config.legend?.onRatioChange;
|
|
77
|
-
const { isMapEnabled,
|
|
78
|
+
const { isMapEnabled, isFetchingFeatures, baseFeatureCollection, error } = (0, import_use_load_map_base_layer.useLoadMapBaseLayer)(config.baseLayer);
|
|
79
|
+
const [isMapLoaded, setIsMapLoaded] = (0, import_react.useState)(false);
|
|
78
80
|
const { errorState } = (0, import_get_map_states_template.getMapStatesTemplates)(children);
|
|
79
81
|
const chartHeight = (0, import_charts._coerceSizeValue)(props.height) || import_constants.DEFAULT_MAP_HEIGHT;
|
|
80
82
|
const containerStyles = { width: "100%", ...costumerStyle };
|
|
81
83
|
const chartLayoutRef = (0, import_charts._useAutoLegendRefresh)(layersData);
|
|
82
|
-
const mapUnavailable = !
|
|
84
|
+
const mapUnavailable = !isFetchingFeatures && !isMapEnabled || error;
|
|
85
|
+
const isLoading = isFetchingFeatures || !isMapLoaded;
|
|
83
86
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
84
87
|
"div",
|
|
85
88
|
{
|
|
@@ -91,7 +94,7 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
91
94
|
mapUnavailable ? /* @__PURE__ */ import_react.default.createElement(
|
|
92
95
|
import_MapUnavailable.MapUnavailable,
|
|
93
96
|
{
|
|
94
|
-
|
|
97
|
+
isFetchingFeatures,
|
|
95
98
|
isDisabled: !isMapEnabled,
|
|
96
99
|
chartHeight,
|
|
97
100
|
error
|
|
@@ -118,6 +121,7 @@ const _MapView = (0, import_react.forwardRef)(
|
|
|
118
121
|
import_MapContent.MapContent,
|
|
119
122
|
{
|
|
120
123
|
ref: forwardedRef,
|
|
124
|
+
onMapLoad: () => setIsMapLoaded(true),
|
|
121
125
|
...remaining
|
|
122
126
|
},
|
|
123
127
|
parsedChildren
|
|
@@ -30,8 +30,8 @@ __export(BubbleCircleLayer_exports, {
|
|
|
30
30
|
BubbleCircleLayer: () => BubbleCircleLayer
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(BubbleCircleLayer_exports);
|
|
33
|
+
var import_react_maplibre = require("@vis.gl/react-maplibre");
|
|
33
34
|
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_maplibre = require("react-map-gl/maplibre");
|
|
35
35
|
var import_use_size_interpolation = require("./hooks/use-size-interpolation.js");
|
|
36
36
|
var import_build_stick_to_distance_expressions = require("./utils/build-stick-to-distance-expressions.js");
|
|
37
37
|
var import_constants = require("../../constants.js");
|
|
@@ -42,7 +42,7 @@ const BubbleCircleLayer = ({
|
|
|
42
42
|
const sizeInterpolation = (0, import_use_size_interpolation.useSizeInterpolation)();
|
|
43
43
|
const radiusExpression = sizeInterpolation === "fixed" ? import_constants.DEFAULT_RADIUS_EXPRESSION : (0, import_build_stick_to_distance_expressions.buildCircleStickToDistanceExpression)();
|
|
44
44
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
45
|
-
|
|
45
|
+
import_react_maplibre.Layer,
|
|
46
46
|
{
|
|
47
47
|
type: "circle",
|
|
48
48
|
id,
|
|
@@ -59,7 +59,7 @@ const BubbleCircleLayer = ({
|
|
|
59
59
|
"case",
|
|
60
60
|
["boolean", ["feature-state", "legendHover"], true],
|
|
61
61
|
import_constants.BUBBLE_DEFAULT_OPACITY,
|
|
62
|
-
import_constants.
|
|
62
|
+
import_constants.SHAPE_OPACITY_DIMMED
|
|
63
63
|
],
|
|
64
64
|
"circle-stroke-width": import_constants.BUBBLE_STROKE,
|
|
65
65
|
"circle-stroke-color": [
|
|
@@ -71,8 +71,8 @@ const BubbleCircleLayer = ({
|
|
|
71
71
|
"circle-stroke-opacity": [
|
|
72
72
|
"case",
|
|
73
73
|
["boolean", ["feature-state", "legendHover"], true],
|
|
74
|
-
import_constants.
|
|
75
|
-
import_constants.
|
|
74
|
+
import_constants.SHAPE_OPACITY_DEFAULT,
|
|
75
|
+
import_constants.SHAPE_OPACITY_DIMMED
|
|
76
76
|
]
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -30,8 +30,8 @@ __export(BubbleLayer_exports, {
|
|
|
30
30
|
BubbleLayer: () => BubbleLayer
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(BubbleLayer_exports);
|
|
33
|
+
var import_react_maplibre = require("@vis.gl/react-maplibre");
|
|
33
34
|
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_maplibre = require("react-map-gl/maplibre");
|
|
35
35
|
var import_BubbleCircleLayer = require("./BubbleCircleLayer.js");
|
|
36
36
|
var import_BubbleLayerTooltip = require("./BubbleLayerTooltip.js");
|
|
37
37
|
var import_BubbleOutlineLayer = require("./BubbleOutlineLayer.js");
|
|
@@ -76,7 +76,7 @@ const BubbleLayer = (props) => {
|
|
|
76
76
|
radiusScale
|
|
77
77
|
);
|
|
78
78
|
const tooltipTemplate = (0, import_use_tooltip_template.useTooltipTemplate)(children, import_BubbleLayerTooltip2.BubbleLayerTooltip);
|
|
79
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_size_interpolation_context.SizeInterpolationContext.Provider, { value: sizeInterpolation }, /* @__PURE__ */ import_react.default.createElement(
|
|
79
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_size_interpolation_context.SizeInterpolationContext.Provider, { value: sizeInterpolation }, /* @__PURE__ */ import_react.default.createElement(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: dataGeoJson, generateId: true }, /* @__PURE__ */ import_react.default.createElement(import_BubbleCircleLayer.BubbleCircleLayer, { id: layerId, source: sourceId }), /* @__PURE__ */ import_react.default.createElement(import_BubbleOutlineLayer.BubbleOutlineLayer, { beforeId: layerId, source: sourceId }))), /* @__PURE__ */ import_react.default.createElement(
|
|
80
80
|
import_BubbleLayerTooltip.BubbleLayerTooltip,
|
|
81
81
|
{
|
|
82
82
|
layerId,
|
|
@@ -30,8 +30,8 @@ __export(BubbleOutlineLayer_exports, {
|
|
|
30
30
|
BubbleOutlineLayer: () => BubbleOutlineLayer
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(BubbleOutlineLayer_exports);
|
|
33
|
+
var import_react_maplibre = require("@vis.gl/react-maplibre");
|
|
33
34
|
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_maplibre = require("react-map-gl/maplibre");
|
|
35
35
|
var import_charts = require("@dynatrace/strato-components-preview/charts");
|
|
36
36
|
var import_use_size_interpolation = require("./hooks/use-size-interpolation.js");
|
|
37
37
|
var import_add_outline_size = require("./utils/add-outline-size.js");
|
|
@@ -47,7 +47,7 @@ const BubbleOutlineLayer = ({
|
|
|
47
47
|
const sizeInterpolation = (0, import_use_size_interpolation.useSizeInterpolation)();
|
|
48
48
|
const outlineRadiusExpression = sizeInterpolation === "fixed" ? DEFAULT_OUTLINE_RADIUS_EXPRESSION : (0, import_build_stick_to_distance_expressions.buildOutlineStickToDistanceExpression)();
|
|
49
49
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
-
|
|
50
|
+
import_react_maplibre.Layer,
|
|
51
51
|
{
|
|
52
52
|
type: "circle",
|
|
53
53
|
beforeId,
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import type { ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
2
|
+
import type GeoJSON from 'geojson';
|
|
2
3
|
import type { Location } from '../../../types/location.js';
|
|
3
4
|
type RadiusScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number> | ((value: number) => number);
|
|
4
|
-
export declare const parseBubbleDataToGeoJSON: <T extends Location>(data: T[], color: string | ((item: T) => string), radius: number | ((item: T) => number), scale: RadiusScale) =>
|
|
5
|
-
type: string;
|
|
6
|
-
features: {
|
|
7
|
-
type: string;
|
|
8
|
-
properties: {
|
|
9
|
-
data: T;
|
|
10
|
-
} & Omit<T, "latitude" | "longitude"> & {
|
|
11
|
-
__color: string;
|
|
12
|
-
__hoveredColor: string;
|
|
13
|
-
__radius: number;
|
|
14
|
-
__lat: number;
|
|
15
|
-
};
|
|
16
|
-
geometry: {
|
|
17
|
-
type: string;
|
|
18
|
-
coordinates: number[];
|
|
19
|
-
};
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
5
|
+
export declare const parseBubbleDataToGeoJSON: <T extends Location>(data: T[], color: string | ((item: T) => string), radius: number | ((item: T) => number), scale: RadiusScale) => GeoJSON.FeatureCollection;
|
|
22
6
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import type { InternalChoroplethLayerProps } from '../../types/choropleth-layer.js';
|
|
3
3
|
export declare const ChoroplethLayer: {
|
|
4
|
-
<T extends Record<string, unknown>>(props: PropsWithChildren<InternalChoroplethLayerProps<T>>): React.JSX.Element;
|
|
4
|
+
<T extends Record<string, unknown>>(props: PropsWithChildren<InternalChoroplethLayerProps<T>>): React.JSX.Element | undefined;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
@@ -30,8 +30,8 @@ __export(ChoroplethLayer_exports, {
|
|
|
30
30
|
ChoroplethLayer: () => ChoroplethLayer
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(ChoroplethLayer_exports);
|
|
33
|
+
var import_react_maplibre = require("@vis.gl/react-maplibre");
|
|
33
34
|
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_maplibre = require("react-map-gl/maplibre");
|
|
35
35
|
var import_charts = require("@dynatrace/strato-components-preview/charts");
|
|
36
36
|
var import_ChoroplethLayerTooltip = require("./ChoroplethLayerTooltip.js");
|
|
37
37
|
var import_parse_region_data_to_geo_json = require("./utils/parse-region-data-to-geo-json.js");
|
|
@@ -61,51 +61,71 @@ const ChoroplethLayer = (props) => {
|
|
|
61
61
|
children,
|
|
62
62
|
import_ChoroplethLayerTooltip2.ChoroplethLayerTooltip
|
|
63
63
|
);
|
|
64
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
65
|
-
|
|
64
|
+
return dataGeoJSON && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_react_maplibre.Source, { id: sourceId, type: "geojson", data: dataGeoJSON, generateId: true }, /* @__PURE__ */ import_react.default.createElement(
|
|
65
|
+
import_react_maplibre.Layer,
|
|
66
66
|
{
|
|
67
67
|
id: layerId,
|
|
68
|
-
type: "fill",
|
|
69
68
|
source: sourceId,
|
|
69
|
+
type: "fill",
|
|
70
70
|
paint: {
|
|
71
|
-
"fill-color": [
|
|
72
|
-
"case",
|
|
73
|
-
["boolean", ["feature-state", "active"], false],
|
|
74
|
-
["get", "__color"],
|
|
75
|
-
["boolean", ["feature-state", "hover"], false],
|
|
76
|
-
["get", "__hoveredColor"],
|
|
77
|
-
["get", "__color"]
|
|
78
|
-
],
|
|
71
|
+
"fill-color": ["get", "__color"],
|
|
79
72
|
"fill-opacity": [
|
|
80
73
|
"case",
|
|
81
|
-
["
|
|
82
|
-
import_constants.
|
|
83
|
-
|
|
74
|
+
["==", ["feature-state", "legendHover"], false],
|
|
75
|
+
import_constants.SHAPE_OPACITY_DIMMED,
|
|
76
|
+
["==", ["feature-state", "active"], true],
|
|
77
|
+
import_constants.SHAPE_OPACITY_DEFAULT,
|
|
78
|
+
["==", ["feature-state", "hover"], true],
|
|
79
|
+
import_constants.SHAPE_OPACITY_DEFAULT,
|
|
80
|
+
["==", ["feature-state", "legendHover"], true],
|
|
81
|
+
import_constants.SHAPE_OPACITY_DEFAULT,
|
|
82
|
+
["==", ["feature-state", "isAnyActive"], true],
|
|
83
|
+
import_constants.SHAPE_OPACITY_DIMMED,
|
|
84
|
+
import_constants.SHAPE_OPACITY_DEFAULT
|
|
84
85
|
]
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
88
|
-
|
|
89
|
+
import_react_maplibre.Layer,
|
|
89
90
|
{
|
|
90
|
-
type: "line",
|
|
91
91
|
source: sourceId,
|
|
92
|
+
type: "line",
|
|
92
93
|
paint: {
|
|
93
|
-
"line-color":
|
|
94
|
+
"line-color": [
|
|
95
|
+
"case",
|
|
96
|
+
["==", ["feature-state", "active"], true],
|
|
97
|
+
(0, import_charts._getCanvasColor)(import_constants.DEFAULT_BOUNDARIES_BORDER_COLOR),
|
|
98
|
+
["==", ["feature-state", "hover"], true],
|
|
99
|
+
(0, import_charts._getCanvasColor)(import_constants.DEFAULT_BOUNDARIES_BORDER_COLOR),
|
|
100
|
+
(0, import_charts._getCanvasColor)(import_constants.DEFAULT_BOUNDARIES_BORDER_COLOR)
|
|
101
|
+
],
|
|
102
|
+
"line-width": [
|
|
103
|
+
"case",
|
|
104
|
+
["==", ["feature-state", "active"], true],
|
|
105
|
+
import_constants.ACTIVE_BORDER_WIDTH_OUTER,
|
|
106
|
+
["==", ["feature-state", "hover"], true],
|
|
107
|
+
import_constants.ACTIVE_BORDER_WIDTH_OUTER,
|
|
108
|
+
["==", ["get", "region_type"], "REGION"],
|
|
109
|
+
import_constants.REGION_BORDER_WIDTH,
|
|
110
|
+
import_constants.COUNTRY_BORDER_WIDTH
|
|
111
|
+
]
|
|
94
112
|
}
|
|
95
113
|
}
|
|
96
114
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
97
|
-
|
|
115
|
+
import_react_maplibre.Layer,
|
|
98
116
|
{
|
|
99
|
-
type: "line",
|
|
100
117
|
source: sourceId,
|
|
118
|
+
type: "line",
|
|
101
119
|
paint: {
|
|
102
120
|
"line-color": [
|
|
103
121
|
"case",
|
|
104
|
-
["
|
|
122
|
+
["==", ["feature-state", "active"], true],
|
|
123
|
+
(0, import_charts._getCanvasColor)(import_constants.ACTIVE_COLOR),
|
|
124
|
+
["==", ["feature-state", "hover"], true],
|
|
105
125
|
(0, import_charts._getCanvasColor)(import_constants.ACTIVE_COLOR),
|
|
106
126
|
(0, import_charts._getCanvasColor)(import_constants.TRANSPARENT_BORDER_COLOR)
|
|
107
127
|
],
|
|
108
|
-
"line-width": import_constants.
|
|
128
|
+
"line-width": import_constants.ACTIVE_BORDER_WIDTH_INNER
|
|
109
129
|
}
|
|
110
130
|
}
|
|
111
131
|
)), /* @__PURE__ */ import_react.default.createElement(
|