@antv/aimapui 0.3.0 → 0.3.1

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.d.ts CHANGED
@@ -1,17 +1,10 @@
1
- import { BaiduMap } from '@antv/l7-maps';
2
1
  import { Component } from 'react';
3
2
  import { default as default_2 } from 'react';
4
- import { default as default_3 } from 'node_modules/@antv/l7-maps/es/amap-next';
5
3
  import { Feature } from 'geojson';
6
- import { GoogleMap } from '@antv/l7-maps';
7
4
  import { JSX as JSX_2 } from 'react/jsx-runtime';
8
- import { Map as Map_2 } from '@antv/l7-maps';
9
- import { Mapbox } from '@antv/l7-maps';
10
- import { MapLibre } from '@antv/l7-maps';
11
5
  import { ReactNode } from 'react';
6
+ import { RefObject } from 'react';
12
7
  import { Scene } from '@antv/l7';
13
- import { TencentMap } from '@antv/l7-maps';
14
- import { TMap } from '@antv/l7-maps';
15
8
 
16
9
  export declare type ActiveConfig = boolean | {
17
10
  color: string;
@@ -819,6 +812,86 @@ export declare interface AnimateConfig {
819
812
  repeat?: number;
820
813
  }
821
814
 
815
+ export declare const AnnotationControl: default_2.ForwardRefExoticComponent<AnnotationControlProps & default_2.RefAttributes<AnnotationControlHandle>>;
816
+
817
+ export declare interface AnnotationControlHandle {
818
+ setMode: (mode: AnnotationMode) => void;
819
+ addAnnotation: (feature: AnnotationFeature) => void;
820
+ updateAnnotation: (id: string, properties: Partial<AnnotationProperties>) => void;
821
+ deleteAnnotation: (id: string) => void;
822
+ clearAll: () => void;
823
+ getAnnotations: () => AnnotationFeature[];
824
+ selectAnnotation: (id: string | null) => void;
825
+ }
826
+
827
+ export declare interface AnnotationControlProps {
828
+ position?: L7ControlPosition;
829
+ defaultFeatures?: AnnotationFeature[];
830
+ features?: AnnotationFeature[];
831
+ tools?: AnnotationToolMode[];
832
+ styles?: AnnotationStyleConfig;
833
+ onUpload?: (file: File, type: 'image' | 'video') => Promise<string>;
834
+ className?: string;
835
+ style?: React.CSSProperties;
836
+ onAnnotationCreate?: (feature: AnnotationFeature) => void;
837
+ onAnnotationUpdate?: (feature: AnnotationFeature) => void;
838
+ onAnnotationDelete?: (feature: AnnotationFeature) => void;
839
+ onAnnotationSelect?: (feature: AnnotationFeature | null) => void;
840
+ onModeChange?: (mode: AnnotationMode) => void;
841
+ onChange?: (features: AnnotationFeature[]) => void;
842
+ }
843
+
844
+ export declare interface AnnotationFeature extends Feature {
845
+ id: string;
846
+ properties: AnnotationProperties;
847
+ }
848
+
849
+ export declare type AnnotationMode = 'marker' | 'highlighter' | 'text' | 'note' | 'link' | 'image' | 'video' | 'select' | 'none';
850
+
851
+ export declare type AnnotationProperties = MarkerAnnotationProperties | HighlighterAnnotationProperties | TextAnnotationProperties | NoteAnnotationProperties | LinkAnnotationProperties | ImageAnnotationProperties | VideoAnnotationProperties;
852
+
853
+ declare interface AnnotationPropertiesBase {
854
+ annotationType: AnnotationType;
855
+ color?: string;
856
+ createdAt?: string;
857
+ updatedAt?: string;
858
+ }
859
+
860
+ export declare interface AnnotationStyleConfig {
861
+ marker?: {
862
+ color?: string;
863
+ size?: number;
864
+ };
865
+ highlighter?: {
866
+ color?: string;
867
+ width?: number;
868
+ opacity?: number;
869
+ };
870
+ text?: {
871
+ color?: string;
872
+ fontSize?: number;
873
+ fontFamily?: string;
874
+ };
875
+ note?: {
876
+ color?: string;
877
+ maxWidth?: number;
878
+ };
879
+ link?: {
880
+ color?: string;
881
+ };
882
+ image?: {
883
+ maxWidth?: number;
884
+ borderRadius?: number;
885
+ };
886
+ video?: {
887
+ maxWidth?: number;
888
+ };
889
+ }
890
+
891
+ export declare type AnnotationToolMode = Exclude<AnnotationMode, 'none'>;
892
+
893
+ declare type AnnotationType = 'marker' | 'highlighter' | 'text' | 'note' | 'link' | 'image' | 'video';
894
+
822
895
  export declare function applyControlDefaults(control: ControlSchema): ControlSchema;
823
896
 
824
897
  export declare function applyLayerDefaults(layer: LayerSchema): LayerSchema;
@@ -1021,7 +1094,7 @@ declare type BubbleAnchor = 'center' | 'top' | 'right' | 'bottom' | 'left' | 'to
1021
1094
  * - bubbleAnchor='center', labelAnchor='center' — 标签居中覆盖气泡(适合短文本)
1022
1095
  * - bubbleAnchor='bottom', labelAnchor='top' — 标签在气泡上方(经典布局)
1023
1096
  */
1024
- export declare function BubbleLayer({ source, sourceType, sourceConfig, labelField, labelColor, labelSize, showLabel, labelTrigger, labelOffset, sizeDomain, bubbleAnchor, labelAnchor, hoverEffect, clickEffect, tooltipEffect, tooltipFields, tooltipTemplate, semanticColorField, color, size, sizeField, sizeValues, style, active, select, onClick, onMouseMove, onMouseEnter, onMouseLeave, ...rest }: BubbleLayerProps): JSX_2.Element;
1097
+ export declare function BubbleLayer({ source, sourceType, sourceConfig, labelField, labelColor, labelSize, showLabel, labelOffset, sizeDomain, bubbleAnchor, labelAnchor, hoverEffect, clickEffect, tooltipEffect, tooltipFields, tooltipTemplate, semanticColorField, color, size, sizeField, sizeValues, style, active, select, onClick, onMouseMove, onMouseEnter, onMouseLeave, ...rest }: BubbleLayerProps): JSX_2.Element;
1025
1098
 
1026
1099
  export declare interface BubbleLayerProps extends Omit<LayerSchema, 'type' | 'source' | 'sourceType' | 'sourceConfig'> {
1027
1100
  source: LayerSchema['source'];
@@ -1032,8 +1105,6 @@ export declare interface BubbleLayerProps extends Omit<LayerSchema, 'type' | 'so
1032
1105
  labelColor?: string;
1033
1106
  labelSize?: number;
1034
1107
  showLabel?: boolean;
1035
- /** 文本标签触发方式:'always' 始终显示 | 'hover' 鼠标划过时显示,默认 'always' */
1036
- labelTrigger?: 'always' | 'hover';
1037
1108
  /** 文本偏移量,默认根据气泡最大半径自动计算 */
1038
1109
  labelOffset?: [number, number];
1039
1110
  /** sizeField 为离散值时,对应每个 sizeValues 的域值顺序(默认 1..N) */
@@ -1262,7 +1333,7 @@ export declare type ControlType = 'zoom' | 'scale' | 'fullscreen' | 'geoLocate'
1262
1333
  * 底图工厂 — 根据配置创建 L7 Map 实例
1263
1334
  * 动态导入各底图模块,避免未使用时打包
1264
1335
  */
1265
- export declare function createBasemap(schema: MapSchema): Promise<default_3 | Mapbox | TMap | TencentMap | BaiduMap | MapLibre | GoogleMap | Map_2>;
1336
+ export declare function createBasemap(schema: MapSchema): Promise<unknown>;
1266
1337
 
1267
1338
  /**
1268
1339
  * 创建 EventBus 实例
@@ -1740,6 +1811,13 @@ export declare interface GestureConfig {
1740
1811
  dragRotate?: boolean;
1741
1812
  }
1742
1813
 
1814
+ /**
1815
+ * 根据控件 position 计算弹出面板的初始方向
1816
+ * - top* → 向下弹出, bottom* → 向上弹出
1817
+ * - left* → 向右弹出, right* → 向左弹出
1818
+ */
1819
+ export declare function getPopperDirection(pos: L7ControlPosition): string;
1820
+
1743
1821
  /**
1744
1822
  * 字体图标标注图层(GlyphLayer)
1745
1823
  *
@@ -1887,6 +1965,12 @@ export { HexagonLayerProps }
1887
1965
  */
1888
1966
  export declare function hexToRgba(hex: string, alpha?: number): string;
1889
1967
 
1968
+ declare interface HighlighterAnnotationProperties extends AnnotationPropertiesBase {
1969
+ annotationType: 'highlighter';
1970
+ strokeWidth?: number;
1971
+ strokeOpacity?: number;
1972
+ }
1973
+
1890
1974
  export declare type IconAnchor = 'center' | 'top' | 'bottom' | 'left' | 'right';
1891
1975
 
1892
1976
  /** 图标锚点位置 */
@@ -1949,12 +2033,22 @@ export declare interface IconLayerProps extends Omit<LayerSchema, 'type' | 'sour
1949
2033
  onMouseLeave?: (payload: LayerEventPayload) => void;
1950
2034
  }
1951
2035
 
2036
+ declare interface ImageAnnotationProperties extends AnnotationPropertiesBase {
2037
+ annotationType: 'image';
2038
+ src: string;
2039
+ alt?: string;
2040
+ width?: number;
2041
+ height?: number;
2042
+ }
2043
+
1952
2044
  export declare const ImageCalibrationControl: default_2.ForwardRefExoticComponent<ImageCalibrationControlProps & default_2.RefAttributes<ImageCalibrationHandle>>;
1953
2045
 
1954
2046
  /** ImageCalibrationControl 组件 Props */
1955
2047
  export declare interface ImageCalibrationControlProps {
1956
2048
  /** 控件位置 */
1957
2049
  position?: L7ControlPosition;
2050
+ /** 布局方向,默认 vertical */
2051
+ layout?: 'vertical' | 'horizontal';
1958
2052
  /** 受控模式:外部传入角点 */
1959
2053
  corners?: GeoCorners;
1960
2054
  /** 非受控模式:初始角点 */
@@ -1965,6 +2059,10 @@ export declare interface ImageCalibrationControlProps {
1965
2059
  opacity?: number;
1966
2060
  /** 接受的文件类型,默认 'image/*' */
1967
2061
  accept?: string;
2062
+ /** 是否启用图片裁剪功能,默认 true */
2063
+ enableCrop?: boolean;
2064
+ /** 是否启用初始坐标输入功能,默认 true */
2065
+ enableInitialCoords?: boolean;
1968
2066
  /** 额外 className */
1969
2067
  className?: string;
1970
2068
  /** 额外 style */
@@ -1980,6 +2078,14 @@ export declare interface ImageCalibrationControlProps {
1980
2078
  width: number;
1981
2079
  height: number;
1982
2080
  }) => void;
2081
+ /** 裁剪预处理完成回调,返回裁剪后的尺寸和可选的初始坐标 */
2082
+ onPreprocess?: (result: {
2083
+ croppedDimensions: {
2084
+ width: number;
2085
+ height: number;
2086
+ };
2087
+ initialCorners: GeoCorners | null;
2088
+ }) => void;
1983
2089
  /** 清除回调 */
1984
2090
  onClear?: () => void;
1985
2091
  }
@@ -2475,6 +2581,12 @@ export declare interface LineLayerProps extends Omit<LayerSchema, 'type' | 'sour
2475
2581
  onLayerCreated?: (layer: any) => void;
2476
2582
  }
