@wenle_2523097/agri-map 1.0.2 → 1.0.4

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.
Files changed (99) hide show
  1. package/dist/components/ConfigProvider/index.d.ts +15 -0
  2. package/dist/components/DualScaleControl/index.d.ts +10 -0
  3. package/dist/components/Icons/SelectIcon.d.ts +68 -0
  4. package/dist/components/Icons/index.d.ts +43 -0
  5. package/dist/components/Irrigation/index.d.ts +8 -0
  6. package/dist/components/Irrigation/toolbar.d.ts +6 -0
  7. package/dist/components/Loading/index.d.ts +40 -0
  8. package/dist/components/MapContent/index.d.ts +17 -0
  9. package/dist/components/MapSizeHandler/index.d.ts +24 -0
  10. package/dist/components/Marker/ClusterView.d.ts +29 -0
  11. package/dist/components/Marker/MapClickHandler.d.ts +25 -0
  12. package/dist/components/Marker/index.d.ts +61 -0
  13. package/dist/components/Marker/parseClusterConfig.d.ts +25 -0
  14. package/dist/components/Marker/toolbar.d.ts +6 -0
  15. package/dist/components/Marker/useEditHandlers.d.ts +44 -0
  16. package/dist/components/Marker/useIconConfig.d.ts +23 -0
  17. package/dist/components/Marker/useMarkerCommands.d.ts +30 -0
  18. package/dist/components/Measurement/toolbar.d.ts +20 -0
  19. package/dist/components/MiniMap/index.d.ts +16 -0
  20. package/dist/components/Notification/index.d.ts +12 -0
  21. package/dist/components/PlotGroupLayer/index.d.ts +8 -0
  22. package/dist/components/PlotLayer/index.d.ts +7 -0
  23. package/dist/components/PlotLayer/label.d.ts +12 -0
  24. package/dist/components/PlotLayer/leaflet-types.d.ts +59 -0
  25. package/dist/components/PlotLayer/parseConfig.d.ts +15 -0
  26. package/dist/components/PlotLayer/toolbar.d.ts +6 -0
  27. package/dist/components/PlotLayer/types.d.ts +10 -0
  28. package/dist/components/PlotLayer/usePlotCommands.d.ts +33 -0
  29. package/dist/components/PlotLayer/usePlotData.d.ts +32 -0
  30. package/dist/components/PlotLayer/usePlotEditMode.d.ts +92 -0
  31. package/dist/components/Road/index.d.ts +8 -0
  32. package/dist/components/Road/toolbar.d.ts +6 -0
  33. package/dist/components/TianDiTuLayer/index.d.ts +15 -0
  34. package/dist/components/Track/ClusterView.d.ts +20 -0
  35. package/dist/components/Track/TrackView.d.ts +24 -0
  36. package/dist/components/Track/commands.d.ts +53 -0
  37. package/dist/components/Track/constants.d.ts +34 -0
  38. package/dist/components/Track/index.d.ts +54 -0
  39. package/dist/components/Track/parseConfig.d.ts +40 -0
  40. package/dist/components/Track/types.d.ts +38 -0
  41. package/dist/components/Track/useMarkerIcon.d.ts +14 -0
  42. package/dist/components/Track/useTrackCommands.d.ts +56 -0
  43. package/dist/components/shared/BaseEditToolbar.d.ts +100 -0
  44. package/dist/components/shared/ToolbarButton.d.ts +49 -0
  45. package/dist/components/shared/index.d.ts +5 -0
  46. package/dist/constants/device.d.ts +14 -0
  47. package/dist/constants/index.d.ts +20 -0
  48. package/dist/constants/map.d.ts +13 -0
  49. package/dist/constants/plot.d.ts +33 -0
  50. package/dist/constants/road.d.ts +12 -0
  51. package/dist/constants/styles.d.ts +57 -0
  52. package/dist/constants/theme.d.ts +47 -0
  53. package/dist/constants/unit.d.ts +11 -0
  54. package/dist/hooks/index.d.ts +8 -0
  55. package/dist/hooks/useEditMode.d.ts +75 -0
  56. package/dist/hooks/useLatestRef.d.ts +17 -0
  57. package/dist/hooks/usePolylineEditor.d.ts +65 -0
  58. package/dist/hooks/usePolylineRenderer.d.ts +34 -0
  59. package/dist/hooks/useTheme.d.ts +13 -0
  60. package/dist/index.d.ts +312 -0
  61. package/dist/index.esm.js +30 -0
  62. package/dist/index.esm.js.map +1 -1
  63. package/dist/index.js +30 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.umd.js +30 -0
  66. package/dist/index.umd.js.map +1 -1
  67. package/dist/types/basic.d.ts +57 -0
  68. package/dist/types/components.d.ts +56 -0
  69. package/dist/types/config.d.ts +112 -0
  70. package/dist/types/decorator.d.ts +26 -0
  71. package/dist/types/icon.d.ts +52 -0
  72. package/dist/types/index.d.ts +20 -0
  73. package/dist/types/irrigation.d.ts +315 -0
  74. package/dist/types/layer.d.ts +40 -0
  75. package/dist/types/loading.d.ts +62 -0
  76. package/dist/types/marker.d.ts +299 -0
  77. package/dist/types/measurement.d.ts +121 -0
  78. package/dist/types/notification.d.ts +50 -0
  79. package/dist/types/plot.d.ts +479 -0
  80. package/dist/types/road.d.ts +382 -0
  81. package/dist/types/toolbar.d.ts +176 -0
  82. package/dist/types/track.d.ts +386 -0
  83. package/dist/utils/area.d.ts +57 -0
  84. package/dist/utils/clusterIcon.d.ts +16 -0
  85. package/dist/utils/createAntPath.d.ts +13 -0
  86. package/dist/utils/geometry.d.ts +41 -0
  87. package/dist/utils/iconCache.d.ts +49 -0
  88. package/dist/utils/iconUtils.d.ts +46 -0
  89. package/dist/utils/index.d.ts +11 -0
  90. package/dist/utils/leafletIcons.d.ts +40 -0
  91. package/dist/utils/mapAnimation.d.ts +14 -0
  92. package/dist/utils/markerSvg.d.ts +19 -0
  93. package/dist/utils/pulseIcon.d.ts +28 -0
  94. package/dist/utils/spatialIndex.d.ts +56 -0
  95. package/dist/utils/toggleItemState.d.ts +15 -0
  96. package/dist/utils/trackSimplify.d.ts +23 -0
  97. package/package.json +7 -3
  98. package/dist/index.css +0 -4635
  99. package/dist/index.css.map +0 -1
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 全局配置提供者组件
3
+ * @description 使用 React Context 为子组件提供统一的全局配置
4
+ */
5
+ import type { ConfigContextValue, ConfigProviderProps } from '../../types';
6
+ /**
7
+ * 获取配置上下文的 Hook
8
+ * @returns 配置对象
9
+ */
10
+ export declare const useConfig: () => ConfigContextValue;
11
+ /**
12
+ * 全局配置提供者组件
13
+ */
14
+ declare const ConfigProvider: ({ theme, dualScaleControl, tianDiTuLayer, mapSizeHandler, children }: ConfigProviderProps) => JSX.Element;
15
+ export default ConfigProvider;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 双向标尺组件
3
+ * @description 在地图上同时显示水平和垂直两个标尺,覆盖整个地图窗口
4
+ */
5
+ import type { DualScaleControlProps } from '../../types';
6
+ /**
7
+ * 双向标尺组件
8
+ */
9
+ declare const DualScaleControl: ({ config: configProp, theme: themeProp, layerType, scaleColor: scaleColorProp, controlBg: controlBgProp, controlText: controlTextProp, }: DualScaleControlProps) => null;
10
+ export default DualScaleControl;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * SelectIcon 图标选择器组件
3
+ * @description 兼容 antd Form 的 value/onChange 接口,用于选择预设地图图标
4
+ * @example
5
+ * // antd Form 中使用
6
+ * <Form.Item label="图标" name="icon">
7
+ * <SelectIcon />
8
+ * </Form.Item>
9
+ *
10
+ * // 独立使用
11
+ * const [icon, setIcon] = useState('marker-blue');
12
+ * <SelectIcon value={icon} onChange={setIcon} />
13
+ */
14
+ import { type CSSProperties } from 'react';
15
+ import type { PresetIconName } from '../../types/icon';
16
+ export interface IconGroupItem {
17
+ /** 图标名称(预设图标名称) */
18
+ type: PresetIconName;
19
+ /** 图标显示名称 */
20
+ name: string;
21
+ }
22
+ export interface IconGroup {
23
+ /** 分组标签 */
24
+ label: string;
25
+ /** 分组内图标列表 */
26
+ icons: IconGroupItem[];
27
+ }
28
+ /** 默认预设图标分组 */
29
+ export declare const DEFAULT_ICON_GROUPS: IconGroup[];
30
+ export interface IconPreviewProps {
31
+ /** 图标类型 */
32
+ iconType: string;
33
+ /** 图标尺寸,默认 24 */
34
+ size?: number;
35
+ /** 是否启用动画,默认 false */
36
+ animated?: boolean;
37
+ /** 样式 */
38
+ style?: CSSProperties;
39
+ }
40
+ /**
41
+ * 图标预览组件
42
+ * @description 根据图标类型渲染不同的预览效果
43
+ */
44
+ export declare function IconPreview({ iconType, size, animated, style }: IconPreviewProps): JSX.Element;
45
+ export interface SelectIconProps {
46
+ /** 当前选中值(兼容 antd Form) */
47
+ value?: string;
48
+ /** 选中变化回调(兼容 antd Form) */
49
+ onChange?: (value: string) => void;
50
+ /** 占位文本 */
51
+ placeholder?: string;
52
+ /** 是否禁用 */
53
+ disabled?: boolean;
54
+ /** 预览图标尺寸,默认 20 */
55
+ previewSize?: number;
56
+ /** 是否可清除 */
57
+ allowClear?: boolean;
58
+ /** 自定义样式 */
59
+ style?: CSSProperties;
60
+ /** 自定义 className */
61
+ className?: string;
62
+ /** 自定义图标分组(可选,默认使用预设分组) */
63
+ groups?: IconGroup[];
64
+ /** 主题模式,默认跟随系统浅色 */
65
+ theme?: 'light' | 'dark';
66
+ }
67
+ export declare function SelectIcon({ value, onChange, placeholder, disabled, previewSize, allowClear, style, className, groups, theme, }: SelectIconProps): JSX.Element;
68
+ export default SelectIcon;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * SVG 图标组件库
3
+ * @description 统一的 SVG 图标组件,用于工具栏等场景
4
+ */
5
+ /** 图标组件属性 */
6
+ interface IconProps {
7
+ size?: number;
8
+ color?: string;
9
+ /** 无障碍标签文本 */
10
+ ariaLabel?: string;
11
+ /** 是否对屏幕阅读器隐藏,默认 true */
12
+ ariaHidden?: boolean;
13
+ }
14
+ export declare const MarkerRedrawIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
15
+ export declare const PlotRedrawIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
16
+ export declare const RoadRedrawIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
17
+ export declare const IrrigationRedrawIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
18
+ export declare const ClipIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
19
+ export declare const MoveIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
20
+ export declare const DeleteIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
21
+ export declare const CancelIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
22
+ export declare const SaveIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
23
+ export declare const CreateIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
24
+ export declare const EditIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
25
+ export declare const ReverseIcon: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
26
+ /** 图标组件映射 */
27
+ declare const Icons: {
28
+ MarkerRedraw: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
29
+ PlotRedraw: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
30
+ RoadRedraw: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
31
+ IrrigationRedraw: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
32
+ Clip: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
33
+ Move: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
34
+ Delete: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
35
+ Cancel: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
36
+ Save: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
37
+ Create: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
38
+ Edit: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
39
+ Reverse: ({ size, color, ariaLabel, ariaHidden }: IconProps) => JSX.Element;
40
+ };
41
+ export default Icons;
42
+ export { SelectIcon, IconPreview, DEFAULT_ICON_GROUPS } from './SelectIcon';
43
+ export type { SelectIconProps, IconPreviewProps, IconGroup, IconGroupItem } from './SelectIcon';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 灌溉渠组件
3
+ */
4
+ import '@geoman-io/leaflet-geoman-free';
5
+ import 'leaflet-ant-path';
6
+ import type { IrrigationProps, IrrigationRef } from '../../types';
7
+ declare const Irrigation: import("react").ForwardRefExoticComponent<IrrigationProps & import("react").RefAttributes<IrrigationRef>>;
8
+ export default Irrigation;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 灌溉渠编辑工具栏组件
3
+ */
4
+ import type { IrrigationEditToolbarProps } from '../../types';
5
+ declare const IrrigationEditToolbar: ({ visible, selectedChannelId, currentMode, enabledButtons, pointCount, hintMessage, showHint, color, size, iconOnly, children, onCreate, onEdit, onRedraw, onCancel, onSave, onDelete, onReverse, }: IrrigationEditToolbarProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default IrrigationEditToolbar;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @fileoverview Loading 加载组件
3
+ * @description 显示加载状态的组件,支持多种加载图标和自定义配置
4
+ * @module components/Loading
5
+ */
6
+ import type { LoadingProps } from '../../types';
7
+ /**
8
+ * Loading 加载组件
9
+ *
10
+ * @description
11
+ * 显示加载状态,支持以下功能:
12
+ * - 多种加载图标:loading-spinner(旋转圆圈)、loading-dots(跳动圆点)
13
+ * - 自定义尺寸:small、default、large 或数字
14
+ * - 描述文案:可选的加载提示文字
15
+ * - 遮罩配置:支持自定义背景色、层级等
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { Loading } from 'agri-map-components';
20
+ *
21
+ * // 基础用法
22
+ * <Loading />
23
+ *
24
+ * // 自定义图标和描述
25
+ * <Loading icon="loading-dots" description="加载中..." />
26
+ *
27
+ * // 自定义尺寸
28
+ * <Loading size="large" />
29
+ * <Loading size={64} />
30
+ *
31
+ * // 带遮罩
32
+ * <Loading mask />
33
+ * <Loading mask={{ background: 'rgba(0, 0, 0, 0.5)', zIndex: 999 }} />
34
+ *
35
+ * // 在 Marker 中使用
36
+ * <Marker loading={true} />
37
+ * ```
38
+ */
39
+ declare const Loading: React.FC<LoadingProps>;
40
+ export default Loading;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 地图内容组件
3
+ * @description 根据 ConfigProvider 配置自动渲染地图子组件
4
+ */
5
+ import type { MapContentProps } from '../../types';
6
+ /**
7
+ * 地图内容组件
8
+ * @description 放在 MapContainer 内部,自动渲染 ConfigProvider 配置的组件
9
+ * @example
10
+ * <ConfigProvider dualScaleControl tianDiTuLayer={{ apiKey: 'xxx' }} mapSizeHandler>
11
+ * <MapContainer>
12
+ * <MapContent />
13
+ * </MapContainer>
14
+ * </ConfigProvider>
15
+ */
16
+ declare const MapContent: ({ children }: MapContentProps) => JSX.Element;
17
+ export default MapContent;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 地图尺寸处理器组件
3
+ * @description 解决地图容器尺寸变化后(如抽屉/对话框打开),地图不自动刷新的问题
4
+ */
5
+ import type { MapSizeHandlerConfig } from '../../types';
6
+ /**
7
+ * 地图尺寸处理器组件
8
+ * @description 通过多次调用 invalidateSize 确保地图在容器尺寸变化后正确渲染
9
+ *
10
+ * @example
11
+ * // 在 MapContent 中自动使用,通过 ConfigProvider 配置
12
+ * <ConfigProvider mapSizeHandler>
13
+ * <MapContainer>
14
+ * <MapContent />
15
+ * </MapContainer>
16
+ * </ConfigProvider>
17
+ *
18
+ * // 自定义配置
19
+ * <ConfigProvider mapSizeHandler={{ delay: 200, retries: 5 }}>
20
+ * ...
21
+ * </ConfigProvider>
22
+ */
23
+ declare const MapSizeHandler: ({ enabled, delay, retries, }?: MapSizeHandlerConfig) => null;
24
+ export default MapSizeHandler;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @fileoverview Marker 聚合模式渲染子组件
3
+ * @module components/Marker/ClusterView
4
+ */
5
+ import React from 'react';
6
+ import L from 'leaflet';
7
+ import Supercluster from 'supercluster';
8
+ import type { MarkerData, ClusterIconConfig } from '../../types';
9
+ interface ClusterViewProps {
10
+ /** 聚合结果数组(包含聚合气泡和单独点) */
11
+ clusterResults: Supercluster.ClusterFeature<any>[];
12
+ /** 单独 Marker 的图标 */
13
+ markerIcon: L.DivIcon;
14
+ /** 聚合气泡图标配置 */
15
+ clusterIconConfig?: ClusterIconConfig;
16
+ /** 是否永久显示 Tooltip,false 时悬停显示 */
17
+ showTooltip: boolean;
18
+ /** 聚合气泡点击处理 */
19
+ onClusterClick: (feature: Supercluster.ClusterFeature<Supercluster.AnyProps>) => void;
20
+ /** 单独 Marker 点击处理 */
21
+ onMarkerClick: (markerId: string | number) => void;
22
+ /** 获取 Marker 的 Tooltip 内容 */
23
+ getTooltipContent: (marker: MarkerData) => {
24
+ title?: string;
25
+ description?: string;
26
+ };
27
+ }
28
+ declare const _default: React.NamedExoticComponent<ClusterViewProps>;
29
+ export default _default;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview 地图点击处理器组件
3
+ * @description 处理地图点击事件,用于创建模式下的标注点创建和 Tooltip 关闭
4
+ * @module components/Marker/MapClickHandler
5
+ */
6
+ import L from 'leaflet';
7
+ /**
8
+ * 地图点击处理器属性
9
+ */
10
+ interface MapClickHandlerProps {
11
+ /** 是否启用点击处理 */
12
+ enabled: boolean;
13
+ /** 是否存在临时标注点 */
14
+ hasTempMarker: boolean;
15
+ /** 地图点击回调 */
16
+ onMapClick: (latlng: L.LatLng) => void;
17
+ /** 点击非标注区域时的回调(用于关闭 Tooltip) */
18
+ onMapClickWithoutMarker?: () => void;
19
+ }
20
+ /**
21
+ * 地图点击处理器
22
+ * @description 处理地图点击事件,用于创建模式下的标注点创建和 Tooltip 关闭
23
+ */
24
+ declare function MapClickHandler({ enabled, hasTempMarker, onMapClick, onMapClickWithoutMarker }: MapClickHandlerProps): null;
25
+ export default MapClickHandler;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview Marker 标注组件
3
+ * @description 用于在地图上显示标注点,支持自定义图标、动画效果、编辑模式、聚合和 Tooltip 控制
4
+ * @module components/Marker
5
+ */
6
+ import type { MarkerProps, MarkerRef } from '../../types';
7
+ /**
8
+ * Marker 标注组件
9
+ *
10
+ * @description
11
+ * 用于在地图上显示标注点,支持以下功能:
12
+ * - 自定义图标:预设名称、SVG字符串、图片URL
13
+ * - 动画效果:脉冲动画
14
+ * - 编辑模式:创建、移动、删除标注点
15
+ * - Tooltip 控制:打开/关闭指定或所有标注点的 Tooltip
16
+ * - 选中状态:支持受控和非受控模式
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { Marker } from 'agri-map-components';
21
+ * import { useRef } from 'react';
22
+ *
23
+ * // 基础用法
24
+ * <Marker
25
+ * icon="marker-blue"
26
+ * dataSource={[
27
+ * { id: 1, position: [29.95, 117.98], title: '标注点A' },
28
+ * { id: 2, position: [29.96, 117.99], title: '标注点B' },
29
+ * ]}
30
+ * onClick={(item) => console.log('点击:', item)}
31
+ * />
32
+ *
33
+ * // 使用 ref 控制方法
34
+ * const markerRef = useRef(null);
35
+ * <Marker
36
+ * ref={markerRef}
37
+ * dataSource={data}
38
+ * value={value}
39
+ * onSelect={setValue}
40
+ * />
41
+ * <button onClick={() => markerRef.current?.openAllTooltips()}>显示所有 Tooltip</button>
42
+ *
43
+ * // 编辑模式
44
+ * <Marker
45
+ * editMode={['create', 'move', 'delete']}
46
+ * dataSource={data}
47
+ * onCreate={(result) => console.log('新建:', result)}
48
+ * onMove={(result) => console.log('移动:', result)}
49
+ * onDelete={(result) => console.log('删除:', result)}
50
+ * />
51
+ *
52
+ * // 自定义图标
53
+ * <Marker
54
+ * icon="<svg>...</svg>"
55
+ * dataSource={data}
56
+ * animated
57
+ * />
58
+ * ```
59
+ */
60
+ declare const Marker: import("react").ForwardRefExoticComponent<MarkerProps & import("react").RefAttributes<MarkerRef>>;
61
+ export default Marker;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Marker 聚合配置解析
3
+ * @description 将 boolean | MarkerClusterConfig 三态配置解析为统一的配置对象
4
+ * @module components/Marker/parseClusterConfig
5
+ */
6
+ import type { MarkerClusterConfig } from '../../types';
7
+ export interface ParsedClusterConfig {
8
+ /** 是否启用聚合 */
9
+ enabled: boolean;
10
+ /** 聚合半径(像素) */
11
+ radius: number;
12
+ /** 聚合生效的最大缩放级别 */
13
+ maxZoom: number;
14
+ /** 最小聚合数量 */
15
+ minPoints: number;
16
+ /** 点击聚合气泡后的行为 */
17
+ onClickBehavior: 'zoom' | 'expand';
18
+ }
19
+ /**
20
+ * 解析 cluster 配置
21
+ * - undefined / false → 关闭聚合
22
+ * - true → 启用默认聚合配置
23
+ * - object → 自定义聚合参数
24
+ */
25
+ export declare function parseClusterConfig(clusterConfig: boolean | MarkerClusterConfig | undefined): ParsedClusterConfig;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 标注点编辑工具栏组件
3
+ */
4
+ import type { MarkerEditToolbarProps } from '../../types';
5
+ declare const MarkerEditToolbar: ({ visible, selectedMarkerId, currentMode, enabledButtons, hintMessage, showHint, color, size, iconOnly, children, onEdit, onMove, onCreate, onCancel, onSave, onDelete, }: MarkerEditToolbarProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default MarkerEditToolbar;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @fileoverview Marker 编辑事件处理 hook
3
+ * @description 将编辑模式的状态管理和事件处理提取为独立 hook
4
+ * @module components/Marker/useEditHandlers
5
+ */
6
+ import L from 'leaflet';
7
+ import type { MarkerData, MarkerCreateResult, MarkerMoveResult } from '../../types';
8
+ interface EditHandlersOptions {
9
+ enabledButtonsRef: React.MutableRefObject<('create' | 'edit' | 'move' | 'delete')[]>;
10
+ value: string | number | null;
11
+ dataSource: MarkerData[];
12
+ handleSelect: (id: string | number | null) => void;
13
+ onCreateRef: React.MutableRefObject<((result: MarkerCreateResult) => void) | undefined>;
14
+ onEditRef: React.MutableRefObject<((result: {
15
+ markerId: string | number;
16
+ marker: MarkerData;
17
+ }) => void) | undefined>;
18
+ onMoveRef: React.MutableRefObject<((result: MarkerMoveResult) => void) | undefined>;
19
+ onDeleteRef: React.MutableRefObject<((result: {
20
+ markerId: string | number;
21
+ }) => void) | undefined>;
22
+ onSaveRef: React.MutableRefObject<((result: {
23
+ mode: string;
24
+ } & (MarkerCreateResult | MarkerMoveResult)) => void) | undefined>;
25
+ closeTooltip: () => void;
26
+ }
27
+ /**
28
+ * Marker 编辑事件处理 hook
29
+ */
30
+ export declare function useEditHandlers({ enabledButtonsRef, value, dataSource, handleSelect, onCreateRef, onEditRef, onMoveRef, onDeleteRef, onSaveRef, closeTooltip, }: EditHandlersOptions): {
31
+ currentMode: "idle" | "move" | "create";
32
+ tempMarker: MarkerData | null;
33
+ handleCreate: () => void;
34
+ handleEdit: () => void;
35
+ handleMove: () => void;
36
+ handleDelete: () => void;
37
+ handleCancel: () => void;
38
+ handleSave: () => void;
39
+ handleDragEnd: (id: string | number, e: L.DragEndEvent) => void;
40
+ handleMapClick: (latlng: L.LatLng) => void;
41
+ exitCreateMode: () => void;
42
+ exitEditMode: () => void;
43
+ };
44
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @fileoverview Marker 图标配置 hook
3
+ * @description 将图标解析、合并、生成逻辑抽取为独立 hook
4
+ * @module components/Marker/useIconConfig
5
+ */
6
+ import L from 'leaflet';
7
+ import type { MarkerData, MarkerIconsConfig } from '../../types';
8
+ interface UseIconConfigOptions {
9
+ icons?: MarkerIconsConfig;
10
+ editEnabled: boolean;
11
+ currentMode: 'idle' | 'create' | 'move';
12
+ permanent: boolean;
13
+ }
14
+ /**
15
+ * Marker 图标配置 hook
16
+ * @description 管理图标配置的解析、合并和生成
17
+ */
18
+ export declare function useIconConfig({ icons, editEnabled, currentMode, permanent }: UseIconConfigOptions): {
19
+ getItemIcon: (item: MarkerData, isSelected: boolean, isEditing: boolean, isTemp?: boolean) => L.DivIcon;
20
+ getItemPermanent: (item: MarkerData) => boolean;
21
+ getTooltipOffset: (item: MarkerData) => [number, number];
22
+ };
23
+ export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview Marker 命令式方法 hook
3
+ * @description 将 useImperativeHandle 中的方法逻辑提取为独立 hook,便于维护
4
+ * @module components/Marker/useMarkerCommands
5
+ */
6
+ import L from 'leaflet';
7
+ import type { MarkerRef, MarkerData, MarkerEvents } from '../../types';
8
+ interface UseMarkerCommandsOptions {
9
+ map: L.Map | null;
10
+ value: string | number | null;
11
+ dataSource: MarkerData[];
12
+ handleSelect: (id: string | number | null, index?: number) => void;
13
+ onClickRef: React.MutableRefObject<((item: MarkerData) => void) | undefined>;
14
+ onRowRef: React.MutableRefObject<((item: MarkerData, index: number) => MarkerEvents) | undefined>;
15
+ setActiveTooltipId: (id: string | number | null) => void;
16
+ setTooltipContentMap: React.Dispatch<React.SetStateAction<Map<string | number, {
17
+ title?: string;
18
+ description?: string;
19
+ }>>>;
20
+ exitCreateMode: () => void;
21
+ exitEditMode: () => void;
22
+ closeTooltip: () => void;
23
+ }
24
+ /**
25
+ * Marker 命令式方法 hook
26
+ * @description activeTooltipId 和 tooltipContentMap 的状态由调用方管理,
27
+ * 本 hook 只负责将方法绑定到 ref 上
28
+ */
29
+ export declare function useMarkerCommands(ref: React.Ref<MarkerRef>, options: UseMarkerCommandsOptions): void;
30
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 测量工具栏组件
3
+ * @description 提供地图上的长度和面积测量功能,基于 @geoman-io/leaflet-geoman-free
4
+ * @features
5
+ * - 测长度:绘制折线,实时显示长度
6
+ * - 测面积:绘制多边形,实时显示面积
7
+ * - 支持多种单位:m/km/ft/mi(长度), sqm/sqkm/sqft/acre/hectare(面积)
8
+ * - 可配置位置:topleft/topright/bottomleft/bottomright
9
+ * - 实时显示测量值
10
+ * - 统一工具栏样式,与 BaseEditToolbar 保持一致
11
+ */
12
+ import '@geoman-io/leaflet-geoman-free';
13
+ import type { MeasurementToolbarProps, LengthUnit, MeasurementAreaUnit, UnitConfig } from '../../types/measurement';
14
+ export declare const LENGTH_UNITS: Record<LengthUnit, UnitConfig>;
15
+ export declare const AREA_UNITS: Record<MeasurementAreaUnit, UnitConfig>;
16
+ /**
17
+ * 测量工具栏组件
18
+ */
19
+ declare const MeasurementToolbar: ({ visible, position, lengthUnit, areaUnit, precision, style, className, onStartMeasurement, onEndMeasurement, onMeasurementChange, }: Omit<MeasurementToolbarProps, "showMeasurements">) => null;
20
+ export default MeasurementToolbar;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @fileoverview MiniMap 小地图组件
3
+ * @description 在主地图上显示轨迹概览和当前视口位置的小地图
4
+ * @module components/MiniMap
5
+ */
6
+ import type { MiniMapProps } from '../../types';
7
+ export type { MiniMapProps, TileLayerConfig } from '../../types';
8
+ /**
9
+ * 小地图组件
10
+ * @description 在主地图上显示轨迹概览和当前视口位置
11
+ */
12
+ declare const MiniMap: {
13
+ ({ show, width, height, zoomOffset, showTrackOverview, trackData, visibleTrackKeys, className, viewportColor, viewportBorderColor, tileLayer, }: MiniMapProps): null;
14
+ displayName: string;
15
+ };
16
+ export default MiniMap;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 通知提醒组件
3
+ * @description 类似 antd Notification 的通知提醒框,显示在地图右下角
4
+ */
5
+ import type { NotificationInstance, NotificationProps } from '../../types';
6
+ /**
7
+ * 通知容器组件
8
+ * @param onClose - 通知关闭时的回调
9
+ * @param ref - ref 引用,暴露 open/close 方法
10
+ */
11
+ declare const Notification: import("react").ForwardRefExoticComponent<NotificationProps & import("react").RefAttributes<NotificationInstance>>;
12
+ export default Notification;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PlotGroupLayer 多类型地块分组编排组件
3
+ * @description 将多种类型的地块分组渲染,每种类型对应一个独立的 PlotLayer 实例,
4
+ * 支持跨类型互斥选中、统一分组高亮、合并渲染统计等功能。
5
+ */
6
+ import type { PlotGroupLayerProps, PlotGroupRef } from '../../types';
7
+ declare const PlotGroupLayer: import("react").ForwardRefExoticComponent<PlotGroupLayerProps & import("react").RefAttributes<PlotGroupRef>>;
8
+ export default PlotGroupLayer;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fileoverview 高性能地块图层组件
3
+ */
4
+ import '@geoman-io/leaflet-geoman-free';
5
+ import type { PlotRef, PlotLayerProps } from '../../types';
6
+ declare const PlotLayer: import("react").ForwardRefExoticComponent<PlotLayerProps & import("react").RefAttributes<PlotRef>>;
7
+ export default PlotLayer;
@@ -0,0 +1,12 @@
1
+ import type { RefObject } from 'react';
2
+ import type L from 'leaflet';
3
+ interface PlotLabelProps {
4
+ selectedIds?: (string | number)[];
5
+ labelFields?: string[];
6
+ layerByIdRef: RefObject<Record<string | number, L.Layer>>;
7
+ }
8
+ /**
9
+ * PlotLabel - 为选中地块显示标签的组件
10
+ */
11
+ declare const PlotLabel: React.FC<PlotLabelProps>;
12
+ export default PlotLabel;
@@ -0,0 +1,59 @@
1
+ import type { MutableRefObject } from 'react';
2
+ import L from 'leaflet';
3
+ import type { PlotData, Coordinate } from '../../types';
4
+ /** PlotLayer 图层类型扩展 */
5
+ export interface PlotLayer extends L.Path {
6
+ feature?: GeoJSON.Feature;
7
+ plotData?: PlotData;
8
+ _path?: HTMLElement;
9
+ _moveHandlers?: {
10
+ onMouseDown: (e: L.LeafletMouseEvent) => void;
11
+ onMouseMove: (e: L.LeafletMouseEvent) => void;
12
+ onMouseUp: () => void;
13
+ };
14
+ }
15
+ export interface PmLayerOptions {
16
+ allowSelfIntersection?: boolean;
17
+ }
18
+ export interface PmLayerInstance {
19
+ enable?: (options?: PmLayerOptions) => void;
20
+ disable?: () => void;
21
+ enableLayerDrag?: () => void;
22
+ disableLayerDrag?: () => void;
23
+ _shape?: string;
24
+ _drawing?: boolean;
25
+ }
26
+ export interface PmMapInstance {
27
+ setLang: (lang: string) => void;
28
+ enableDraw: (shape: string, options?: Record<string, unknown>) => void;
29
+ disableDraw: () => void;
30
+ globalDrawModeEnabled?: () => boolean;
31
+ }
32
+ export interface EditEventHandlers {
33
+ pmEdit?: ((e: L.LeafletEvent) => void) | null;
34
+ pmDragEnd?: (() => void) | null;
35
+ pmDrag?: (() => void) | null;
36
+ }
37
+ export declare function getPmLayer(layer: L.Layer): PmLayerInstance | undefined;
38
+ export declare function getPmMap(map: L.Map): PmMapInstance | undefined;
39
+ export declare function getLeafletId(layer: L.Layer): number;
40
+ /** 安全计算边界框(避免 Math.min/max spread 栈溢出) */
41
+ export declare function computeBoundsFromCoordinates(boundaries: Coordinate[]): [number, number, number, number] | undefined;
42
+ /** 清理 Geoman 编辑状态(解除事件监听 + 禁用图层编辑/拖拽) */
43
+ export declare function cleanupPmEditing(editingLayerRef: {
44
+ current: PlotLayer | null;
45
+ }, cleanupEditEvents: (layer: L.Layer | null) => void): void;
46
+ /** 禁用地图绘制模式 */
47
+ export declare function disableDrawMode(map: L.Map): void;
48
+ export interface BuildPlotGeoJSONOptions {
49
+ layerByIdRef: MutableRefObject<Record<string | number, PlotLayer>>;
50
+ selectedIdsRef: MutableRefObject<(string | number)[]>;
51
+ getFeatureStyleRef: MutableRefObject<(feature: GeoJSON.Feature | undefined, isSelected: boolean) => L.PathOptions>;
52
+ handlePlotClickRef: MutableRefObject<(layer: L.Layer, feature: GeoJSON.Feature) => void>;
53
+ handleContextMenuRef: MutableRefObject<(layer: L.Layer, feature: GeoJSON.Feature, event: L.LeafletMouseEvent) => void>;
54
+ handleHoverRef: MutableRefObject<(layer: L.Layer, feature: GeoJSON.Feature, type: 'mouseover' | 'mouseout') => void>;
55
+ /** 图层创建后的额外处理(如设置 editingLayerRef) */
56
+ onLayerReady?: (feature: GeoJSON.Feature, layer: PlotLayer) => void;
57
+ }
58
+ /** 构建地块 GeoJSON 图层的标准配置(消除主渲染和 rebuildGeoJSONLayer 中的重复) */
59
+ export declare function buildPlotGeoJSONOptions(params: BuildPlotGeoJSONOptions): L.GeoJSONOptions;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview PlotLayer 组件配置解析
3
+ * @module components/PlotLayer/parseConfig
4
+ */
5
+ import type { ParsedVirtualizationConfig } from './types';
6
+ /**
7
+ * 解析 virtualization 配置
8
+ * - undefined / true → 启用虚拟化(默认参数)
9
+ * - false → 关闭虚拟化
10
+ * - object → 自定义参数
11
+ */
12
+ export declare function parseVirtualizationConfig(virtualization: boolean | {
13
+ minZoom?: number;
14
+ maxZoom?: number;
15
+ } | undefined): ParsedVirtualizationConfig;