@gooddata/sdk-ui-geo 11.6.0-alpha.6 → 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 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreDataLayers.js","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreDataLayers.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,kCAAkC,EAClC,uBAAuB,EACvB,mBAAmB,EACnB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OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,cAAsB;IACtD,OAAO;QACH,EAAE,EAAE,0BAA0B;QAC9B,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,sBAA6C;QACrD,KAAK,EAAE;YACH,GAAG,6BAA6B;YAChC,CAAC,0BAA0B,CAAC,EAAE,4BAAuD;YACrF,CAAC,yBAAyB,CAAC,EAAE,2BAAsD;SACtF;KACJ,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,cAAsB;IACtD,OAAO;QACH,GAAG,6BAA6B;QAChC,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,sBAA6C;KACxD,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,cAAsB;IACxD,OAAO;QACH,EAAE,EAAE,kBAAkB;QACtB,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,CAAC,GAAG,EAAE,sBAAsB,CAAwB;QAC5D,KAAK,EAAE;YACH,GAAG,uBAAuB;YAC1B,CAAC,0BAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAA4B;YAChG,CAAC,iCAAiC,CAAC,EAAE,kCAAkC;YACvE,CAAC,yBAAyB,CAAC,EAAE,CAAC;SACjC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from "maplibre-gl";
|
|
2
|
+
import { IColorStrategy } from "@gooddata/sdk-ui-vis-commons";
|
|
3
|
+
import { IGeoPushpinChartNextConfig } from "../../types/config.js";
|
|
4
|
+
import { IGeoData } from "../../types/shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Properties for creating a geo data source
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export interface IGeoDataSourceProps {
|
|
11
|
+
colorStrategy: IColorStrategy;
|
|
12
|
+
config: IGeoPushpinChartNextConfig;
|
|
13
|
+
geoData: IGeoData;
|
|
14
|
+
hasClustering: boolean;
|
|
15
|
+
}
|
|
16
|
+
type IGeoDataSourceFeature = GeoJSON.Feature<GeoJSON.Point, GeoJSON.GeoJsonProperties>;
|
|
17
|
+
export type IGeoDataSourceFeatures = IGeoDataSourceFeature[];
|
|
18
|
+
/**
|
|
19
|
+
* Creates a GeoJSON data source for MapLibre from geo data
|
|
20
|
+
*
|
|
21
|
+
* @param dataSourceProps - Properties containing geo data, config, and styling
|
|
22
|
+
* @returns GeoJSON source specification for MapLibre
|
|
23
|
+
*
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export declare const createPushpinDataSource: (dataSourceProps: IGeoDataSourceProps) => GeoJSONSourceSpecification;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=maplibreDataSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreDataSource.d.ts","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,EAAwB,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAA6B,MAAM,uBAAuB,CAAC;AAE5E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,aAAa,EAAE,cAAc,CAAC;IAC9B,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,QAAQ,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED,KAAK,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACvF,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,EAAE,CAAC;AAoH7D;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,mBAAmB,KAAG,0BAoB9E,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_RADIUS, PUSHPIN_SIZE_OPTIONS_MAP, } from "../../constants/geoChart.js";
|
|
3
|
+
import { getPushpinColors } from "../../features/coloring/palette.js";
|
|
4
|
+
import { getMinMax } from "../../features/size/calculations.js";
|
|
5
|
+
function transformPushpinDataSource({ config, geoData, colorStrategy, }) {
|
|
6
|
+
const { color, location, segment, size, tooltipText } = geoData;
|
|
7
|
+
if (!location) {
|
|
8
|
+
/*
|
|
9
|
+
* short-circuit the processing at this point. if there is no location data then the features will
|
|
10
|
+
* be empty
|
|
11
|
+
*/
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const { points: geoPointsConfig = {} } = config || {};
|
|
15
|
+
const locationNameTitle = tooltipText ? tooltipText.name : "";
|
|
16
|
+
const colorTitle = color ? color.name : "";
|
|
17
|
+
const sizeTitle = size ? size.name : "";
|
|
18
|
+
const segmentTitle = segment ? segment.name : "";
|
|
19
|
+
const hasSize = size !== undefined;
|
|
20
|
+
const locationData = location.data;
|
|
21
|
+
const locationNameData = tooltipText?.data ?? [];
|
|
22
|
+
const segmentData = segment?.data ?? [];
|
|
23
|
+
const segmentUris = segment?.uris ?? [];
|
|
24
|
+
const sizeData = size?.data ?? [];
|
|
25
|
+
const { min: minSizeFromData, max: maxSizeFromData } = getMinMax(sizeData);
|
|
26
|
+
const colorData = color?.data ?? [];
|
|
27
|
+
const sizeFormat = size?.format ?? "";
|
|
28
|
+
const colorFormat = color?.format ?? "";
|
|
29
|
+
const pushpinColors = getPushpinColors(colorData, segmentData, colorStrategy);
|
|
30
|
+
return locationData.reduce((result, coordinates, index) => {
|
|
31
|
+
if (!coordinates || !Number.isFinite(coordinates.lat) || !Number.isFinite(coordinates.lng)) {
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
const { lat, lng } = coordinates;
|
|
35
|
+
const pushpinSize = hasSize
|
|
36
|
+
? calculateSizeInPixel(sizeData[index], minSizeFromData, maxSizeFromData, geoPointsConfig)
|
|
37
|
+
: PUSHPIN_SIZE_OPTIONS_MAP.min.default;
|
|
38
|
+
const colorValue = colorData[index];
|
|
39
|
+
const segmentValue = segmentData[index];
|
|
40
|
+
const segmentUri = segmentUris[index];
|
|
41
|
+
const pushpinColor = pushpinColors[index] || pushpinColors[0] || {};
|
|
42
|
+
result.push({
|
|
43
|
+
type: "Feature",
|
|
44
|
+
geometry: {
|
|
45
|
+
type: "Point",
|
|
46
|
+
coordinates: [lng, lat], // MapLibre requires [lng, lat] format
|
|
47
|
+
},
|
|
48
|
+
properties: {
|
|
49
|
+
pushpinSize,
|
|
50
|
+
// Flatten color properties for MapLibre expressions
|
|
51
|
+
color_background: pushpinColor.background,
|
|
52
|
+
color_border: pushpinColor.border,
|
|
53
|
+
locationName: {
|
|
54
|
+
title: locationNameTitle,
|
|
55
|
+
value: locationNameData[index],
|
|
56
|
+
},
|
|
57
|
+
locationIndex: index,
|
|
58
|
+
color: {
|
|
59
|
+
...pushpinColor,
|
|
60
|
+
title: colorTitle,
|
|
61
|
+
value: colorValue,
|
|
62
|
+
format: colorFormat,
|
|
63
|
+
},
|
|
64
|
+
size: {
|
|
65
|
+
title: sizeTitle,
|
|
66
|
+
value: sizeData[index],
|
|
67
|
+
format: sizeFormat,
|
|
68
|
+
},
|
|
69
|
+
segment: {
|
|
70
|
+
title: segmentTitle,
|
|
71
|
+
value: segmentValue,
|
|
72
|
+
uri: segmentUri,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
return result;
|
|
77
|
+
}, []);
|
|
78
|
+
}
|
|
79
|
+
// transform data value to pushpin size in pixel
|
|
80
|
+
const calculateSizeInPixel = (dataValue, minSize, maxSize, geoPointsConfig) => {
|
|
81
|
+
if (minSize === maxSize || dataValue === null) {
|
|
82
|
+
return PUSHPIN_SIZE_OPTIONS_MAP.min.default;
|
|
83
|
+
}
|
|
84
|
+
const { minSize: minSizeFromConfig = "default", maxSize: maxSizeFromConfig = "default" } = geoPointsConfig || {};
|
|
85
|
+
const minSizeInPixel = PUSHPIN_SIZE_OPTIONS_MAP.min[minSizeFromConfig];
|
|
86
|
+
const maxSizeInPixel = PUSHPIN_SIZE_OPTIONS_MAP.max[maxSizeFromConfig];
|
|
87
|
+
return ((dataValue - minSize) * (maxSizeInPixel - minSizeInPixel)) / (maxSize - minSize) + minSizeInPixel;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Creates a GeoJSON data source for MapLibre from geo data
|
|
91
|
+
*
|
|
92
|
+
* @param dataSourceProps - Properties containing geo data, config, and styling
|
|
93
|
+
* @returns GeoJSON source specification for MapLibre
|
|
94
|
+
*
|
|
95
|
+
* @alpha
|
|
96
|
+
*/
|
|
97
|
+
export const createPushpinDataSource = (dataSourceProps) => {
|
|
98
|
+
const { hasClustering } = dataSourceProps;
|
|
99
|
+
const features = transformPushpinDataSource(dataSourceProps);
|
|
100
|
+
const source = {
|
|
101
|
+
type: "geojson",
|
|
102
|
+
data: {
|
|
103
|
+
type: "FeatureCollection",
|
|
104
|
+
features,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
if (hasClustering) {
|
|
108
|
+
return {
|
|
109
|
+
...source,
|
|
110
|
+
cluster: true,
|
|
111
|
+
clusterMaxZoom: DEFAULT_CLUSTER_MAX_ZOOM,
|
|
112
|
+
clusterRadius: DEFAULT_CLUSTER_RADIUS,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return source;
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=maplibreDataSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreDataSource.js","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreDataSource.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAMhC,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAmBhE,SAAS,0BAA0B,CAAC,EAChC,MAAM,EACN,OAAO,EACP,aAAa,GACK;IAClB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEhE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ;;;WAGG;QACH,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtD,MAAM,iBAAiB,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjD,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC;IAEnC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;IACnC,MAAM,gBAAgB,GAAG,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC;IACjD,MAA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AO,EAAE,iBAAiB,GAAG,SAAS,EAAE,GACpF,eAAe,IAAI,EAAE,CAAC;IAC1B,MAAM,cAAc,GAAG,wBAAwB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvE,MAAM,cAAc,GAAG,wBAAwB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEvE,OAAO,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,cAAc,CAAC;AAC9G,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,eAAoC,EAA8B,EAAE;IACxG,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC;IAC1C,MAAM,QAAQ,GAAG,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAE7D,MAAM,MAAM,GAA+B;QACvC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,IAAI,EAAE,mBAAmB;YACzB,QAAQ;SACX;KACJ,CAAC;IACF,IAAI,aAAa,EAAE,CAAC;QAChB,OAAO;YACH,GAAG,MAAM;YACT,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,wBAAwB;YACxC,aAAa,EAAE,sBAAsB;SACxC,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Map as MapLibreMap, MapMouseEvent, Popup } from "maplibre-gl";
|
|
2
|
+
import { IntlShape } from "react-intl";
|
|
3
|
+
import { ISeparators } from "@gooddata/sdk-model";
|
|
4
|
+
import { IHeaderPredicate } from "@gooddata/sdk-ui";
|
|
5
|
+
import { IGeoPushpinChartNextConfig } from "../../types/config.js";
|
|
6
|
+
export declare const TOOLTIP_MAX_WIDTH = 320;
|
|
7
|
+
/**
|
|
8
|
+
* Determine if a tooltip should be shown for the given feature properties
|
|
9
|
+
*
|
|
10
|
+
* @param geoProperties - GeoJSON feature properties
|
|
11
|
+
* @returns True if tooltip should be shown
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export declare function shouldShowTooltip(geoProperties: GeoJSON.GeoJsonProperties | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Generate HTML content for tooltip
|
|
18
|
+
*
|
|
19
|
+
* @param geoProperties - GeoJSON feature properties
|
|
20
|
+
* @param tooltipStroke - Color for tooltip stroke
|
|
21
|
+
* @param maxWidth - Maximum width of tooltip
|
|
22
|
+
* @param separators - Number format separators
|
|
23
|
+
* @param drillableItems - Drillable items configuration
|
|
24
|
+
* @param intl - Internationalization shape
|
|
25
|
+
* @returns HTML string for tooltip
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export declare function getTooltipHtml(geoProperties: GeoJSON.GeoJsonProperties, tooltipStroke: string, maxWidth: number, separators?: ISeparators, drillableItems?: IHeaderPredicate[], intl?: IntlShape): string;
|
|
30
|
+
/**
|
|
31
|
+
* Handle pushpin mouse enter event to show tooltip
|
|
32
|
+
*
|
|
33
|
+
* @param e - MapLibre mouse event
|
|
34
|
+
* @param map - MapLibre Map instance
|
|
35
|
+
* @param tooltip - MapLibre Popup instance
|
|
36
|
+
* @param config - Geo chart configuration
|
|
37
|
+
* @param drillableItems - Drillable items configuration
|
|
38
|
+
* @param intl - Internationalization shape
|
|
39
|
+
*
|
|
40
|
+
* @alpha
|
|
41
|
+
*/
|
|
42
|
+
export declare const handlePushpinMouseEnter: (e: MapMouseEvent, map: MapLibreMap, tooltip: Popup, config: IGeoPushpinChartNextConfig, drillableItems?: IHeaderPredicate[], intl?: IntlShape) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Handle pushpin mouse leave event to hide tooltip
|
|
45
|
+
*
|
|
46
|
+
* @param _e - MapLibre mouse event (unused)
|
|
47
|
+
* @param map - MapLibre Map instance
|
|
48
|
+
* @param tooltip - MapLibre Popup instance
|
|
49
|
+
* @param config - Geo chart configuration
|
|
50
|
+
*
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export declare const handlePushpinMouseLeave: (_e: MapMouseEvent, map: MapLibreMap, tooltip: Popup, config: IGeoPushpinChartNextConfig) => void;
|
|
54
|
+
//# sourceMappingURL=maplibreTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreTooltip.d.ts","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreTooltip.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAKpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAInE,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAuCrC;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAY/F;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC1B,aAAa,EAAE,OAAO,CAAC,iBAAiB,EACxC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,WAAW,EACxB,cAAc,CAAC,EAAE,gBAAgB,EAAE,EACnC,IAAI,CAAC,EAAE,SAAS,GACjB,MAAM,CAiBR;AAkBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,GAChC,GAAG,aAAa,EAChB,KAAK,WAAW,EAChB,SAAS,KAAK,EACd,QAAQ,0BAA0B,EAClC,iBAAiB,gBAAgB,EAAE,EACnC,OAAO,SAAS,KACjB,IA0CF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAChC,IAAI,aAAa,EACjB,KAAK,WAAW,EAChB,SAAS,KAAK,EACd,QAAQ,0BAA0B,KACnC,IAOF,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { escape, isEmpty } from "lodash-es";
|
|
3
|
+
import { DEFAULT_PUSHPIN_COLOR_VALUE, NULL_TOOLTIP_VALUE } from "../../constants/geoChart.js";
|
|
4
|
+
import { parseGeoProperties } from "../../features/data/transformation.js";
|
|
5
|
+
import { formatValueForTooltip, getTooltipContentWidth } from "../../features/tooltip/formatting.js";
|
|
6
|
+
const TOOLTIP_FULLSCREEN_THRESHOLD = 480;
|
|
7
|
+
export const TOOLTIP_MAX_WIDTH = 320;
|
|
8
|
+
function isTooltipItemValid(item) {
|
|
9
|
+
if (!item) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const { title } = item;
|
|
13
|
+
return Boolean(title);
|
|
14
|
+
}
|
|
15
|
+
function escapeAttributeValue(value) {
|
|
16
|
+
return Number.isFinite(value) ? value : escape(String(value));
|
|
17
|
+
}
|
|
18
|
+
function formatMeasure(item, separators) {
|
|
19
|
+
const { title, value, format } = item;
|
|
20
|
+
return {
|
|
21
|
+
title,
|
|
22
|
+
value: Number.isFinite(value) ? formatValueForTooltip(value, format, separators) : NULL_TOOLTIP_VALUE,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function formatAttribute(item) {
|
|
26
|
+
const { value } = item;
|
|
27
|
+
return {
|
|
28
|
+
...item,
|
|
29
|
+
value: value ? escapeAttributeValue(value) : NULL_TOOLTIP_VALUE,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// Tooltips are now switched off in edit/export mode
|
|
33
|
+
function isTooltipDisabled({ viewport = {} }) {
|
|
34
|
+
return Boolean(viewport.frozen);
|
|
35
|
+
}
|
|
36
|
+
function isTooltipShownInFullScreen() {
|
|
37
|
+
return document.documentElement.clientWidth <= TOOLTIP_FULLSCREEN_THRESHOLD;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Determine if a tooltip should be shown for the given feature properties
|
|
41
|
+
*
|
|
42
|
+
* @param geoProperties - GeoJSON feature properties
|
|
43
|
+
* @returns True if tooltip should be shown
|
|
44
|
+
*
|
|
45
|
+
* @alpha
|
|
46
|
+
*/
|
|
47
|
+
export function shouldShowTooltip(geoProperties) {
|
|
48
|
+
if (isEmpty(geoProperties)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const { locationName, color, size, segment } = geoProperties;
|
|
52
|
+
return (isTooltipItemValid(locationName) ||
|
|
53
|
+
isTooltipItemValid(size) ||
|
|
54
|
+
isTooltipItemValid(color) ||
|
|
55
|
+
isTooltipItemValid(segment));
|
|
56
|
+
}
|
|
57
|
+
function getInteractionMessage(drillableItems, intl) {
|
|
58
|
+
const message = intl ? intl.formatMessage({ id: "visualization.tooltip.interaction" }) : null;
|
|
59
|
+
return drillableItems?.length && intl ? `<div class="gd-viz-tooltip-interaction">${message}</div>` : "";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Generate HTML content for tooltip
|
|
63
|
+
*
|
|
64
|
+
* @param geoProperties - GeoJSON feature properties
|
|
65
|
+
* @param tooltipStroke - Color for tooltip stroke
|
|
66
|
+
* @param maxWidth - Maximum width of tooltip
|
|
67
|
+
* @param separators - Number format separators
|
|
68
|
+
* @param drillableItems - Drillable items configuration
|
|
69
|
+
* @param intl - Internationalization shape
|
|
70
|
+
* @returns HTML string for tooltip
|
|
71
|
+
*
|
|
72
|
+
* @alpha
|
|
73
|
+
*/
|
|
74
|
+
export function getTooltipHtml(geoProperties, tooltipStroke, maxWidth, separators, drillableItems, intl) {
|
|
75
|
+
const { locationName = {}, size = {}, color = {}, segment = {} } = geoProperties || {};
|
|
76
|
+
const interactionMessage = getInteractionMessage(drillableItems, intl);
|
|
77
|
+
const tooltipItems = [
|
|
78
|
+
formatAttribute(locationName),
|
|
79
|
+
formatMeasure(size, separators),
|
|
80
|
+
formatMeasure(color, separators),
|
|
81
|
+
formatAttribute(segment),
|
|
82
|
+
]
|
|
83
|
+
.map(getTooltipItemHtml)
|
|
84
|
+
.join("");
|
|
85
|
+
return `<div class="gd-viz-tooltip" style="max-width:${maxWidth}px">
|
|
86
|
+
<span class="gd-viz-tooltip-stroke" style="border-top-color: ${tooltipStroke}"></span>
|
|
87
|
+
<div class="gd-viz-tooltip-content">${tooltipItems}${interactionMessage}</div>
|
|
88
|
+
</div>`;
|
|
89
|
+
}
|
|
90
|
+
function getTooltipItemHtml(item) {
|
|
91
|
+
if (!isTooltipItemValid(item)) {
|
|
92
|
+
return "";
|
|
93
|
+
}
|
|
94
|
+
// value is escaped in formatAttribute or formatMeasure function
|
|
95
|
+
const { title, value } = item;
|
|
96
|
+
return `<div class="gd-viz-tooltip-item">
|
|
97
|
+
<span class="gd-viz-tooltip-title">${escape(title)}</span>
|
|
98
|
+
<div class="gd-viz-tooltip-value-wraper">
|
|
99
|
+
<span class="gd-viz-tooltip-value">${value}</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>`;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Handle pushpin mouse enter event to show tooltip
|
|
105
|
+
*
|
|
106
|
+
* @param e - MapLibre mouse event
|
|
107
|
+
* @param map - MapLibre Map instance
|
|
108
|
+
* @param tooltip - MapLibre Popup instance
|
|
109
|
+
* @param config - Geo chart configuration
|
|
110
|
+
* @param drillableItems - Drillable items configuration
|
|
111
|
+
* @param intl - Internationalization shape
|
|
112
|
+
*
|
|
113
|
+
* @alpha
|
|
114
|
+
*/
|
|
115
|
+
export const handlePushpinMouseEnter = (e, map, tooltip, config, drillableItems, intl) => {
|
|
116
|
+
if (isTooltipDisabled(config)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const { separators } = config;
|
|
120
|
+
const features = map.queryRenderedFeatures(e.point);
|
|
121
|
+
if (!features || features.length === 0) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const [feature] = features;
|
|
125
|
+
const { properties } = feature;
|
|
126
|
+
const parsedProps = parseGeoProperties(properties);
|
|
127
|
+
if (!shouldShowTooltip(parsedProps)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const canvas = map.getCanvas();
|
|
131
|
+
canvas.style.cursor = "pointer";
|
|
132
|
+
const coordinates = feature.geometry.coordinates.slice();
|
|
133
|
+
const tooltipStroke = parsedProps?.["color"]?.background ?? DEFAULT_PUSHPIN_COLOR_VALUE;
|
|
134
|
+
const isFullScreenTooltip = isTooltipShownInFullScreen();
|
|
135
|
+
const chartWidth = canvas.clientWidth;
|
|
136
|
+
const maxTooltipContentWidth = getTooltipContentWidth(isFullScreenTooltip, chartWidth, TOOLTIP_MAX_WIDTH);
|
|
137
|
+
const tooltipHtml = getTooltipHtml(parsedProps, tooltipStroke, maxTooltipContentWidth, separators, drillableItems, intl);
|
|
138
|
+
tooltip.setLngLat(coordinates).setHTML(tooltipHtml).setMaxWidth(`${maxTooltipContentWidth}px`).addTo(map);
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Handle pushpin mouse leave event to hide tooltip
|
|
142
|
+
*
|
|
143
|
+
* @param _e - MapLibre mouse event (unused)
|
|
144
|
+
* @param map - MapLibre Map instance
|
|
145
|
+
* @param tooltip - MapLibre Popup instance
|
|
146
|
+
* @param config - Geo chart configuration
|
|
147
|
+
*
|
|
148
|
+
* @alpha
|
|
149
|
+
*/
|
|
150
|
+
export const handlePushpinMouseLeave = (_e, map, tooltip, config) => {
|
|
151
|
+
if (isTooltipDisabled(config)) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const canvas = map.getCanvas();
|
|
155
|
+
canvas.style.cursor = "";
|
|
156
|
+
tooltip.remove();
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=maplibreTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreTooltip.js","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreTooltip.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAO5C,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAIrG,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,SAAS,kBAAkB,CAAC,IAAqB;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAsB;IAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAqB,EAAE,UAAwB;IAClE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtC,OAAO;QACH,KAAK;QACL,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB;KACxG,CAAC;AACN,CAAC;AAED,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B,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO;IACX,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC;IAC/B,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;IACzB,OAAO,CAAC,MAAM,EAAE,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { LngLatBoundsLike } from "maplibre-gl";
|
|
2
|
+
import { IGeoPushpinChartNextConfig } from "../../types/config.js";
|
|
3
|
+
import { IGeoLngLat, IGeoLngLatBounds } from "../../types/shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Viewport configuration for MapLibre
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
interface IGeoViewport {
|
|
10
|
+
bounds?: LngLatBoundsLike;
|
|
11
|
+
center?: IGeoLngLat;
|
|
12
|
+
zoom?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get viewport options based on data and configuration
|
|
16
|
+
*
|
|
17
|
+
* @param data - Array of location coordinates
|
|
18
|
+
* @param config - Geo chart configuration
|
|
19
|
+
* @returns Viewport configuration with bounds or center/zoom
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export declare function getViewportOptions(data: IGeoLngLat[], config: IGeoPushpinChartNextConfig): IGeoViewport;
|
|
24
|
+
/**
|
|
25
|
+
* Represents a rectangular geographical area on a map.
|
|
26
|
+
*
|
|
27
|
+
* @param lnglats - Array of coordinates
|
|
28
|
+
* @returns Bounds containing all coordinates or undefined if empty
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const corner1 = { lat: 40.712, lng: -74.227 };
|
|
33
|
+
* const corner2 = { lat: 40.774, lng: -74.125 };
|
|
34
|
+
* const bounds = getLngLatBounds([corner1, corner2]);
|
|
35
|
+
*
|
|
36
|
+
* if (bounds) {
|
|
37
|
+
* map.fitBounds([bounds.northEast, bounds.southWest], { padding: 60 });
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare function getLngLatBounds(lnglats: IGeoLngLat[]): IGeoLngLatBounds | undefined;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=maplibreViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreViewport.d.ts","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreViewport.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAA0B,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;GAIG;AACH,UAAU,YAAY;IAClB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,0BAA0B,GAAG,YAAY,CAiCvG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,gBAAgB,GAAG,SAAS,CAMnF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { DEFAULT_CENTER, DEFAULT_WORLD_BOUNDS, DEFAULT_ZOOM, VIEWPORTS } from "./maplibreConfig.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get viewport options based on data and configuration
|
|
5
|
+
*
|
|
6
|
+
* @param data - Array of location coordinates
|
|
7
|
+
* @param config - Geo chart configuration
|
|
8
|
+
* @returns Viewport configuration with bounds or center/zoom
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export function getViewportOptions(data, config) {
|
|
13
|
+
const center = config?.center;
|
|
14
|
+
const zoom = config?.zoom ?? DEFAULT_ZOOM;
|
|
15
|
+
const { area } = config?.viewport ?? {};
|
|
16
|
+
// use `center` config if it exists
|
|
17
|
+
if (!center) {
|
|
18
|
+
if (area && VIEWPORTS[area]) {
|
|
19
|
+
return {
|
|
20
|
+
bounds: VIEWPORTS[area],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const lngLatBounds = getLngLatBounds(data);
|
|
25
|
+
if (lngLatBounds) {
|
|
26
|
+
return {
|
|
27
|
+
bounds: [
|
|
28
|
+
[lngLatBounds.southWest.lng, lngLatBounds.southWest.lat],
|
|
29
|
+
[lngLatBounds.northEast.lng, lngLatBounds.northEast.lat],
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
center: DEFAULT_CENTER,
|
|
35
|
+
zoom,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
center,
|
|
41
|
+
zoom,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Represents a rectangular geographical area on a map.
|
|
46
|
+
*
|
|
47
|
+
* @param lnglats - Array of coordinates
|
|
48
|
+
* @returns Bounds containing all coordinates or undefined if empty
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const corner1 = { lat: 40.712, lng: -74.227 };
|
|
53
|
+
* const corner2 = { lat: 40.774, lng: -74.125 };
|
|
54
|
+
* const bounds = getLngLatBounds([corner1, corner2]);
|
|
55
|
+
*
|
|
56
|
+
* if (bounds) {
|
|
57
|
+
* map.fitBounds([bounds.northEast, bounds.southWest], { padding: 60 });
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export function getLngLatBounds(lnglats) {
|
|
64
|
+
if (!lnglats?.length) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
return lnglats.reduce(extendLngLatBounds, undefined) || DEFAULT_WORLD_BOUNDS;
|
|
68
|
+
}
|
|
69
|
+
// Extend the bounds to contain the given point
|
|
70
|
+
function extendLngLatBounds(bounds, lnglat) {
|
|
71
|
+
if (!lnglat) {
|
|
72
|
+
return bounds || DEFAULT_WORLD_BOUNDS;
|
|
73
|
+
}
|
|
74
|
+
if (!bounds) {
|
|
75
|
+
return {
|
|
76
|
+
northEast: lnglat,
|
|
77
|
+
southWest: lnglat,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const { northEast, southWest } = bounds;
|
|
81
|
+
return {
|
|
82
|
+
northEast: {
|
|
83
|
+
lat: Math.max(lnglat.lat, northEast.lat),
|
|
84
|
+
lng: Math.max(lnglat.lng, northEast.lng),
|
|
85
|
+
},
|
|
86
|
+
southWest: {
|
|
87
|
+
lat: Math.min(lnglat.lat, southWest.lat),
|
|
88
|
+
lng: Math.min(lnglat.lng, southWest.lng),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=maplibreViewport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maplibreViewport.js","sourceRoot":"","sources":["../../../../src/next/providers/maplibre/maplibreViewport.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAIhC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAepG;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAkB,EAAE,MAAkC;IACrF,MAAM,MAAM,GAA2B,MAAM,EAAE,MAAM,CAAC;IACtD,MAAM,IAAI,GAAW,MAA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