2477
2583
 
2584
+ declare interface LinkAnnotationProperties extends AnnotationPropertiesBase {
2585
+ annotationType: 'link';
2586
+ url: string;
2587
+ title?: string;
2588
+ }
2589
+
2478
2590
  export declare function LogoControl({ logos, position, className, style, }: LogoControlProps): JSX_2.Element;
2479
2591
 
2480
2592
  export declare interface LogoControlProps {
@@ -2577,7 +2689,10 @@ declare interface MapSceneRendererProps {
2577
2689
  }
2578
2690
 
2579
2691
  export declare interface MapSchema {
2580
- basemap: BasemapType;
2692
+ /** 底图类型(与 engine 二选一,传 engine 时可省略) */
2693
+ basemap?: BasemapType;
2694
+ /** 外部注入的地图引擎构造函数,跳过动态 import */
2695
+ engine?: new (opts: Record<string, unknown>) => unknown;
2581
2696
  token?: string;
2582
2697
  style?: MapStylePreset | string;
2583
2698
  center?: [number, number];
@@ -2611,6 +2726,12 @@ export declare interface MapThemeControlProps {
2611
2726
 
2612
2727
  export declare function Marker({ longitude, latitude, variant, color, icon, label, content, children, draggable, className, overlayContainer, onClick, onMouseEnter, onMouseLeave, onDoubleClick, onDragEnd, onDragging, onDragStart, selected, inactive, anchor, offsets, overflowHide, }: MarkerProps): null;
2613
2728
 
2729
+ declare interface MarkerAnnotationProperties extends AnnotationPropertiesBase {
2730
+ annotationType: 'marker';
2731
+ icon?: string;
2732
+ label?: string;
2733
+ }
2734
+
2614
2735
  /**
2615
2736
  * Marker 聚合图层(基于 supercluster)
2616
2737
  *
@@ -2783,6 +2904,12 @@ export declare interface MouseLocationControlProps {
2783
2904
  style?: default_2.CSSProperties;
2784
2905
  }
2785
2906
 
2907
+ declare interface NoteAnnotationProperties extends AnnotationPropertiesBase {
2908
+ annotationType: 'note';
2909
+ title: string;
2910
+ body?: string;
2911
+ }
2912
+
2786
2913
  /**
2787
2914
  * Mapbox / Maplibre 主题预设 — 基于 openfreemap 样式
2788
2915
  */
@@ -3300,6 +3427,12 @@ declare interface SourceOutput {
3300
3427
 
3301
3428
  export declare type SourceType = 'geojson' | 'json' | 'csv' | 'raster' | 'rasterTile' | 'image';
3302
3429
 
3430
+ declare interface TextAnnotationProperties extends AnnotationPropertiesBase {
3431
+ annotationType: 'text';
3432
+ text: string;
3433
+ fontSize?: number;
3434
+ }
3435
+
3303
3436
  declare interface ThemeContextValue {
3304
3437
  /** 当前解析后的实际主题(light 或 dark) */
3305
3438
  resolvedTheme: 'light' | 'dark';
@@ -3542,6 +3675,19 @@ export declare function useMapControl(position?: L7ControlPosition): {
3542
3675
  */
3543
3676
  export declare function useMapPosition(scene: Scene | null, longitude: number, latitude: number, onPositionUpdate: PositionCallback_2): void;
3544
3677
 
3678
+ /**
3679
+ * Popper 弹出方向 Hook —— 根据控件 position 给出初始方向,
3680
+ * 弹出后检测视口溢出并自动翻转。
3681
+ *
3682
+ * 返回 { popperRef, popperClass }
3683
+ * - popperRef:挂到弹出容器 div 上
3684
+ * - popperClass:当前计算出的 CSS class 字符串
3685
+ */
3686
+ export declare function usePopperPosition(position: L7ControlPosition, open: boolean, anchorRef: React.RefObject<HTMLElement | null>): {
3687
+ popperRef: RefObject<HTMLDivElement>;
3688
+ popperClass: string;
3689
+ };
3690
+
3545
3691
  export declare function useResponsive(): ResponsiveContextValue;
3546
3692
 
3547
3693
  export declare function useScene(): Scene | null;
@@ -3573,6 +3719,13 @@ export declare interface ValidationError {
3573
3719
  severity: 'error' | 'warning';
3574
3720
  }
3575
3721
 
3722
+ declare interface VideoAnnotationProperties extends AnnotationPropertiesBase {
3723
+ annotationType: 'video';
3724
+ url: string;
3725
+ thumbnailUrl?: string;
3726
+ title?: string;
3727
+ }
3728
+
3576
3729
  declare interface VisualConfig {
3577
3730
  color?: ColorConfig;
3578
3731
  size?: SizeConfig;