@dynatrace/strato-geo 1.3.4 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/map/MapView.js +31 -24
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/MapContent.js +43 -4
- package/esm/map/components/MapContent.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapResetButton.js +6 -1
- package/esm/map/components/toolbar/buttons/MapResetButton.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js +4 -4
- package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js +6 -1
- package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js.map +2 -2
- package/esm/map/components/toolbar/utils/zoom-state-utils.js +36 -0
- package/esm/map/components/toolbar/utils/zoom-state-utils.js.map +7 -0
- package/esm/map/constants.js +6 -0
- package/esm/map/constants.js.map +2 -2
- package/esm/map/contexts/map-data-bounding-box.context.js +3 -1
- package/esm/map/contexts/map-data-bounding-box.context.js.map +2 -2
- package/esm/map/hooks/use-active-interaction.js +16 -12
- package/esm/map/hooks/use-active-interaction.js.map +2 -2
- package/esm/map/hooks/use-resolve-color.js +5 -2
- package/esm/map/hooks/use-resolve-color.js.map +2 -2
- package/esm/map/providers/color-scale.provider.js +2 -1
- package/esm/map/providers/color-scale.provider.js.map +2 -2
- package/esm/map/providers/imperative-handler.provider.js +7 -1
- package/esm/map/providers/imperative-handler.provider.js.map +2 -2
- package/esm/map/store/map-store.context.js +7 -1
- package/esm/map/store/map-store.context.js.map +2 -2
- package/esm/map/store/selectors.js +2 -0
- package/esm/map/store/selectors.js.map +2 -2
- package/esm/map/store/store.js +13 -0
- package/esm/map/store/store.js.map +2 -2
- package/esm/map/utils/build-scale-from-legend-config.js +4 -2
- package/esm/map/utils/build-scale-from-legend-config.js.map +2 -2
- package/esm/map/utils/extract-layers-data.js +4 -4
- package/esm/map/utils/extract-layers-data.js.map +2 -2
- package/esm/map/utils/get-data-layers-bounding-box.js +1 -1
- package/esm/map/utils/get-data-layers-bounding-box.js.map +2 -2
- package/esm/map/utils/iterate-config-slots.js +7 -1
- package/esm/map/utils/iterate-config-slots.js.map +2 -2
- package/esm/map/utils/replace-infinite-values-in-ranges.js +30 -0
- package/esm/map/utils/replace-infinite-values-in-ranges.js.map +7 -0
- package/esm/map/utils/to-mapbox-initial-view-state.js.map +2 -2
- package/index.js +3 -3
- package/map/MapView.js +31 -24
- package/map/components/MapContent.js +36 -2
- package/map/components/toolbar/buttons/MapResetButton.js +6 -1
- package/map/components/toolbar/buttons/MapZoomInOutButtons.js +4 -4
- package/map/components/toolbar/buttons/MapZoomToFitButton.js +6 -1
- package/map/components/toolbar/utils/zoom-state-utils.d.ts +4 -0
- package/map/components/toolbar/utils/zoom-state-utils.js +47 -0
- package/map/constants.d.ts +5 -1
- package/map/constants.js +6 -0
- package/map/contexts/map-data-bounding-box.context.d.ts +2 -1
- package/map/contexts/map-data-bounding-box.context.js +3 -1
- package/map/hooks/use-active-interaction.js +16 -12
- package/map/hooks/use-data-bounding-box.d.ts +1 -1
- package/map/hooks/use-resolve-color.js +1 -1
- package/map/providers/color-scale.provider.d.ts +3 -1
- package/map/providers/color-scale.provider.js +2 -1
- package/map/providers/imperative-handler.provider.js +7 -1
- package/map/store/map-store.context.d.ts +6 -0
- package/map/store/map-store.context.js +7 -1
- package/map/store/selectors.d.ts +1 -0
- package/map/store/selectors.js +2 -0
- package/map/store/store.d.ts +2 -1
- package/map/store/store.js +13 -0
- package/map/types/map-view.d.ts +2 -0
- package/map/types/state.d.ts +8 -0
- package/map/utils/build-scale-from-legend-config.d.ts +1 -1
- package/map/utils/build-scale-from-legend-config.js +4 -2
- package/map/utils/extract-layers-data.js +4 -4
- package/map/utils/get-data-layers-bounding-box.d.ts +2 -1
- package/map/utils/get-data-layers-bounding-box.js +1 -1
- package/map/utils/iterate-config-slots.js +7 -1
- package/map/utils/replace-infinite-values-in-ranges.d.ts +6 -0
- package/map/{components/legend/utils/resolve-color.js → utils/replace-infinite-values-in-ranges.js} +27 -18
- package/map/utils/to-mapbox-initial-view-state.d.ts +6 -4
- package/package.json +4 -4
- package/esm/map/components/legend/utils/resolve-color.js +0 -21
- package/esm/map/components/legend/utils/resolve-color.js.map +0 -7
- package/map/components/legend/utils/resolve-color.d.ts +0 -8
|
@@ -31,13 +31,15 @@ var import_create_categorical_color_scheme_from_legend_props = require("./create
|
|
|
31
31
|
const isThresholdLegend = (legendConfig) => legendConfig.type === "threshold";
|
|
32
32
|
const isSequentialLegend = (legendConfig) => legendConfig.type === "sequential";
|
|
33
33
|
const isCategoricalLegend = (legendConfig) => legendConfig.type === "categorical";
|
|
34
|
-
const buildScaleFromLegendConfig = (mapLegendConfig, categories) => {
|
|
34
|
+
const buildScaleFromLegendConfig = (mapLegendConfig, categories, dataMax) => {
|
|
35
35
|
if (isSequentialLegend(mapLegendConfig)) {
|
|
36
36
|
const { min, max, colorPalette } = mapLegendConfig;
|
|
37
37
|
return (0, import_charts._buildQuantizeScaleFromColorPalette)(min, max, colorPalette);
|
|
38
38
|
} else if (isThresholdLegend(mapLegendConfig)) {
|
|
39
39
|
const { ranges } = mapLegendConfig;
|
|
40
|
-
return (0, import_charts._buildThresholdScaleFromRanges)(ranges, import_constants.DEFAULT_RANGE_COLOR
|
|
40
|
+
return (0, import_charts._buildThresholdScaleFromRanges)(ranges, import_constants.DEFAULT_RANGE_COLOR, {
|
|
41
|
+
max: dataMax
|
|
42
|
+
});
|
|
41
43
|
} else if (isCategoricalLegend(mapLegendConfig)) {
|
|
42
44
|
const isArrayOfColors = Array.isArray(mapLegendConfig.colorPalette);
|
|
43
45
|
const isDefaultColorPalette = import_charts.colorPaletteOptions.includes(
|
|
@@ -43,14 +43,14 @@ const addCategory = (extendedDataPoint, valueAccessor) => {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
const updateDomain = (domain, value) => {
|
|
46
|
-
|
|
46
|
+
let [min, max] = domain;
|
|
47
47
|
if (value < min) {
|
|
48
|
-
|
|
48
|
+
min = value;
|
|
49
49
|
}
|
|
50
50
|
if (value > max) {
|
|
51
|
-
|
|
51
|
+
max = value;
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return [min, max];
|
|
54
54
|
};
|
|
55
55
|
const extractLayersData = (children, valueAccessors) => {
|
|
56
56
|
let flattenData = [];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Feature } from 'geojson';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
import type { BoundingBoxCoords } from '../types/map-view.js';
|
|
4
|
+
export declare const getDataLayersBoundingBox: (children: React.ReactNode, featureCollection?: Feature[]) => BoundingBoxCoords;
|
|
@@ -32,12 +32,12 @@ __export(get_data_layers_bounding_box_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(get_data_layers_bounding_box_exports);
|
|
33
33
|
var import_react = __toESM(require("react"));
|
|
34
34
|
var import_core = require("@dynatrace/strato-components-preview/core");
|
|
35
|
+
var import_is_component = require("./is-component.js");
|
|
35
36
|
var import_BubbleLayer = require("../components/BubbleLayer/BubbleLayer.js");
|
|
36
37
|
var import_ChoroplethLayer = require("../components/ChoroplethLayer/ChoroplethLayer.js");
|
|
37
38
|
var import_ConnectionLayer = require("../components/ConnectionLayer/ConnectionLayer.js");
|
|
38
39
|
var import_DotLayer = require("../components/DotLayer/DotLayer.js");
|
|
39
40
|
var import_constants = require("../constants.js");
|
|
40
|
-
var import_is_component = require("./is-component.js");
|
|
41
41
|
const narrowDownLocationBounds = (coordinates, initialBounds) => {
|
|
42
42
|
const bounds = [...initialBounds];
|
|
43
43
|
coordinates.forEach(({ latitude, longitude }) => {
|
|
@@ -34,6 +34,7 @@ var import_react = __toESM(require("react"));
|
|
|
34
34
|
var import_react_is = require("react-is");
|
|
35
35
|
var import_charts = require("@dynatrace/strato-components-preview/charts");
|
|
36
36
|
var import_constants = require("../constants.js");
|
|
37
|
+
var import_replace_infinite_values_in_ranges = require("./replace-infinite-values-in-ranges.js");
|
|
37
38
|
var import_BaseLayer = require("../slots/BaseLayer.js");
|
|
38
39
|
var import_CategoricalLegend = require("../slots/CategoricalLegend.js");
|
|
39
40
|
var import_ChartInteractions = require("../slots/ChartInteractions.js");
|
|
@@ -103,13 +104,18 @@ const iterateConfigSlots = (children, legendDomain) => {
|
|
|
103
104
|
}
|
|
104
105
|
case import_ThresholdLegend.ThresholdLegend: {
|
|
105
106
|
const { children: children2, ...legend } = child.props;
|
|
107
|
+
const ranges = (0, import_replace_infinite_values_in_ranges.replaceInfiniteValuesInRanges)(
|
|
108
|
+
legend.ranges,
|
|
109
|
+
legendDomain
|
|
110
|
+
);
|
|
106
111
|
slots = {
|
|
107
112
|
...slots,
|
|
108
113
|
legend: {
|
|
109
114
|
type: "threshold",
|
|
110
115
|
position: import_constants.DEFAULT_MAP_POSITION,
|
|
111
116
|
ratio: import_constants.DEFAULT_MAP_LEGEND_RATIO,
|
|
112
|
-
...legend
|
|
117
|
+
...legend,
|
|
118
|
+
ranges
|
|
113
119
|
}
|
|
114
120
|
};
|
|
115
121
|
break;
|
package/map/{components/legend/utils/resolve-color.js → utils/replace-infinite-values-in-ranges.js}
RENAMED
|
@@ -15,25 +15,34 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
20
|
-
|
|
18
|
+
var replace_infinite_values_in_ranges_exports = {};
|
|
19
|
+
__export(replace_infinite_values_in_ranges_exports, {
|
|
20
|
+
replaceInfiniteValuesInRanges: () => replaceInfiniteValuesInRanges
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
module.exports = __toCommonJS(replace_infinite_values_in_ranges_exports);
|
|
23
|
+
const replaceInfiniteValuesInRanges = (ranges, domain) => {
|
|
24
|
+
const replaceInfiniteValues = (value) => {
|
|
25
|
+
if (value === -Infinity) {
|
|
26
|
+
if (domain[0] >= 0) {
|
|
27
|
+
return 0;
|
|
28
|
+
} else {
|
|
29
|
+
return domain[0];
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
if (value === Infinity) {
|
|
33
|
+
if (domain[1] <= 0) {
|
|
34
|
+
return 0;
|
|
35
|
+
} else {
|
|
36
|
+
return domain[1];
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
return ranges.map((range) => {
|
|
42
|
+
return {
|
|
43
|
+
...range,
|
|
44
|
+
from: replaceInfiniteValues(range.from),
|
|
45
|
+
to: replaceInfiniteValues(range.to)
|
|
46
|
+
};
|
|
47
|
+
});
|
|
39
48
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { PaddingOptions } from 'maplibre-gl';
|
|
2
|
+
import type { BoundingBoxCoords, ViewState } from '../types/map-view.js';
|
|
3
|
+
export type InitialBounds = {
|
|
4
|
+
bounds: BoundingBoxCoords;
|
|
4
5
|
fitBoundsOptions: {
|
|
5
|
-
padding: number;
|
|
6
|
+
padding: number | PaddingOptions;
|
|
6
7
|
};
|
|
7
8
|
};
|
|
9
|
+
export declare const toMapBoxInitialViewState: (initialViewState: ViewState | BoundingBoxCoords) => ViewState | InitialBounds;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-geo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"lang": "lang/uncompiled",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"react-dom": "^18.0.0",
|
|
48
48
|
"react-intl": "^6.0.8",
|
|
49
49
|
"react-is": "^18.0.0",
|
|
50
|
-
"@dynatrace/strato-components": "^1.
|
|
51
|
-
"@dynatrace/strato-components-preview": "^1.
|
|
50
|
+
"@dynatrace/strato-components": "^1.4.0",
|
|
51
|
+
"@dynatrace/strato-components-preview": "^1.4.2",
|
|
52
52
|
"@dynatrace/strato-design-tokens": "^1.0.0",
|
|
53
|
-
"@dynatrace/strato-icons": "^1.
|
|
53
|
+
"@dynatrace/strato-icons": "^1.3.0"
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": [
|
|
56
56
|
"./map/styles/react-mapgl-styles.css",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const resolveColor = (scale, value) => {
|
|
2
|
-
if (typeof value === "string") {
|
|
3
|
-
const castedScale = scale;
|
|
4
|
-
const categories = castedScale.domain();
|
|
5
|
-
if (categories.includes(value)) {
|
|
6
|
-
return castedScale(value);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
if (typeof value === "number") {
|
|
10
|
-
const castedScale = scale;
|
|
11
|
-
const [min, max] = castedScale.domain();
|
|
12
|
-
if (value && value >= min && value <= max) {
|
|
13
|
-
return castedScale(value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return void 0;
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
resolveColor
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=resolve-color.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../src/map/components/legend/utils/resolve-color.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ScaleOrdinal, ScaleQuantize, ScaleThreshold } from 'd3-scale';\n\n/**\n * Resolves a color inside the given scale just if it fits its domain\n *\n * @param scale - given scale\n * @param value - given value\n */\nexport const resolveColor = (\n scale:\n | ScaleQuantize<string>\n | ScaleThreshold<number, string>\n | ScaleOrdinal<string, string>,\n value: number | string | undefined,\n) => {\n if (typeof value === 'string') {\n const castedScale = scale as ScaleOrdinal<string, string>;\n const categories = castedScale.domain();\n\n if (categories.includes(value)) {\n return castedScale(value);\n }\n }\n\n if (typeof value === 'number') {\n const castedScale = scale as\n | ScaleQuantize<string>\n | ScaleThreshold<number, string>;\n const [min, max] = castedScale.domain();\n if (value && value >= min && value <= max) {\n return castedScale(value);\n }\n }\n\n return undefined;\n};\n"],
|
|
5
|
-
"mappings": "AAQO,MAAM,eAAe,CAC1B,OAIA,UACG;AACH,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,cAAc;AACpB,UAAM,aAAa,YAAY,OAAO;AAEtC,QAAI,WAAW,SAAS,KAAK,GAAG;AAC9B,aAAO,YAAY,KAAK;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,cAAc;AAGpB,UAAM,CAAC,KAAK,GAAG,IAAI,YAAY,OAAO;AACtC,QAAI,SAAS,SAAS,OAAO,SAAS,KAAK;AACzC,aAAO,YAAY,KAAK;AAAA,IAC1B;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ScaleOrdinal, ScaleQuantize, ScaleThreshold } from 'd3-scale';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a color inside the given scale just if it fits its domain
|
|
4
|
-
*
|
|
5
|
-
* @param scale - given scale
|
|
6
|
-
* @param value - given value
|
|
7
|
-
*/
|
|
8
|
-
export declare const resolveColor: (scale: ScaleQuantize<string> | ScaleThreshold<number, string> | ScaleOrdinal<string, string>, value: number | string | undefined) => string | undefined;
|