@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,91 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { compact } from "lodash-es";
|
|
4
|
+
import { MeasureGroupIdentifier, bucketsAttributes, bucketsMeasures, newBucket, newDimension, } from "@gooddata/sdk-model";
|
|
5
|
+
import { BucketNames, useBackendStrict, useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
6
|
+
/**
|
|
7
|
+
* Creates dimensions for geo chart execution.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export function getGeoChartDimensions(def) {
|
|
11
|
+
const buckets = def.buckets;
|
|
12
|
+
const measures = bucketsMeasures(buckets);
|
|
13
|
+
const attributes = bucketsAttributes(buckets);
|
|
14
|
+
return compact([measures.length > 0 && newDimension([MeasureGroupIdentifier]), newDimension(attributes)]);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates an execution for GeoPushpinChartNext with proper bucket configuration.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This hook creates a prepared execution with the appropriate buckets based on whether
|
|
21
|
+
* the chart is using location mode (single attribute) or lat/lng mode (two attributes).
|
|
22
|
+
*
|
|
23
|
+
* Buckets created:
|
|
24
|
+
* - LOCATION: Contains either location attribute or lat/lng attributes
|
|
25
|
+
* - SIZE: Contains size measure/attribute
|
|
26
|
+
* - COLOR: Contains color measure/attribute
|
|
27
|
+
* - SEGMENT: Contains segmentBy attribute
|
|
28
|
+
* - TOOLTIP_TEXT: Contains tooltipText attribute
|
|
29
|
+
*
|
|
30
|
+
* @param config - Execution configuration
|
|
31
|
+
* @returns Prepared execution ready to be executed
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export function useInitExecution(props) {
|
|
36
|
+
const { location, latitude, longitude, segmentBy, size, color, config, filters = [], sortBy = [], execConfig, } = props;
|
|
37
|
+
const backend = useBackendStrict(props.backend, "useInitExecution");
|
|
38
|
+
const workspace = useWorkspaceStrict(props.workspace, "useInitExecution");
|
|
39
|
+
const { tooltipText } = config ?? {};
|
|
40
|
+
return useMemo(() => {
|
|
41
|
+
const buckets = [];
|
|
42
|
+
// Location bucket - either single location or lat/lng pair
|
|
43
|
+
if (latitude && longitude) {
|
|
44
|
+
buckets.push(newBucket(BucketNames.LATITUDE, latitude));
|
|
45
|
+
buckets.push(newBucket(BucketNames.LONGITUDE, longitude));
|
|
46
|
+
}
|
|
47
|
+
else if (location) {
|
|
48
|
+
buckets.push(newBucket(BucketNames.LOCATION, location));
|
|
49
|
+
}
|
|
50
|
+
// Size bucket
|
|
51
|
+
if (size) {
|
|
52
|
+
buckets.push(newBucket(BucketNames.SIZE, size));
|
|
53
|
+
}
|
|
54
|
+
// Color bucket
|
|
55
|
+
if (color) {
|
|
56
|
+
buckets.push(newBucket(BucketNames.COLOR, color));
|
|
57
|
+
}
|
|
58
|
+
// Segment bucket
|
|
59
|
+
if (segmentBy) {
|
|
60
|
+
buckets.push(newBucket(BucketNames.SEGMENT, segmentBy));
|
|
61
|
+
}
|
|
62
|
+
// Tooltip text bucket
|
|
63
|
+
if (tooltipText) {
|
|
64
|
+
buckets.push(newBucket(BucketNames.TOOLTIP_TEXT, tooltipText));
|
|
65
|
+
}
|
|
66
|
+
let execution = backend
|
|
67
|
+
.workspace(workspace)
|
|
68
|
+
.execution()
|
|
69
|
+
.forBuckets(buckets, filters)
|
|
70
|
+
.withSorting(...sortBy)
|
|
71
|
+
.withDimensions(getGeoChartDimensions);
|
|
72
|
+
if (execConfig) {
|
|
73
|
+
execution = execution.withExecConfig(execConfig);
|
|
74
|
+
}
|
|
75
|
+
return execution;
|
|
76
|
+
}, [
|
|
77
|
+
backend,
|
|
78
|
+
workspace,
|
|
79
|
+
location,
|
|
80
|
+
latitude,
|
|
81
|
+
longitude,
|
|
82
|
+
segmentBy,
|
|
83
|
+
size,
|
|
84
|
+
color,
|
|
85
|
+
tooltipText,
|
|
86
|
+
filters,
|
|
87
|
+
sortBy,
|
|
88
|
+
execConfig,
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=useInitExecution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitExecution.js","sourceRoot":"","sources":["../../../../src/next/hooks/init/useInitExecution.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataViewFacade, GoodDataSdkError, UseCancelablePromiseState } from "@gooddata/sdk-ui";
|
|
2
|
+
/**
|
|
3
|
+
* Fetches execution result and returns data view facade.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This hook executes the prepared execution and returns the data view wrapped in a facade
|
|
7
|
+
* for easier data access. It handles loading states, errors, and provides callbacks for
|
|
8
|
+
* different stages of the data fetching process.
|
|
9
|
+
*
|
|
10
|
+
* @param config - Execution result configuration
|
|
11
|
+
* @param deps - Additional dependencies for the hook
|
|
12
|
+
* @returns Execution state with data view facade
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export declare function useInitExecutionResult(): UseCancelablePromiseState<DataViewFacade, GoodDataSdkError>;
|
|
17
|
+
//# sourceMappingURL=useInitExecutionResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitExecutionResult.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/init/useInitExecutionResult.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EAE5B,MAAM,kBAAkB,CAAC;AAI1B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,IAAI,yBAAyB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CA0BpG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useExecutionDataView, } from "@gooddata/sdk-ui";
|
|
3
|
+
import { useGeoPushpinProps } from "../../context/GeoPushpinPropsContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Fetches execution result and returns data view facade.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This hook executes the prepared execution and returns the data view wrapped in a facade
|
|
9
|
+
* for easier data access. It handles loading states, errors, and provides callbacks for
|
|
10
|
+
* different stages of the data fetching process.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Execution result configuration
|
|
13
|
+
* @param deps - Additional dependencies for the hook
|
|
14
|
+
* @returns Execution state with data view facade
|
|
15
|
+
*
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function useInitExecutionResult() {
|
|
19
|
+
const { onLoadingChanged, onDataView, onError, backend, workspace, execution } = useGeoPushpinProps();
|
|
20
|
+
return useExecutionDataView({
|
|
21
|
+
backend,
|
|
22
|
+
workspace,
|
|
23
|
+
execution,
|
|
24
|
+
enableExecutionCancelling: true,
|
|
25
|
+
onLoading: () => {
|
|
26
|
+
onLoadingChanged?.({
|
|
27
|
+
isLoading: true,
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
onSuccess: (dataView) => {
|
|
31
|
+
onLoadingChanged?.({
|
|
32
|
+
isLoading: false,
|
|
33
|
+
});
|
|
34
|
+
onDataView?.(dataView);
|
|
35
|
+
},
|
|
36
|
+
onError: (error) => {
|
|
37
|
+
onLoadingChanged?.({
|
|
38
|
+
isLoading: false,
|
|
39
|
+
});
|
|
40
|
+
onError?.(error);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=useInitExecutionResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitExecutionResult.js","sourceRoot":"","sources":["../../../../src/next/hooks/init/useInitExecutionResult.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAIH,oBAAoB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB;IAClC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAEtG,OAAO,oBAAoB,CAAC;QACxB,OAAO;QACP,SAAS;QACT,SAAS;QACT,yBAAyB,EAAE,IAAI;QAC/B,SAAS,EAAE,GAAG,EAAE;YACZ,gBAAgB,EAAE,CAAC;gBACf,SAAS,EAAE,IAAI;aAClB,CAAC,CAAC;QACP,CAAC;QACD,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE;YACpB,gBAAgB,EAAE,CAAC;gBACf,SAAS,EAAE,KAAK;aACnB,CAAC,CAAC;YACH,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACf,gBAAgB,EAAE,CAAC;gBACf,SAAS,EAAE,KAAK;aACnB,CAAC,CAAC;YACH,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PositionType } from "@gooddata/sdk-ui-vis-commons";
|
|
2
|
+
import { IGeoPushpinChartNextConfig } from "../../types/config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Legend configuration computed from geo config.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface ILegendConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Whether legend should be rendered
|
|
11
|
+
*/
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Legend position relative to the chart
|
|
15
|
+
*/
|
|
16
|
+
position: PositionType;
|
|
17
|
+
/**
|
|
18
|
+
* Responsive behavior setting
|
|
19
|
+
*/
|
|
20
|
+
responsive: boolean | "autoPositionWithPopup";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Hook to compute legend configuration from geo config.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This hook extracts and normalizes legend configuration from the geo config,
|
|
27
|
+
* providing sensible defaults for enabled, position, and responsive settings.
|
|
28
|
+
*
|
|
29
|
+
* @param config - Geo chart configuration
|
|
30
|
+
* @returns Normalized legend configuration
|
|
31
|
+
*
|
|
32
|
+
* @alpha
|
|
33
|
+
*/
|
|
34
|
+
export declare function useLegendConfig(config?: IGeoPushpinChartNextConfig): ILegendConfig;
|
|
35
|
+
//# sourceMappingURL=useLegendConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendConfig.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,OAAO,GAAG,uBAAuB,CAAC;CACjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,0BAA0B,GAAG,aAAa,CAUlF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Hook to compute legend configuration from geo config.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This hook extracts and normalizes legend configuration from the geo config,
|
|
8
|
+
* providing sensible defaults for enabled, position, and responsive settings.
|
|
9
|
+
*
|
|
10
|
+
* @param config - Geo chart configuration
|
|
11
|
+
* @returns Normalized legend configuration
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export function useLegendConfig(config) {
|
|
16
|
+
return useMemo(() => {
|
|
17
|
+
const legendConfig = config?.legend;
|
|
18
|
+
return {
|
|
19
|
+
enabled: legendConfig?.enabled ?? true,
|
|
20
|
+
position: legendConfig?.position ?? "top",
|
|
21
|
+
responsive: legendConfig?.responsive ?? false,
|
|
22
|
+
};
|
|
23
|
+
}, [config?.legend]);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=useLegendConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendConfig.js","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AA4BhC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmC;IAC/D,OAAO,OAAO,CAAC,GAAG,EAAE;QAChB,MAAM,YAAY,GAAG,MAAM,EAAE,MAAM,CAAC;QAEpC,OAAO;YACH,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,IAAI;YACtC,QAAQ,EAAE,YAAY,EAAE,QAAQ,IAAI,KAAK;YACzC,UAAU,EAAE,YAAY,EAAE,UAAU,IAAI,KAAK;SAChD,CAAC;IACN,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ContentRect } from "react-measure";
|
|
2
|
+
import { ILegendDetails } from "@gooddata/sdk-ui-vis-commons";
|
|
3
|
+
import { IGeoPushpinChartNextConfig } from "../../types/config.js";
|
|
4
|
+
import { IGeoData } from "../../types/shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Hook to extract legend details from configuration.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This hook uses the `getLegendDetails` function from vis-commons to determine:
|
|
10
|
+
* - Legend position (computed based on responsive config and container size)
|
|
11
|
+
* - Whether to render popup legend (`renderPopUp`) - true when width less than 610px with autoPositionWithPopup
|
|
12
|
+
* - Maximum rows for popup collapsed state (`maxRows`) - 1 or 2 based on height
|
|
13
|
+
* - Dialog title (`name`) - from segment attribute name
|
|
14
|
+
*
|
|
15
|
+
* The popup legend is triggered when:
|
|
16
|
+
* - Config has `legend.responsive: "autoPositionWithPopup"`
|
|
17
|
+
* - Container width less than 610px (narrow) OR position is top/bottom
|
|
18
|
+
*
|
|
19
|
+
* @param config - Geo pushpin chart configuration
|
|
20
|
+
* @param geoData - Geographic data containing segment information
|
|
21
|
+
* @param contentRect - Container dimensions from react-measure
|
|
22
|
+
* @returns Legend details or null if cannot be determined
|
|
23
|
+
*
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export declare function useLegendDetails(config: IGeoPushpinChartNextConfig | undefined, geoData: IGeoData | null, contentRect: ContentRect | undefined): ILegendDetails | null;
|
|
27
|
+
//# sourceMappingURL=useLegendDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendDetails.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendDetails.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAoB,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,0BAA0B,GAAG,SAAS,EAC9C,OAAO,EAAE,QAAQ,GAAG,IAAI,EACxB,WAAW,EAAE,WAAW,GAAG,SAAS,GACrC,cAAc,GAAG,IAAI,CAmBvB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { getLegendDetails } from "@gooddata/sdk-ui-vis-commons";
|
|
4
|
+
/**
|
|
5
|
+
* Hook to extract legend details from configuration.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This hook uses the `getLegendDetails` function from vis-commons to determine:
|
|
9
|
+
* - Legend position (computed based on responsive config and container size)
|
|
10
|
+
* - Whether to render popup legend (`renderPopUp`) - true when width less than 610px with autoPositionWithPopup
|
|
11
|
+
* - Maximum rows for popup collapsed state (`maxRows`) - 1 or 2 based on height
|
|
12
|
+
* - Dialog title (`name`) - from segment attribute name
|
|
13
|
+
*
|
|
14
|
+
* The popup legend is triggered when:
|
|
15
|
+
* - Config has `legend.responsive: "autoPositionWithPopup"`
|
|
16
|
+
* - Container width less than 610px (narrow) OR position is top/bottom
|
|
17
|
+
*
|
|
18
|
+
* @param config - Geo pushpin chart configuration
|
|
19
|
+
* @param geoData - Geographic data containing segment information
|
|
20
|
+
* @param contentRect - Container dimensions from react-measure
|
|
21
|
+
* @returns Legend details or null if cannot be determined
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export function useLegendDetails(config, geoData, contentRect) {
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
const position = config?.legend?.position ?? "auto";
|
|
28
|
+
const responsive = config?.legend?.responsive;
|
|
29
|
+
const legendLabel = geoData?.segment?.name;
|
|
30
|
+
return getLegendDetails(position, responsive ?? false, { contentRect, legendLabel }, config?.respectLegendPosition);
|
|
31
|
+
}, [
|
|
32
|
+
config?.legend?.position,
|
|
33
|
+
config?.legend?.responsive,
|
|
34
|
+
config?.respectLegendPosition,
|
|
35
|
+
geoData?.segment?.name,
|
|
36
|
+
contentRect,
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=useLegendDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendDetails.js","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendDetails.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,EAAkB,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAC5B,MAA8C,EAC9C,OAAwB,EACxB,WAAoC;IAEpC,OAAO,OAAO,CAAC,GAAG,EAAE;QAChB,MAAM,QAAQ,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,IAAI,MAAM,CAAC;QACpD,MAAM,UAAU,GAAG,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;QAC9C,MAAM,WAAW,GAAG,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;QAE3C,OAAO,gBAAgB,CACnB,QAAQ,EACR,UAAU,IAAI,KAAK,EACnB,EAAE,WAAW,EAAE,WAAW,EAAE,EAC5B,MAAM,EAAE,qBAAqB,CAChC,CAAC;IACN,CAAC,EAAE;QACC,MAAM,EAAE,MAAM,EAAE,QAAQ;QACxB,MAAM,EAAE,MAAM,EAAE,UAAU;QAC1B,MAAM,EAAE,qBAAqB;QAC7B,OAAO,EAAE,OAAO,EAAE,IAAI;QACtB,WAAW;KACd,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IPushpinCategoryLegendItem } from "@gooddata/sdk-ui-vis-commons";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to handle legend item click interactions.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This hook provides a callback for toggling legend items on/off.
|
|
7
|
+
* When a legend item is clicked, it updates the enabled state in the legend context,
|
|
8
|
+
* which will filter visible pushpins on the map.
|
|
9
|
+
*
|
|
10
|
+
* @param allUris - All available legend item URIs (for toggle logic)
|
|
11
|
+
* @returns Callback function for legend item clicks
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export declare function useLegendItemClick(allUris: string[]): (item: IPushpinCategoryLegendItem) => void;
|
|
16
|
+
//# sourceMappingURL=useLegendItemClick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendItemClick.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendItemClick.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAI1E;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,0BAA0B,KAAK,IAAI,CAShG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useGeoLegend } from "../../context/GeoLegendContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hook to handle legend item click interactions.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This hook provides a callback for toggling legend items on/off.
|
|
9
|
+
* When a legend item is clicked, it updates the enabled state in the legend context,
|
|
10
|
+
* which will filter visible pushpins on the map.
|
|
11
|
+
*
|
|
12
|
+
* @param allUris - All available legend item URIs (for toggle logic)
|
|
13
|
+
* @returns Callback function for legend item clicks
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export function useLegendItemClick(allUris) {
|
|
18
|
+
const { toggleLegendItem } = useGeoLegend();
|
|
19
|
+
return useCallback((item) => {
|
|
20
|
+
toggleLegendItem(item.uri, allUris);
|
|
21
|
+
}, [toggleLegendItem, allUris]);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=useLegendItemClick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendItemClick.js","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendItemClick.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAiB;IAChD,MAAM,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,CAAC;IAE5C,OAAO,WAAW,CACd,CAAC,IAAgC,EAAE,EAAE;QACjC,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,EACD,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAC9B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DataViewFacade } from "@gooddata/sdk-ui";
|
|
2
|
+
import { IColorStrategy, IPushpinCategoryLegendItem } from "@gooddata/sdk-ui-vis-commons";
|
|
3
|
+
import { IGeoData } from "../../types/shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates legend items from geo data for segment-based coloring.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This hook creates category legend items when the visualization uses segment-based
|
|
9
|
+
* coloring (attribute-based). Each unique segment value gets a legend item with:
|
|
10
|
+
* - name: Display name of the segment value
|
|
11
|
+
* - uri: URI of the segment value for identification
|
|
12
|
+
* - color: Color from the color strategy
|
|
13
|
+
* - legendIndex: Index for consistent ordering
|
|
14
|
+
* - isVisible: Visibility state (all visible by default)
|
|
15
|
+
*
|
|
16
|
+
* Legend items are used to display the category legend and to filter visible pushpins
|
|
17
|
+
* by toggling legend items on/off.
|
|
18
|
+
*
|
|
19
|
+
* @param dataView - Data view facade for attribute metadata
|
|
20
|
+
* @param geoData - Transformed geographic data containing segment information
|
|
21
|
+
* @param colorStrategy - Color strategy to get colors for legend items
|
|
22
|
+
* @returns Array of category legend items, empty if no segments
|
|
23
|
+
*
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export declare function useLegendItems(dataView: DataViewFacade | null, geoData: IGeoData | null, colorStrategy: IColorStrategy | null): IPushpinCategoryLegendItem[];
|
|
27
|
+
//# sourceMappingURL=useLegendItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendItems.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendItems.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,OAAO,EAAE,QAAQ,GAAG,IAAI,EACxB,aAAa,EAAE,cAAc,GAAG,IAAI,GACrC,0BAA0B,EAAE,CAmC9B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Creates legend items from geo data for segment-based coloring.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This hook creates category legend items when the visualization uses segment-based
|
|
8
|
+
* coloring (attribute-based). Each unique segment value gets a legend item with:
|
|
9
|
+
* - name: Display name of the segment value
|
|
10
|
+
* - uri: URI of the segment value for identification
|
|
11
|
+
* - color: Color from the color strategy
|
|
12
|
+
* - legendIndex: Index for consistent ordering
|
|
13
|
+
* - isVisible: Visibility state (all visible by default)
|
|
14
|
+
*
|
|
15
|
+
* Legend items are used to display the category legend and to filter visible pushpins
|
|
16
|
+
* by toggling legend items on/off.
|
|
17
|
+
*
|
|
18
|
+
* @param dataView - Data view facade for attribute metadata
|
|
19
|
+
* @param geoData - Transformed geographic data containing segment information
|
|
20
|
+
* @param colorStrategy - Color strategy to get colors for legend items
|
|
21
|
+
* @returns Array of category legend items, empty if no segments
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export function useLegendItems(dataView, geoData, colorStrategy) {
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
if (!dataView || !geoData?.segment || !colorStrategy) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const { segment } = geoData;
|
|
31
|
+
// Get unique segment values with their URIs
|
|
32
|
+
const uniqueSegments = new Map();
|
|
33
|
+
segment.data.forEach((segmentValue, index) => {
|
|
34
|
+
const uri = segment.uris?.[index];
|
|
35
|
+
if (uri && !uniqueSegments.has(uri)) {
|
|
36
|
+
uniqueSegments.set(uri, {
|
|
37
|
+
name: segmentValue,
|
|
38
|
+
uri,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
// Create legend items from unique segments with colors
|
|
43
|
+
const legendItems = Array.from(uniqueSegments.values()).map(({ name, uri }, index) => ({
|
|
44
|
+
type: "pushpin",
|
|
45
|
+
name,
|
|
46
|
+
uri,
|
|
47
|
+
color: colorStrategy.getColorByIndex(index),
|
|
48
|
+
legendIndex: index,
|
|
49
|
+
isVisible: true,
|
|
50
|
+
}));
|
|
51
|
+
return legendItems;
|
|
52
|
+
}, [dataView, geoData, colorStrategy]);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=useLegendItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendItems.js","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendItems.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAOhC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,cAAc,CAC1B,QAA+B,EAC/B,OAAwB,EACxB,aAAoC;IAEpC,OAAO,OAAO,CAAC,GAAG,EAAE;QAChB,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;YACnD,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAE5B,4CAA4C;QAC5C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAyC,CAAC;QAExE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAoB,EAAE,KAAa,EAAE,EAAE;YACzD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE;oBACpB,IAAI,EAAE,YAAY;oBAClB,GAAG;iBACN,CAAC,CAAC;YACP,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,uDAAuD;QACvD,MAAM,WAAW,GAAiC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CACrF,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,SAAS;YACf,IAAI;YACJ,GAAG;YACH,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC;YAC3C,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,IAAI;SAClB,CAAC,CACL,CAAC;QAEF,OAAO,WAAW,CAAC;IACvB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IPushpinCategoryLegendItem } from "@gooddata/sdk-ui-vis-commons";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to merge legend items with their visibility state from context.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This hook takes the base legend items (with colors, names, etc.) and merges
|
|
7
|
+
* them with the current visibility state from the GeoLegendContext. It returns
|
|
8
|
+
* updated legend items with the correct `isVisible` property.
|
|
9
|
+
*
|
|
10
|
+
* In the old implementation, all items start visible. When you click an item,
|
|
11
|
+
* it toggles its visibility. The same behavior is replicated here:
|
|
12
|
+
* - Empty enabledLegendItems array = all items visible (initial state)
|
|
13
|
+
* - Items in enabledLegendItems array = those items are visible
|
|
14
|
+
*
|
|
15
|
+
* @param baseLegendItems - Base legend items from data transformation
|
|
16
|
+
* @returns Legend items with updated isVisible state
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export declare function useLegendItemsWithState(baseLegendItems: IPushpinCategoryLegendItem[]): IPushpinCategoryLegendItem[];
|
|
21
|
+
//# sourceMappingURL=useLegendItemsWithState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendItemsWithState.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendItemsWithState.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAI1E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACnC,eAAe,EAAE,0BAA0B,EAAE,GAC9C,0BAA0B,EAAE,CAsB9B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useGeoLegend } from "../../context/GeoLegendContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hook to merge legend items with their visibility state from context.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This hook takes the base legend items (with colors, names, etc.) and merges
|
|
9
|
+
* them with the current visibility state from the GeoLegendContext. It returns
|
|
10
|
+
* updated legend items with the correct `isVisible` property.
|
|
11
|
+
*
|
|
12
|
+
* In the old implementation, all items start visible. When you click an item,
|
|
13
|
+
* it toggles its visibility. The same behavior is replicated here:
|
|
14
|
+
* - Empty enabledLegendItems array = all items visible (initial state)
|
|
15
|
+
* - Items in enabledLegendItems array = those items are visible
|
|
16
|
+
*
|
|
17
|
+
* @param baseLegendItems - Base legend items from data transformation
|
|
18
|
+
* @returns Legend items with updated isVisible state
|
|
19
|
+
*
|
|
20
|
+
* @alpha
|
|
21
|
+
*/
|
|
22
|
+
export function useLegendItemsWithState(baseLegendItems) {
|
|
23
|
+
const { enabledLegendItems } = useGeoLegend();
|
|
24
|
+
return useMemo(() => {
|
|
25
|
+
if (!baseLegendItems.length) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
// If no items are explicitly tracked, all are visible (initial state)
|
|
29
|
+
if (enabledLegendItems.length === 0) {
|
|
30
|
+
return baseLegendItems.map((item) => ({
|
|
31
|
+
...item,
|
|
32
|
+
isVisible: true,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
// Otherwise, item is visible if it's in the enabled list
|
|
36
|
+
return baseLegendItems.map((item) => ({
|
|
37
|
+
...item,
|
|
38
|
+
isVisible: enabledLegendItems.includes(item.uri),
|
|
39
|
+
}));
|
|
40
|
+
}, [baseLegendItems, enabledLegendItems]);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=useLegendItemsWithState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendItemsWithState.js","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendItemsWithState.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,uBAAuB,CACnC,eAA6C;IAE7C,MAAM,EAAE,kBAAkB,EAAE,GAAG,YAAY,EAAE,CAAC;IAE9C,OAAO,OAAO,CAAC,GAAG,EAAE;QAChB,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACd,CAAC;QAED,sEAAsE;QACtE,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAClC,GAAG,IAAI;gBACP,SAAS,EAAE,IAAI;aAClB,CAAC,CAAC,CAAC;QACR,CAAC;QAED,yDAAyD;QACzD,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClC,GAAG,IAAI;YACP,SAAS,EAAE,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;SACnD,CAAC,CAAC,CAAC;IACR,CAAC,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IColorStrategy, IPushpinCategoryLegendItem } from "@gooddata/sdk-ui-vis-commons";
|
|
2
|
+
import { IGeoPushpinChartNextConfig } from "../../types/config.js";
|
|
3
|
+
import { IGeoData } from "../../types/shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Props for legend renderer components.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface ILegendProps {
|
|
10
|
+
/**
|
|
11
|
+
* Geographic data for rendering color and size legends
|
|
12
|
+
*/
|
|
13
|
+
geoData: IGeoData | null;
|
|
14
|
+
/**
|
|
15
|
+
* Category items for rendering category legend
|
|
16
|
+
*/
|
|
17
|
+
categoryItems: IPushpinCategoryLegendItem[];
|
|
18
|
+
/**
|
|
19
|
+
* Color strategy for legend colors
|
|
20
|
+
*/
|
|
21
|
+
colorStrategy: IColorStrategy | null;
|
|
22
|
+
/**
|
|
23
|
+
* First color from the color strategy (used for color legend)
|
|
24
|
+
*/
|
|
25
|
+
colorLegendValue: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Format string for measure values
|
|
28
|
+
*/
|
|
29
|
+
format: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Geo configuration
|
|
32
|
+
*/
|
|
33
|
+
config: IGeoPushpinChartNextConfig | undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Hook to prepare props for legend components from context.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* This hook consolidates data from various contexts and prepares
|
|
40
|
+
* the props needed by legend renderer components. It extracts:
|
|
41
|
+
* - Geographic data for color/size legends
|
|
42
|
+
* - Category items for segment-based legends (with visibility state)
|
|
43
|
+
* - Color strategy and format information
|
|
44
|
+
*
|
|
45
|
+
* @param colorStrategy - Color strategy for the chart
|
|
46
|
+
* @param config - Geo configuration
|
|
47
|
+
* @param categoryItems - Category legend items with visibility state
|
|
48
|
+
* @returns Props for legend components
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
export declare function useLegendProps(colorStrategy: IColorStrategy | null, config: IGeoPushpinChartNextConfig | undefined, categoryItems: IPushpinCategoryLegendItem[]): ILegendProps;
|
|
53
|
+
//# sourceMappingURL=useLegendProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendProps.d.ts","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendProps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAG1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,aAAa,EAAE,0BAA0B,EAAE,CAAC;IAE5C;;OAEG;IACH,aAAa,EAAE,cAAc,GAAG,IAAI,CAAC;IAErC;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B;;OAEG;IACH,MAAM,EAAE,0BAA0B,GAAG,SAAS,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC1B,aAAa,EAAE,cAAc,GAAG,IAAI,EACpC,MAAM,EAAE,0BAA0B,GAAG,SAAS,EAC9C,aAAa,EAAE,0BAA0B,EAAE,GAC5C,YAAY,CAmBd"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useGeoData } from "../../context/GeoDataContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hook to prepare props for legend components from context.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This hook consolidates data from various contexts and prepares
|
|
9
|
+
* the props needed by legend renderer components. It extracts:
|
|
10
|
+
* - Geographic data for color/size legends
|
|
11
|
+
* - Category items for segment-based legends (with visibility state)
|
|
12
|
+
* - Color strategy and format information
|
|
13
|
+
*
|
|
14
|
+
* @param colorStrategy - Color strategy for the chart
|
|
15
|
+
* @param config - Geo configuration
|
|
16
|
+
* @param categoryItems - Category legend items with visibility state
|
|
17
|
+
* @returns Props for legend components
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export function useLegendProps(colorStrategy, config, categoryItems) {
|
|
22
|
+
const { geoData } = useGeoData();
|
|
23
|
+
return useMemo(() => {
|
|
24
|
+
const colorFormat = geoData?.color?.format;
|
|
25
|
+
const sizeFormat = geoData?.size?.format;
|
|
26
|
+
const format = colorFormat || sizeFormat;
|
|
27
|
+
const colorLegendValue = colorStrategy ? colorStrategy.getColorByIndex(0) : null;
|
|
28
|
+
return {
|
|
29
|
+
geoData,
|
|
30
|
+
categoryItems,
|
|
31
|
+
colorStrategy,
|
|
32
|
+
colorLegendValue,
|
|
33
|
+
format,
|
|
34
|
+
config,
|
|
35
|
+
};
|
|
36
|
+
}, [geoData, categoryItems, colorStrategy, config]);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useLegendProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLegendProps.js","sourceRoot":"","sources":["../../../../src/next/hooks/legend/useLegendProps.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAyC7D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAC1B,aAAoC,EACpC,MAA8C,EAC9C,aAA2C;IAE3C,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;IAEjC,OAAO,OAAO,CAAC,GAAG,EAAE;QAChB,MAAM,WAAW,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC;QAC3C,MAAM,UAAU,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC;QACzC,MAAM,MAAM,GAAG,WAAW,IAAI,UAAU,CAAC;QAEzC,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEjF,OAAO;YACH,OAAO;YACP,aAAa;YACb,aAAa;YACb,gBAAgB;YAChB,MAAM;YACN,MAAM;SACT,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AACxD,CAAC"}
|