@carto/ps-react-maps 4.6.2 → 4.7.0
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/dist/index.js +1531 -1343
- package/dist/index.js.map +1 -1
- package/dist/types/editable/lasso-tools/types.d.ts +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/models/utils/resolve-property-for-source.d.ts +2 -2
- package/dist/types/providers/map/types.d.ts +6 -3
- package/dist/types/use-spatial-filter.d.ts +40 -0
- package/package.json +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type { BasemapsControlsProps, BasemapKey, BasemapType, DeckGLComponentPro
|
|
|
2
2
|
export { CartoBasemaps, CartoBasemapURL, GmapsBasemap, MAPS_BASEMAP, MapsTypes, } from './const';
|
|
3
3
|
export { DeckGLComponent } from './maps/deckgl';
|
|
4
4
|
export { BasemapsControls } from './basemap-controls';
|
|
5
|
-
export type { DefaultLassoToolsProps, LassoToolsChildrenProps, LassoToolsControlProps, LassoToolsLayerEditProps, LassoToolsLayerProps, LassoToolsLayersProps, LassoToolsProps, LassoToolsState, } from './editable/lasso-tools/types';
|
|
5
|
+
export type { DefaultLassoToolsProps, LassoToolsChildrenProps, LassoToolsControlProps, LassoToolsData, LassoToolsLayerEditProps, LassoToolsLayerProps, LassoToolsLayersProps, LassoToolsProps, LassoToolsState, } from './editable/lasso-tools/types';
|
|
6
6
|
export { DEFAULT_LASSO_TOOLS_COLORS, DEFAULT_LASSO_TOOLS_LAYER_PROPS, DEFAULT_LASSO_TOOLS_MODES, DEFAULT_LASSO_TOOLS_PROPS, DEFAULT_MASK_LAYER_PROPS, MAP_LASSO_TOOLS_LAYER_ID, MAP_MASK_LAYER_ID, } from './editable/lasso-tools/const';
|
|
7
7
|
export { CustomCompositeEditMode } from './editable/lasso-tools/modes/custom-edit-mode.class';
|
|
8
8
|
export { LassoTools } from './editable/lasso-tools/lasso-tools';
|
|
@@ -51,7 +51,8 @@ export { useEventManager } from './use-event-manager';
|
|
|
51
51
|
export { useLayers } from './use-layers';
|
|
52
52
|
export { useLegend } from './use-legend';
|
|
53
53
|
export { useMapScreenshot } from './use-map-screenshot';
|
|
54
|
-
export {
|
|
54
|
+
export type { GroupedSpatialFilterResult } from './use-spatial-filter';
|
|
55
|
+
export { useSpatialFilter, useLassoToolsSpatialFilter, useViewportSpatialFilter, useGroupedSpatialFilter, useGroupedLassoToolsSpatialFilters, useGroupedStaticSpatialFilters, } from './use-spatial-filter';
|
|
55
56
|
export type { FieldFormatter, Formatter, Formatters, ObjectToHtmlOptions, Value, } from './utils/object-to-html/types';
|
|
56
57
|
export { formatterTypes } from './utils/object-to-html/const';
|
|
57
58
|
export { objectToHtml } from './utils/object-to-html/object-to-html';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @returns The resolved string value for the source
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
export declare function resolvePropertyForSource(value:
|
|
10
|
+
export declare function resolvePropertyForSource(value: unknown, sourceIndex: number, totalSources: number, propertyName: string): unknown;
|
|
11
11
|
/**
|
|
12
12
|
* Resolves the column value for a specific source index
|
|
13
13
|
* @param column - Single column string or array of columns
|
|
@@ -16,4 +16,4 @@ export declare function resolvePropertyForSource(value: string | string[] | unde
|
|
|
16
16
|
* @returns The resolved column string for the source
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
|
-
export declare function resolveColumnForSource(column: string | string[] | undefined, sourceIndex: number, totalSources: number):
|
|
19
|
+
export declare function resolveColumnForSource(column: string | string[] | undefined, sourceIndex: number, totalSources: number): unknown;
|
|
@@ -2,6 +2,9 @@ import { MapViewState, WebMercatorViewport } from '@deck.gl/core';
|
|
|
2
2
|
import { DeckGLComponentProps, InstanceRef, MapComponentProps, OverlayRef } from '../../types';
|
|
3
3
|
import { SpatialFilter } from '@carto/api-client';
|
|
4
4
|
import { Position } from 'geojson';
|
|
5
|
+
export type SpatialFilterWithGroup = SpatialFilter & {
|
|
6
|
+
groupId?: number;
|
|
7
|
+
};
|
|
5
8
|
interface ValueProps {
|
|
6
9
|
id: MapComponentProps['id'];
|
|
7
10
|
/**
|
|
@@ -13,7 +16,7 @@ interface ValueProps {
|
|
|
13
16
|
isLoaded: boolean;
|
|
14
17
|
basemap: NonNullable<MapComponentProps['basemap']>;
|
|
15
18
|
layers?: string[];
|
|
16
|
-
spatialFilter?: Record<string,
|
|
19
|
+
spatialFilter?: Record<string, SpatialFilterWithGroup | null>;
|
|
17
20
|
controller?: DeckGLComponentProps['controller'];
|
|
18
21
|
}
|
|
19
22
|
export interface MapProviderProps {
|
|
@@ -73,8 +76,8 @@ export interface CommonSlice {
|
|
|
73
76
|
}) => void;
|
|
74
77
|
}
|
|
75
78
|
export interface SpatialFilterSlice {
|
|
76
|
-
spatialFilter: Record<ValueProps['id'], Record<string,
|
|
77
|
-
setSpatialFilter: (mapId: ValueProps['id'], id: string, value:
|
|
79
|
+
spatialFilter: Record<ValueProps['id'], Record<string, SpatialFilterWithGroup | null>>;
|
|
80
|
+
setSpatialFilter: (mapId: ValueProps['id'], id: string, value: SpatialFilterWithGroup) => void;
|
|
78
81
|
removeSpatialFilter: (mapId: ValueProps['id'], id: string) => void;
|
|
79
82
|
}
|
|
80
83
|
export interface LayerActionsSlice {
|
|
@@ -17,3 +17,43 @@ export declare function useLassoToolsSpatialFilter({ mapId, }: {
|
|
|
17
17
|
export declare function useStaticSpatialFilter({ mapId, }: {
|
|
18
18
|
mapId: MapComponentProps['id'];
|
|
19
19
|
}): SpatialFilter | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Type for grouped spatial filter result
|
|
22
|
+
*/
|
|
23
|
+
export type GroupedSpatialFilterResult = SpatialFilter[];
|
|
24
|
+
export declare function useGroupedSpatialFilter({ mapId, }: {
|
|
25
|
+
mapId: MapComponentProps['id'];
|
|
26
|
+
}): {
|
|
27
|
+
spatialFilter: GroupedSpatialFilterResult;
|
|
28
|
+
staticSpatialFilter: GroupedSpatialFilterResult;
|
|
29
|
+
lassoToolsSpatialFilter: GroupedSpatialFilterResult;
|
|
30
|
+
viewportSpatialFilter: GroupedSpatialFilterResult;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Hook to create multipolygon geometries for each group of lasso tool values.
|
|
34
|
+
* Groups are identified by the groupId property in LassoToolsData.
|
|
35
|
+
* Uses per-group memoization to only recompute multipolygons when a specific group changes.
|
|
36
|
+
* This optimizes performance by avoiding expensive multiPolygon() calls for unchanged groups.
|
|
37
|
+
*
|
|
38
|
+
* @param mapId - The map component ID
|
|
39
|
+
* @param groupIds - Optional array of group IDs to filter results. If empty or undefined, returns all groups
|
|
40
|
+
* @returns Array of objects with groupId and spatialFilter, ordered by groupId
|
|
41
|
+
*/
|
|
42
|
+
export declare function useGroupedLassoToolsSpatialFilters({ mapId, groupIds, }: {
|
|
43
|
+
mapId: MapComponentProps['id'];
|
|
44
|
+
groupIds?: number[];
|
|
45
|
+
}): GroupedSpatialFilterResult;
|
|
46
|
+
/**
|
|
47
|
+
* Hook to create multipolygon geometries for each group of static spatial filters.
|
|
48
|
+
* Groups are identified by the groupId property in SpatialFilterWithGroup.
|
|
49
|
+
* Uses per-group memoization to only recompute multipolygons when a specific group changes.
|
|
50
|
+
* This optimizes performance by avoiding expensive multiPolygon() calls for unchanged groups.
|
|
51
|
+
*
|
|
52
|
+
* @param mapId - The map component ID
|
|
53
|
+
* @param groupIds - Optional array of group IDs to filter results. If empty or undefined, returns all groups
|
|
54
|
+
* @returns Array of objects with groupId and spatialFilter, ordered by groupId
|
|
55
|
+
*/
|
|
56
|
+
export declare function useGroupedStaticSpatialFilters({ mapId, groupIds, }: {
|
|
57
|
+
mapId: MapComponentProps['id'];
|
|
58
|
+
groupIds?: number[];
|
|
59
|
+
}): GroupedSpatialFilterResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carto/ps-react-maps",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "CARTO's Professional Service React DeckGL library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-map-gl": "8.1.0",
|
|
28
28
|
"zustand": "5.0.8",
|
|
29
29
|
"@carto/ps-utils": "2.0.1",
|
|
30
|
-
"@carto/ps-services": "2.
|
|
30
|
+
"@carto/ps-services": "2.7.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@tanstack/react-query": "^5.0.0",
|