@gooddata/sdk-ui-geo 11.6.0-alpha.5 → 11.6.0-alpha.7
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/next/GeoPushpinChartNext.d.ts +12 -0
- package/esm/next/GeoPushpinChartNext.d.ts.map +1 -0
- package/esm/next/GeoPushpinChartNext.js +42 -0
- package/esm/next/GeoPushpinChartNext.js.map +1 -0
- package/esm/next/RenderGeoPushpinChart.d.ts +15 -0
- package/esm/next/RenderGeoPushpinChart.d.ts.map +1 -0
- package/esm/next/RenderGeoPushpinChart.js +97 -0
- package/esm/next/RenderGeoPushpinChart.js.map +1 -0
- package/esm/next/components/ErrorComponent.d.ts +13 -0
- package/esm/next/components/ErrorComponent.d.ts.map +1 -0
- package/esm/next/components/ErrorComponent.js +19 -0
- package/esm/next/components/ErrorComponent.js.map +1 -0
- package/esm/next/components/LoadingComponent.d.ts +5 -0
- package/esm/next/components/LoadingComponent.d.ts.map +1 -0
- package/esm/next/components/LoadingComponent.js +13 -0
- package/esm/next/components/LoadingComponent.js.map +1 -0
- package/esm/next/components/legends/Legend.d.ts +28 -0
- package/esm/next/components/legends/Legend.d.ts.map +1 -0
- package/esm/next/components/legends/Legend.js +54 -0
- package/esm/next/components/legends/Legend.js.map +1 -0
- package/esm/next/components/legends/LegendBody.d.ts +12 -0
- package/esm/next/components/legends/LegendBody.d.ts.map +1 -0
- package/esm/next/components/legends/LegendBody.js +30 -0
- package/esm/next/components/legends/LegendBody.js.map +1 -0
- package/esm/next/components/legends/legendPropsAdapter.d.ts +14 -0
- package/esm/next/components/legends/legendPropsAdapter.d.ts.map +1 -0
- package/esm/next/components/legends/legendPropsAdapter.js +34 -0
- package/esm/next/components/legends/legendPropsAdapter.js.map +1 -0
- package/esm/next/components/legends/types.d.ts +16 -0
- package/esm/next/components/legends/types.d.ts.map +1 -0
- package/esm/next/components/legends/types.js +3 -0
- package/esm/next/components/legends/types.js.map +1 -0
- package/esm/next/constants/geoChart.d.ts +108 -0
- package/esm/next/constants/geoChart.d.ts.map +1 -0
- package/esm/next/constants/geoChart.js +130 -0
- package/esm/next/constants/geoChart.js.map +1 -0
- package/esm/next/constants/internal.d.ts +19 -0
- package/esm/next/constants/internal.d.ts.map +1 -0
- package/esm/next/constants/internal.js +20 -0
- package/esm/next/constants/internal.js.map +1 -0
- package/esm/next/context/GeoDataContext.d.ts +69 -0
- package/esm/next/context/GeoDataContext.d.ts.map +1 -0
- package/esm/next/context/GeoDataContext.js +80 -0
- package/esm/next/context/GeoDataContext.js.map +1 -0
- package/esm/next/context/GeoLegendContext.d.ts +78 -0
- package/esm/next/context/GeoLegendContext.d.ts.map +1 -0
- package/esm/next/context/GeoLegendContext.js +74 -0
- package/esm/next/context/GeoLegendContext.js.map +1 -0
- package/esm/next/context/GeoPushpinPropsContext.d.ts +47 -0
- package/esm/next/context/GeoPushpinPropsContext.d.ts.map +1 -0
- package/esm/next/context/GeoPushpinPropsContext.js +81 -0
- package/esm/next/context/GeoPushpinPropsContext.js.map +1 -0
- package/esm/next/context/InitialExecutionContext.d.ts +43 -0
- package/esm/next/context/InitialExecutionContext.d.ts.map +1 -0
- package/esm/next/context/InitialExecutionContext.js +45 -0
- package/esm/next/context/InitialExecutionContext.js.map +1 -0
- package/esm/next/context/MapInstanceContext.d.ts +42 -0
- package/esm/next/context/MapInstanceContext.d.ts.map +1 -0
- package/esm/next/context/MapInstanceContext.js +62 -0
- package/esm/next/context/MapInstanceContext.js.map +1 -0
- package/esm/next/features/clustering/clustering.d.ts +23 -0
- package/esm/next/features/clustering/clustering.d.ts.map +1 -0
- package/esm/next/features/clustering/clustering.js +26 -0
- package/esm/next/features/clustering/clustering.js.map +1 -0
- package/esm/next/features/coloring/colorStrategy.d.ts +22 -0
- package/esm/next/features/coloring/colorStrategy.d.ts.map +1 -0
- package/esm/next/features/coloring/colorStrategy.js +83 -0
- package/esm/next/features/coloring/colorStrategy.js.map +1 -0
- package/esm/next/features/coloring/palette.d.ts +81 -0
- package/esm/next/features/coloring/palette.d.ts.map +1 -0
- package/esm/next/features/coloring/palette.js +233 -0
- package/esm/next/features/coloring/palette.js.map +1 -0
- package/esm/next/features/data/dataSourceManagement.d.ts +20 -0
- package/esm/next/features/data/dataSourceManagement.d.ts.map +1 -0
- package/esm/next/features/data/dataSourceManagement.js +30 -0
- package/esm/next/features/data/dataSourceManagement.js.map +1 -0
- package/esm/next/features/data/transformation.d.ts +99 -0
- package/esm/next/features/data/transformation.d.ts.map +1 -0
- package/esm/next/features/data/transformation.js +369 -0
- package/esm/next/features/data/transformation.js.map +1 -0
- package/esm/next/features/map/initializeMap.d.ts +30 -0
- package/esm/next/features/map/initializeMap.d.ts.map +1 -0
- package/esm/next/features/map/initializeMap.js +58 -0
- package/esm/next/features/map/initializeMap.js.map +1 -0
- package/esm/next/features/map/layerManagement.d.ts +51 -0
- package/esm/next/features/map/layerManagement.d.ts.map +1 -0
- package/esm/next/features/map/layerManagement.js +95 -0
- package/esm/next/features/map/layerManagement.js.map +1 -0
- package/esm/next/features/map/viewportManagement.d.ts +76 -0
- package/esm/next/features/map/viewportManagement.d.ts.map +1 -0
- package/esm/next/features/map/viewportManagement.js +193 -0
- package/esm/next/features/map/viewportManagement.js.map +1 -0
- package/esm/next/features/size/calculations.d.ts +32 -0
- package/esm/next/features/size/calculations.d.ts.map +1 -0
- package/esm/next/features/size/calculations.js +37 -0
- package/esm/next/features/size/calculations.js.map +1 -0
- package/esm/next/features/tooltip/formatting.d.ts +28 -0
- package/esm/next/features/tooltip/formatting.d.ts.map +1 -0
- package/esm/next/features/tooltip/formatting.js +51 -0
- package/esm/next/features/tooltip/formatting.js.map +1 -0
- package/esm/next/features/tooltip/tooltipManagement.d.ts +47 -0
- package/esm/next/features/tooltip/tooltipManagement.d.ts.map +1 -0
- package/esm/next/features/tooltip/tooltipManagement.js +73 -0
- package/esm/next/features/tooltip/tooltipManagement.js.map +1 -0
- package/esm/next/hooks/init/useInitExecution.d.ts +29 -0
- package/esm/next/hooks/init/useInitExecution.d.ts.map +1 -0
- package/esm/next/hooks/init/useInitExecution.js +91 -0
- package/esm/next/hooks/init/useInitExecution.js.map +1 -0
- package/esm/next/hooks/init/useInitExecutionResult.d.ts +17 -0
- package/esm/next/hooks/init/useInitExecutionResult.d.ts.map +1 -0
- package/esm/next/hooks/init/useInitExecutionResult.js +44 -0
- package/esm/next/hooks/init/useInitExecutionResult.js.map +1 -0
- package/esm/next/hooks/legend/useLegendConfig.d.ts +35 -0
- package/esm/next/hooks/legend/useLegendConfig.d.ts.map +1 -0
- package/esm/next/hooks/legend/useLegendConfig.js +25 -0
- package/esm/next/hooks/legend/useLegendConfig.js.map +1 -0
- package/esm/next/hooks/legend/useLegendDetails.d.ts +27 -0
- package/esm/next/hooks/legend/useLegendDetails.d.ts.map +1 -0
- package/esm/next/hooks/legend/useLegendDetails.js +39 -0
- package/esm/next/hooks/legend/useLegendDetails.js.map +1 -0
- package/esm/next/hooks/legend/useLegendItemClick.d.ts +16 -0
- package/esm/next/hooks/legend/useLegendItemClick.d.ts.map +1 -0
- package/esm/next/hooks/legend/useLegendItemClick.js +23 -0
- package/esm/next/hooks/legend/useLegendItemClick.js.map +1 -0
- package/esm/next/hooks/legend/useLegendItems.d.ts +27 -0
- package/esm/next/hooks/legend/useLegendItems.d.ts.map +1 -0
- package/esm/next/hooks/legend/useLegendItems.js +54 -0
- package/esm/next/hooks/legend/useLegendItems.js.map +1 -0
- package/esm/next/hooks/legend/useLegendItemsWithState.d.ts +21 -0
- package/esm/next/hooks/legend/useLegendItemsWithState.d.ts.map +1 -0
- package/esm/next/hooks/legend/useLegendItemsWithState.js +42 -0
- package/esm/next/hooks/legend/useLegendItemsWithState.js.map +1 -0
- package/esm/next/hooks/legend/useLegendProps.d.ts +53 -0
- package/esm/next/hooks/legend/useLegendProps.d.ts.map +1 -0
- package/esm/next/hooks/legend/useLegendProps.js +38 -0
- package/esm/next/hooks/legend/useLegendProps.js.map +1 -0
- package/esm/next/hooks/legend/useSelectedSegments.d.ts +17 -0
- package/esm/next/hooks/legend/useSelectedSegments.d.ts.map +1 -0
- package/esm/next/hooks/legend/useSelectedSegments.js +32 -0
- package/esm/next/hooks/legend/useSelectedSegments.js.map +1 -0
- package/esm/next/hooks/map/useAfterRender.d.ts +19 -0
- package/esm/next/hooks/map/useAfterRender.d.ts.map +1 -0
- package/esm/next/hooks/map/useAfterRender.js +99 -0
- package/esm/next/hooks/map/useAfterRender.js.map +1 -0
- package/esm/next/hooks/map/useMapCallbacks.d.ts +20 -0
- package/esm/next/hooks/map/useMapCallbacks.d.ts.map +1 -0
- package/esm/next/hooks/map/useMapCallbacks.js +44 -0
- package/esm/next/hooks/map/useMapCallbacks.js.map +1 -0
- package/esm/next/hooks/map/useMapDataSync.d.ts +44 -0
- package/esm/next/hooks/map/useMapDataSync.d.ts.map +1 -0
- package/esm/next/hooks/map/useMapDataSync.js +87 -0
- package/esm/next/hooks/map/useMapDataSync.js.map +1 -0
- package/esm/next/hooks/map/useMapInitialization.d.ts +56 -0
- package/esm/next/hooks/map/useMapInitialization.d.ts.map +1 -0
- package/esm/next/hooks/map/useMapInitialization.js +121 -0
- package/esm/next/hooks/map/useMapInitialization.js.map +1 -0
- package/esm/next/hooks/map/useTooltipHandlers.d.ts +22 -0
- package/esm/next/hooks/map/useTooltipHandlers.d.ts.map +1 -0
- package/esm/next/hooks/map/useTooltipHandlers.js +28 -0
- package/esm/next/hooks/map/useTooltipHandlers.js.map +1 -0
- package/esm/next/hooks/shared/useGeoDataTransformation.d.ts +23 -0
- package/esm/next/hooks/shared/useGeoDataTransformation.d.ts.map +1 -0
- package/esm/next/hooks/shared/useGeoDataTransformation.js +37 -0
- package/esm/next/hooks/shared/useGeoDataTransformation.js.map +1 -0
- package/esm/next/hooks/shared/usePushData.d.ts +8 -0
- package/esm/next/hooks/shared/usePushData.d.ts.map +1 -0
- package/esm/next/hooks/shared/usePushData.js +36 -0
- package/esm/next/hooks/shared/usePushData.js.map +1 -0
- package/esm/next/hooks/shared/useResolvedProps.d.ts +16 -0
- package/esm/next/hooks/shared/useResolvedProps.d.ts.map +1 -0
- package/esm/next/hooks/shared/useResolvedProps.js +40 -0
- package/esm/next/hooks/shared/useResolvedProps.js.map +1 -0
- package/esm/next/index.d.ts +5 -0
- package/esm/next/index.d.ts.map +1 -0
- package/esm/next/index.js +3 -0
- package/esm/next/index.js.map +1 -0
- package/esm/next/providers/maplibre/maplibreConfig.d.ts +68 -0
- package/esm/next/providers/maplibre/maplibreConfig.d.ts.map +1 -0
- package/esm/next/providers/maplibre/maplibreConfig.js +104 -0
- package/esm/next/providers/maplibre/maplibreConfig.js.map +1 -0
- package/esm/next/providers/maplibre/maplibreDataLayers.d.ts +51 -0
- package/esm/next/providers/maplibre/maplibreDataLayers.d.ts.map +1 -0
- package/esm/next/providers/maplibre/maplibreDataLayers.js +195 -0
- package/esm/next/providers/maplibre/maplibreDataLayers.js.map +1 -0
- package/esm/next/providers/maplibre/maplibreDataSource.d.ts +28 -0
- package/esm/next/providers/maplibre/maplibreDataSource.d.ts.map +1 -0
- package/esm/next/providers/maplibre/maplibreDataSource.js +117 -0
- package/esm/next/providers/maplibre/maplibreDataSource.js.map +1 -0
- package/esm/next/providers/maplibre/maplibreTooltip.d.ts +54 -0
- package/esm/next/providers/maplibre/maplibreTooltip.d.ts.map +1 -0
- package/esm/next/providers/maplibre/maplibreTooltip.js +158 -0
- package/esm/next/providers/maplibre/maplibreTooltip.js.map +1 -0
- package/esm/next/providers/maplibre/maplibreViewport.d.ts +45 -0
- package/esm/next/providers/maplibre/maplibreViewport.d.ts.map +1 -0
- package/esm/next/providers/maplibre/maplibreViewport.js +92 -0
- package/esm/next/providers/maplibre/maplibreViewport.js.map +1 -0
- package/esm/next/providers/maplibre/style.d.ts +3 -0
- package/esm/next/providers/maplibre/style.d.ts.map +1 -0
- package/esm/next/providers/maplibre/style.js +8361 -0
- package/esm/next/providers/maplibre/style.js.map +1 -0
- package/esm/next/types/config.d.ts +89 -0
- package/esm/next/types/config.d.ts.map +1 -0
- package/esm/next/types/config.js +3 -0
- package/esm/next/types/config.js.map +1 -0
- package/esm/next/types/internal.d.ts +17 -0
- package/esm/next/types/internal.d.ts.map +1 -0
- package/esm/next/types/internal.js +3 -0
- package/esm/next/types/internal.js.map +1 -0
- package/esm/next/types/mapProvider.d.ts +122 -0
- package/esm/next/types/mapProvider.d.ts.map +1 -0
- package/esm/next/types/mapProvider.js +3 -0
- package/esm/next/types/mapProvider.js.map +1 -0
- package/esm/next/types/public.d.ts +84 -0
- package/esm/next/types/public.d.ts.map +1 -0
- package/esm/next/types/public.js +15 -0
- package/esm/next/types/public.js.map +1 -0
- package/esm/next/types/shared.d.ts +209 -0
- package/esm/next/types/shared.d.ts.map +1 -0
- package/esm/next/types/shared.js +3 -0
- package/esm/next/types/shared.js.map +1 -0
- package/esm/next/utils/mapLocale.d.ts +26 -0
- package/esm/next/utils/mapLocale.d.ts.map +1 -0
- package/esm/next/utils/mapLocale.js +22 -0
- package/esm/next/utils/mapLocale.js.map +1 -0
- package/package.json +13 -10
- package/styles/css/main.css +925 -0
- package/styles/css/main.css.map +1 -1
- package/styles/scss/_geo-pushpin-next-legend.scss +166 -0
- package/styles/scss/_maplibre-overrides.scss +64 -0
- package/styles/scss/geo-pushpin-next.scss +58 -0
- package/styles/scss/main.scss +1 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { isEmpty, range } from "lodash-es";
|
|
3
|
+
import { isAttributeDescriptor, isResultAttributeHeader } from "@gooddata/sdk-model";
|
|
4
|
+
import { DEFAULT_PUSHPIN_BORDER_COLOR_VALUE, DEFAULT_PUSHPIN_COLOR_OPACITY, DEFAULT_PUSHPIN_COLOR_SCALE, } from "../../constants/geoChart.js";
|
|
5
|
+
import { getMinMax } from "../size/calculations.js";
|
|
6
|
+
/**
|
|
7
|
+
* Color palette functions for GeoPushpinChartNext
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_SEGMENT_ITEM = "default_segment_item";
|
|
12
|
+
const DEFAULT_COLOR_INDEX_IN_PALETTE = DEFAULT_PUSHPIN_COLOR_SCALE - 1;
|
|
13
|
+
/**
|
|
14
|
+
* Formats RGB color values into CSS color string
|
|
15
|
+
*/
|
|
16
|
+
function formatColor(red, green, blue, opacity = 1) {
|
|
17
|
+
if (opacity === 1) {
|
|
18
|
+
return `rgb(${red},${green},${blue})`;
|
|
19
|
+
}
|
|
20
|
+
return `rgba(${red},${green},${blue},${opacity})`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parses RGB color string into component values
|
|
24
|
+
*/
|
|
25
|
+
function parseRGBColorCode(color) {
|
|
26
|
+
const parts = color.split(",");
|
|
27
|
+
const R = parseInt(parts[0].slice(4), 10);
|
|
28
|
+
const G = parseInt(parts[1], 10);
|
|
29
|
+
const B = parseInt(parts[2], 10);
|
|
30
|
+
return { R, G, B };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Calculates a color channel value for a gradient step
|
|
34
|
+
*/
|
|
35
|
+
function getCalculatedChannel(channel, index, step) {
|
|
36
|
+
return Math.trunc(channel + index * step);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generates an array of gradient colors
|
|
40
|
+
*/
|
|
41
|
+
function getCalculatedColors(count, channels, steps, opacity = 1) {
|
|
42
|
+
return range(1, count).map((index) => formatColor(getCalculatedChannel(channels[0], index, steps[0]), getCalculatedChannel(channels[1], index, steps[1]), getCalculatedChannel(channels[2], index, steps[2]), opacity));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts color to RGB color code object
|
|
46
|
+
*/
|
|
47
|
+
function getRGBColorCode(color) {
|
|
48
|
+
if (typeof color === "string") {
|
|
49
|
+
const { R: r, G: g, B: b } = parseRGBColorCode(color);
|
|
50
|
+
return { r, g, b };
|
|
51
|
+
}
|
|
52
|
+
return color;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generates a color palette from a base color
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Creates a gradient palette with lighter shades, useful for color scales
|
|
59
|
+
*
|
|
60
|
+
* @param baseColor - Base color as RGB string or object
|
|
61
|
+
* @param opacity - Opacity value (0-1)
|
|
62
|
+
* @returns Array of color strings from light to dark
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export function getColorPalette(baseColor, opacity = 1) {
|
|
67
|
+
const colorItemsCount = 6;
|
|
68
|
+
const { r, g, b } = getRGBColorCode(baseColor);
|
|
69
|
+
const channels = [r, g, b];
|
|
70
|
+
const steps = channels.map((channel) => (255 - channel) / colorItemsCount);
|
|
71
|
+
const generatedColors = getCalculatedColors(colorItemsCount, channels, steps, opacity);
|
|
72
|
+
return [...generatedColors.reverse(), formatColor(r, g, b, opacity)];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Converts RGB color to RGBA with opacity
|
|
76
|
+
*
|
|
77
|
+
* @param color - RGB color string
|
|
78
|
+
* @param opacity - Opacity value (0-1)
|
|
79
|
+
* @returns RGBA color string
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export function rgbToRgba(color, opacity = 1) {
|
|
84
|
+
const { R, G, B } = parseRGBColorCode(color);
|
|
85
|
+
return formatColor(R, G, B, opacity);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the color palette index for a given value
|
|
89
|
+
*
|
|
90
|
+
* @param value - Value to map to palette
|
|
91
|
+
* @param min - Minimum value in range
|
|
92
|
+
* @param max - Maximum value in range
|
|
93
|
+
* @returns Index in the color palette (0 to DEFAULT_PUSHPIN_COLOR_SCALE - 1)
|
|
94
|
+
*
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
export function getColorIndexInPalette(value, min, max) {
|
|
98
|
+
if (value === null || !Number.isFinite(value) || min === max || value === min) {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
if (value === max) {
|
|
102
|
+
return DEFAULT_COLOR_INDEX_IN_PALETTE;
|
|
103
|
+
}
|
|
104
|
+
const step = (max - min) / DEFAULT_PUSHPIN_COLOR_SCALE;
|
|
105
|
+
for (let i = 0, offset = min; i < DEFAULT_PUSHPIN_COLOR_SCALE; i++, offset += step) {
|
|
106
|
+
if (offset >= value) {
|
|
107
|
+
return i;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return DEFAULT_COLOR_INDEX_IN_PALETTE;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Creates a mapping of segment names to color palettes
|
|
114
|
+
*
|
|
115
|
+
* @param colorStrategy - Color strategy from visualization
|
|
116
|
+
* @returns Map of segment names to color palettes
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export function getColorPaletteMapping(colorStrategy) {
|
|
121
|
+
const colorAssignment = colorStrategy.getColorAssignment();
|
|
122
|
+
return colorAssignment.reduce((result, item, index) => {
|
|
123
|
+
const color = colorStrategy.getColorByIndex(index);
|
|
124
|
+
const colorPalette = getColorPalette(color, DEFAULT_PUSHPIN_COLOR_OPACITY);
|
|
125
|
+
// Color based on Location
|
|
126
|
+
if (isAttributeDescriptor(item.headerItem)) {
|
|
127
|
+
return {
|
|
128
|
+
[DEFAULT_SEGMENT_ITEM]: colorPalette,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// Color based on SegmentBy
|
|
132
|
+
const name = isResultAttributeHeader(item.headerItem)
|
|
133
|
+
? item.headerItem.attributeHeaderItem.name
|
|
134
|
+
: DEFAULT_SEGMENT_ITEM;
|
|
135
|
+
result[name ?? DEFAULT_SEGMENT_ITEM] = colorPalette;
|
|
136
|
+
return result;
|
|
137
|
+
}, {});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Generates pushpin colors based on color and segment values
|
|
141
|
+
*
|
|
142
|
+
* @remarks
|
|
143
|
+
* Determines border and background colors for each pushpin based on:
|
|
144
|
+
* - Color measure values
|
|
145
|
+
* - Segment values
|
|
146
|
+
* - Color strategy
|
|
147
|
+
*
|
|
148
|
+
* @param colorValues - Array of color measure values (can be null)
|
|
149
|
+
* @param segmentValues - Array of segment names
|
|
150
|
+
* @param colorStrategy - Color strategy for palette generation
|
|
151
|
+
* @returns Array of pushpin color configurations
|
|
152
|
+
*
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
export function getPushpinColors(colorValues, segmentValues = [], colorStrategy) {
|
|
156
|
+
const defaultColorValue = colorStrategy.getColorByIndex(0);
|
|
157
|
+
const defaultColor = rgbToRgba(defaultColorValue, DEFAULT_PUSHPIN_COLOR_OPACITY);
|
|
158
|
+
// No color or segment data - use default
|
|
159
|
+
if (colorValues.length === 0 && segmentValues.length === 0) {
|
|
160
|
+
return [
|
|
161
|
+
{
|
|
162
|
+
border: DEFAULT_PUSHPIN_BORDER_COLOR_VALUE,
|
|
163
|
+
background: defaultColor,
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
const segmentNames = [...segmentValues];
|
|
168
|
+
const colorPaletteMapping = getColorPaletteMapping(colorStrategy);
|
|
169
|
+
// Only segment data, no color measure
|
|
170
|
+
if (colorValues.length === 0) {
|
|
171
|
+
return segmentNames.map((name) => {
|
|
172
|
+
const palette = colorPaletteMapping[name];
|
|
173
|
+
return {
|
|
174
|
+
border: DEFAULT_PUSHPIN_BORDER_COLOR_VALUE,
|
|
175
|
+
background: palette[DEFAULT_COLOR_INDEX_IN_PALETTE],
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
// Calculate min/max for color scale
|
|
180
|
+
const colorsWithoutNull = colorValues.filter((value) => value !== null && Number.isFinite(value));
|
|
181
|
+
const { min, max } = getMinMax(colorsWithoutNull);
|
|
182
|
+
// All values are the same and no segments - use default
|
|
183
|
+
if (min === max && segmentValues.length === 0) {
|
|
184
|
+
return [
|
|
185
|
+
{
|
|
186
|
+
border: DEFAULT_PUSHPIN_BORDER_COLOR_VALUE,
|
|
187
|
+
background: defaultColor,
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
// Generate colors for each data point
|
|
192
|
+
return colorValues.map((color, index) => {
|
|
193
|
+
const value = color !== null && Number.isFinite(color) ? color : min;
|
|
194
|
+
const colorIndex = getColorIndexInPalette(value, min, max);
|
|
195
|
+
const segmentItemName = segmentNames[index] || DEFAULT_SEGMENT_ITEM;
|
|
196
|
+
const palette = colorPaletteMapping[segmentItemName];
|
|
197
|
+
return {
|
|
198
|
+
border: palette[DEFAULT_COLOR_INDEX_IN_PALETTE],
|
|
199
|
+
background: palette[colorIndex],
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Generates legend color data for a color measure
|
|
205
|
+
*
|
|
206
|
+
* @param colorSeries - Array of color values
|
|
207
|
+
* @param colorString - Base color as string
|
|
208
|
+
* @returns Array of color legend items with ranges
|
|
209
|
+
*
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
export function generateLegendColorData(colorSeries, colorString) {
|
|
213
|
+
if (isEmpty(colorSeries)) {
|
|
214
|
+
return [];
|
|
215
|
+
}
|
|
216
|
+
const colorPalette = getColorPalette(colorString, DEFAULT_PUSHPIN_COLOR_OPACITY);
|
|
217
|
+
const min = Math.min(...colorSeries);
|
|
218
|
+
const max = Math.max(...colorSeries);
|
|
219
|
+
const offset = (max - min) / DEFAULT_PUSHPIN_COLOR_SCALE;
|
|
220
|
+
if (min === max) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
return range(0, DEFAULT_PUSHPIN_COLOR_SCALE).map((index) => {
|
|
224
|
+
const from = min + offset * index;
|
|
225
|
+
const isLastItem = index === DEFAULT_PUSHPIN_COLOR_SCALE - 1;
|
|
226
|
+
const to = isLastItem ? max : from + offset;
|
|
227
|
+
return {
|
|
228
|
+
range: { from, to },
|
|
229
|
+
color: colorPalette[index],
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../../../src/next/features/coloring/palette.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAkB,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGrG,OAAO,EACH,kCAAkC,EAClC,6BAA6B,EAC7B,2BAA2B,GAC9B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AAEH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AACpD,MAAM,8BAA8B,GAAG,2BAA2B,GAAG,CAAC,CAAC;AAEvE;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW,EAAE,KAAa,EAAE,IAAY,EAAE,OAAO,GAAG,CAAC;IACtE,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,OAAO,GAAG,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC;IAC1C,CAAC;IACD,OAAO,QAAQ,GAAG,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,GAAG,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAa;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAA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AC;QAClC,MAAM,UAAU,GAAG,KAAK,KAAK,2BAA2B,GAAG,CAAC,CAAC;QAC7D,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;QAE5C,OAAO;YACH,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACnB,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;SAC7B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IColorStrategy } from "@gooddata/sdk-ui-vis-commons";
|
|
2
|
+
import { IMapConfig } from "../../types/mapProvider.js";
|
|
3
|
+
import { IGeoData } from "../../types/shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create GeoJSON data source for map
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This function creates a GeoJSON data source from geographic data, applying
|
|
9
|
+
* the color strategy and configuring clustering if enabled. The resulting
|
|
10
|
+
* source can be added to the map with map.addSource().
|
|
11
|
+
*
|
|
12
|
+
* @param geoData - Geographic data to display
|
|
13
|
+
* @param colorStrategy - Color strategy for styling
|
|
14
|
+
* @param config - Map configuration
|
|
15
|
+
* @returns GeoJSON source specification
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function createGeoDataSource(geoData: IGeoData, colorStrategy: IColorStrategy, config: IMapConfig): import("maplibre-gl").GeoJSONSourceSpecification;
|
|
20
|
+
//# sourceMappingURL=dataSourceManagement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataSourceManagement.d.ts","sourceRoot":"","sources":["../../../../src/next/features/data/dataSourceManagement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,oDAYvG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { createPushpinDataSource } from "../../providers/maplibre/maplibreDataSource.js";
|
|
3
|
+
import { isClusteringAllowed } from "../clustering/clustering.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create GeoJSON data source for map
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This function creates a GeoJSON data source from geographic data, applying
|
|
9
|
+
* the color strategy and configuring clustering if enabled. The resulting
|
|
10
|
+
* source can be added to the map with map.addSource().
|
|
11
|
+
*
|
|
12
|
+
* @param geoData - Geographic data to display
|
|
13
|
+
* @param colorStrategy - Color strategy for styling
|
|
14
|
+
* @param config - Map configuration
|
|
15
|
+
* @returns GeoJSON source specification
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function createGeoDataSource(geoData, colorStrategy, config) {
|
|
20
|
+
const { points: geoPointsConfig = {} } = config;
|
|
21
|
+
const hasClustering = isClusteringAllowed(geoData, geoPointsConfig.groupNearbyPoints);
|
|
22
|
+
const dataSourceProps = {
|
|
23
|
+
geoData,
|
|
24
|
+
config,
|
|
25
|
+
colorStrategy,
|
|
26
|
+
hasClustering,
|
|
27
|
+
};
|
|
28
|
+
return createPushpinDataSource(dataSourceProps);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=dataSourceManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataSourceManagement.js","sourceRoot":"","sources":["../../../../src/next/features/data/dataSourceManagement.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAIhC,OAAO,EAAuB,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAG9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAiB,EAAE,aAA6B,EAAE,MAAkB;IACpG,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAChD,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAEtF,MAAM,eAAe,GAAwB;QACzC,OAAO;QACP,MAAM;QACN,aAAa;QACb,aAAa;KAChB,CAAC;IAEF,OAAO,uBAAuB,CAAC,eAAe,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { DataValue, IAttributeDescriptor, IResultHeader } from "@gooddata/sdk-model";
|
|
2
|
+
import { DataViewFacade } from "@gooddata/sdk-ui";
|
|
3
|
+
import { IPushpinCategoryLegendItem } from "@gooddata/sdk-ui-vis-commons";
|
|
4
|
+
import { IAvailableLegends, IGeoData, IGeoLngLat } from "../../types/shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Converts a data value to a float
|
|
7
|
+
*
|
|
8
|
+
* @param value - Data value from execution result
|
|
9
|
+
* @returns Parsed float value, or NaN if parsing fails
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function dataValueAsFloat(value: DataValue): number;
|
|
14
|
+
/**
|
|
15
|
+
* Parses a location string in "lat;lng" format into coordinates
|
|
16
|
+
*
|
|
17
|
+
* @param latlng - Location string in "latitude;longitude" format
|
|
18
|
+
* @returns Coordinate object or null if invalid
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function getLocation(latlng: string | null): IGeoLngLat | null;
|
|
23
|
+
/**
|
|
24
|
+
* Parses a coordinate string into a number
|
|
25
|
+
*
|
|
26
|
+
* @param coordinate - Coordinate string
|
|
27
|
+
* @returns Parsed number or null if invalid
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseCoordinate(coordinate: string | null): number | null;
|
|
32
|
+
/**
|
|
33
|
+
* Transforms data view into geo data structure
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* This is the main data transformation function that extracts and structures
|
|
37
|
+
* all geo-related data from the execution result
|
|
38
|
+
*
|
|
39
|
+
* @param dv - Data view facade
|
|
40
|
+
* @param emptyHeaderString - String to use for empty headers
|
|
41
|
+
* @param nullHeaderString - String to use for null headers
|
|
42
|
+
* @returns Structured geo data
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare function getGeoData(dv: DataViewFacade, emptyHeaderString: string, nullHeaderString: string): IGeoData;
|
|
47
|
+
/**
|
|
48
|
+
* Determines which legends should be available based on data
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Analyzes geo data to determine which legend types are applicable:
|
|
52
|
+
* - Category legend: When segments exist
|
|
53
|
+
* - Color legend: When color measure exists with varying values
|
|
54
|
+
* - Size legend: When size measure exists with varying values
|
|
55
|
+
*
|
|
56
|
+
* @param categoryItems - Category legend items
|
|
57
|
+
* @param geoData - Geo data structure
|
|
58
|
+
* @returns Object indicating which legends are available
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function getAvailableLegends(categoryItems: IPushpinCategoryLegendItem[], geoData: IGeoData): IAvailableLegends;
|
|
63
|
+
/**
|
|
64
|
+
* Parses GeoJSON properties from feature
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* Extracts and parses location, color, size, and segment properties from GeoJSON feature
|
|
68
|
+
*
|
|
69
|
+
* @param properties - GeoJSON properties object
|
|
70
|
+
* @returns Parsed properties object
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare function parseGeoProperties(properties: GeoJSON.GeoJsonProperties): GeoJSON.GeoJsonProperties;
|
|
75
|
+
/**
|
|
76
|
+
* Attribute information with header items
|
|
77
|
+
*/
|
|
78
|
+
export type AttributeInfo = IAttributeDescriptor["attributeHeader"] & {
|
|
79
|
+
items: IResultHeader[];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Geo attributes in dimension
|
|
83
|
+
*/
|
|
84
|
+
export interface IGeoAttributesInDimension {
|
|
85
|
+
locationAttribute: AttributeInfo;
|
|
86
|
+
segmentByAttribute: AttributeInfo | undefined;
|
|
87
|
+
tooltipTextAttribute: AttributeInfo | undefined;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Finds geo attributes in the data view dimension
|
|
91
|
+
*
|
|
92
|
+
* @param dv - Data view facade
|
|
93
|
+
* @param geoData - Geo data structure
|
|
94
|
+
* @returns Geo attributes information
|
|
95
|
+
*
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export declare function findGeoAttributesInDimension(dv: DataViewFacade, geoData: IGeoData): IGeoAttributesInDimension;
|
|
99
|
+
//# sourceMappingURL=transformation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformation.d.ts","sourceRoot":"","sources":["../../../../src/next/features/data/transformation.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,SAAS,EACT,oBAAoB,EAGpB,aAAa,EAWhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAe,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EACH,iBAAiB,EAEjB,QAAQ,EACR,UAAU,EAIb,MAAM,uBAAuB,CAAC;AA0C/B;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAWzD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAA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