@wenle_2523097/agri-map 1.0.9 → 1.0.10
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/components/ConfigProvider/index.d.ts +1 -1
- package/dist/components/Icons/Icons.stories.d.ts +30 -0
- package/dist/components/Icons/SelectIcon.d.ts +3 -4
- package/dist/components/Icons/index.d.ts +31 -25
- package/dist/components/Irrigation/toolbar.d.ts +1 -1
- package/dist/components/Marker/ClusterView.d.ts +2 -2
- package/dist/components/Marker/MapClickHandler.d.ts +2 -2
- package/dist/components/Marker/toolbar.d.ts +1 -1
- package/dist/components/Marker/useEditHandlers.d.ts +1 -1
- package/dist/components/Marker/useIconConfig.d.ts +2 -2
- package/dist/components/Measurement/toolbar.d.ts +2 -9
- package/dist/components/PlotLayer/toolbar.d.ts +1 -1
- package/dist/components/PlotLayer/usePlotData.d.ts +1 -1
- package/dist/components/Road/toolbar.d.ts +1 -1
- package/dist/components/Track/ClusterView.d.ts +2 -2
- package/dist/components/Track/TrackView.d.ts +2 -2
- package/dist/components/Track/commands.d.ts +2 -2
- package/dist/components/Track/types.d.ts +2 -2
- package/dist/components/shared/ToolbarButton.d.ts +7 -0
- package/dist/components/shared/index.d.ts +1 -1
- package/dist/constants/index.d.ts +4 -4
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useLoadingOverlay.d.ts +48 -0
- package/dist/hooks/usePolylineCommon.d.ts +105 -0
- package/dist/hooks/usePolylineEditor.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +814 -825
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +814 -825
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +817 -828
- package/dist/index.umd.js.map +1 -1
- package/dist/stats.html +4949 -0
- package/dist/test/setup.d.ts +4 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/track.d.ts +7 -5
- package/dist/utils/index.d.ts +3 -3
- package/package.json +138 -79
|
@@ -11,5 +11,5 @@ export declare const useConfig: () => ConfigContextValue;
|
|
|
11
11
|
/**
|
|
12
12
|
* 全局配置提供者组件
|
|
13
13
|
*/
|
|
14
|
-
declare const ConfigProvider: ({ theme, dualScaleControl, tianDiTuLayer, mapSizeHandler, children }: ConfigProviderProps) => JSX.Element;
|
|
14
|
+
declare const ConfigProvider: ({ theme, dualScaleControl, tianDiTuLayer, mapSizeHandler, children, }: ConfigProviderProps) => JSX.Element;
|
|
15
15
|
export default ConfigProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icons 组件故事
|
|
3
|
+
*/
|
|
4
|
+
import type { StoryObj } from '@storybook/react';
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: ({ size, color, ariaLabel, ariaHidden, }: import("../Icons").IconProps) => JSX.Element;
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: string;
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
tags: string[];
|
|
17
|
+
argTypes: any;
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const PlotRedraw: Story;
|
|
22
|
+
export declare const Clip: Story;
|
|
23
|
+
export declare const Move: Story;
|
|
24
|
+
export declare const Delete: Story;
|
|
25
|
+
export declare const Cancel: Story;
|
|
26
|
+
export declare const Save: Story;
|
|
27
|
+
export declare const Create: Story;
|
|
28
|
+
export declare const Edit: Story;
|
|
29
|
+
export declare const Reverse: Story;
|
|
30
|
+
export declare const AllIcons: Story;
|
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
* <SelectIcon value={icon} onChange={setIcon} />
|
|
13
13
|
*/
|
|
14
14
|
import { type CSSProperties } from 'react';
|
|
15
|
-
import type { PresetIconName } from '../../types/icon';
|
|
16
15
|
export interface IconGroupItem {
|
|
17
|
-
/**
|
|
18
|
-
type:
|
|
16
|
+
/** 图标名称(预设图标名称或自定义图标名称) */
|
|
17
|
+
type: string;
|
|
19
18
|
/** 图标显示名称 */
|
|
20
19
|
name: string;
|
|
21
20
|
}
|
|
@@ -41,7 +40,7 @@ export interface IconPreviewProps {
|
|
|
41
40
|
* 图标预览组件
|
|
42
41
|
* @description 根据图标类型渲染不同的预览效果
|
|
43
42
|
*/
|
|
44
|
-
export declare function IconPreview({ iconType, size, animated, style }: IconPreviewProps): JSX.Element;
|
|
43
|
+
export declare function IconPreview({ iconType, size, animated, style, }: IconPreviewProps): JSX.Element;
|
|
45
44
|
export interface SelectIconProps {
|
|
46
45
|
/** 当前选中值(兼容 antd Form) */
|
|
47
46
|
value?: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description 统一的 SVG 图标组件,用于工具栏等场景
|
|
4
4
|
*/
|
|
5
5
|
/** 图标组件属性 */
|
|
6
|
-
interface IconProps {
|
|
6
|
+
export interface IconProps {
|
|
7
7
|
size?: number;
|
|
8
8
|
color?: string;
|
|
9
9
|
/** 无障碍标签文本 */
|
|
@@ -11,32 +11,38 @@ interface IconProps {
|
|
|
11
11
|
/** 是否对屏幕阅读器隐藏,默认 true */
|
|
12
12
|
ariaHidden?: boolean;
|
|
13
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;
|
|
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
|
+
export declare const MeasureLengthUIIcon: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
27
|
+
export declare const MeasureAreaUIIcon: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
28
|
+
export declare const ClearMeasureUIIcon: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
26
29
|
/** 图标组件映射 */
|
|
27
30
|
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;
|
|
31
|
+
MarkerRedraw: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
32
|
+
PlotRedraw: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
33
|
+
RoadRedraw: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
34
|
+
IrrigationRedraw: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
35
|
+
Clip: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
36
|
+
Move: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
37
|
+
Delete: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
38
|
+
Cancel: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
39
|
+
Save: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
40
|
+
Create: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
41
|
+
Edit: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
42
|
+
Reverse: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
43
|
+
MeasureLengthUI: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
44
|
+
MeasureAreaUI: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
45
|
+
ClearMeasureUI: ({ size, color, ariaLabel, ariaHidden, }: IconProps) => JSX.Element;
|
|
40
46
|
};
|
|
41
47
|
export default Icons;
|
|
42
48
|
export { SelectIcon, IconPreview, DEFAULT_ICON_GROUPS } from './SelectIcon';
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* 灌溉渠编辑工具栏组件
|
|
3
3
|
*/
|
|
4
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) =>
|
|
5
|
+
declare const IrrigationEditToolbar: ({ visible, selectedChannelId, currentMode, enabledButtons, pointCount, hintMessage, showHint, color, size, iconOnly, children, onCreate, onEdit, onRedraw, onCancel, onSave, onDelete, onReverse, }: IrrigationEditToolbarProps) => JSX.Element;
|
|
6
6
|
export default IrrigationEditToolbar;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @module components/Marker/ClusterView
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import L from 'leaflet';
|
|
7
|
-
import Supercluster from 'supercluster';
|
|
6
|
+
import type L from 'leaflet';
|
|
7
|
+
import type Supercluster from 'supercluster';
|
|
8
8
|
import type { MarkerData, ClusterIconConfig } from '../../types';
|
|
9
9
|
interface ClusterViewProps {
|
|
10
10
|
/** 聚合结果数组(包含聚合气泡和单独点) */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description 处理地图点击事件,用于创建模式下的标注点创建和 Tooltip 关闭
|
|
4
4
|
* @module components/Marker/MapClickHandler
|
|
5
5
|
*/
|
|
6
|
-
import L from 'leaflet';
|
|
6
|
+
import type L from 'leaflet';
|
|
7
7
|
/**
|
|
8
8
|
* 地图点击处理器属性
|
|
9
9
|
*/
|
|
@@ -21,5 +21,5 @@ interface MapClickHandlerProps {
|
|
|
21
21
|
* 地图点击处理器
|
|
22
22
|
* @description 处理地图点击事件,用于创建模式下的标注点创建和 Tooltip 关闭
|
|
23
23
|
*/
|
|
24
|
-
declare function MapClickHandler({ enabled, hasTempMarker, onMapClick, onMapClickWithoutMarker }: MapClickHandlerProps): null;
|
|
24
|
+
declare function MapClickHandler({ enabled, hasTempMarker, onMapClick, onMapClickWithoutMarker, }: MapClickHandlerProps): null;
|
|
25
25
|
export default MapClickHandler;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* 标注点编辑工具栏组件
|
|
3
3
|
*/
|
|
4
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) =>
|
|
5
|
+
declare const MarkerEditToolbar: ({ visible, selectedMarkerId, currentMode, enabledButtons, hintMessage, showHint, color, size, iconOnly, children, onEdit, onMove, onCreate, onCancel, onSave, onDelete, }: MarkerEditToolbarProps) => JSX.Element;
|
|
6
6
|
export default MarkerEditToolbar;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description 将编辑模式的状态管理和事件处理提取为独立 hook
|
|
4
4
|
* @module components/Marker/useEditHandlers
|
|
5
5
|
*/
|
|
6
|
-
import L from 'leaflet';
|
|
6
|
+
import type L from 'leaflet';
|
|
7
7
|
import type { MarkerData, MarkerCreateResult, MarkerMoveResult } from '../../types';
|
|
8
8
|
interface EditHandlersOptions {
|
|
9
9
|
enabledButtonsRef: React.MutableRefObject<('create' | 'edit' | 'move' | 'delete')[]>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description 将图标解析、合并、生成逻辑抽取为独立 hook
|
|
4
4
|
* @module components/Marker/useIconConfig
|
|
5
5
|
*/
|
|
6
|
-
import L from 'leaflet';
|
|
6
|
+
import type L from 'leaflet';
|
|
7
7
|
import type { MarkerData, MarkerIconsConfig } from '../../types';
|
|
8
8
|
interface UseIconConfigOptions {
|
|
9
9
|
icons?: MarkerIconsConfig;
|
|
@@ -15,7 +15,7 @@ interface UseIconConfigOptions {
|
|
|
15
15
|
* Marker 图标配置 hook
|
|
16
16
|
* @description 管理图标配置的解析、合并和生成
|
|
17
17
|
*/
|
|
18
|
-
export declare function useIconConfig({ icons, editEnabled, currentMode, permanent }: UseIconConfigOptions): {
|
|
18
|
+
export declare function useIconConfig({ icons, editEnabled, currentMode, permanent, }: UseIconConfigOptions): {
|
|
19
19
|
getItemIcon: (item: MarkerData, isSelected: boolean, isEditing: boolean, isTemp?: boolean) => L.DivIcon;
|
|
20
20
|
getItemPermanent: (item: MarkerData) => boolean;
|
|
21
21
|
getTooltipOffset: (item: MarkerData) => [number, number];
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 测量工具栏组件
|
|
3
|
-
* @description
|
|
4
|
-
* @features
|
|
5
|
-
* - 测长度:绘制折线,实时显示长度
|
|
6
|
-
* - 测面积:绘制多边形,实时显示面积
|
|
7
|
-
* - 支持多种单位:m/km/ft/mi(长度), sqm/sqkm/sqft/acre/hectare(面积)
|
|
8
|
-
* - 可配置位置:topleft/topright/bottomleft/bottomright
|
|
9
|
-
* - 实时显示测量值
|
|
10
|
-
* - 统一工具栏样式,与 BaseEditToolbar 保持一致
|
|
3
|
+
* @description 提供地图上的长度和面积测量功能
|
|
11
4
|
*/
|
|
12
5
|
import '@geoman-io/leaflet-geoman-free';
|
|
13
6
|
import type { MeasurementToolbarProps, LengthUnit, MeasurementAreaUnit, UnitConfig } from '../../types/measurement';
|
|
@@ -16,5 +9,5 @@ export declare const AREA_UNITS: Record<MeasurementAreaUnit, UnitConfig>;
|
|
|
16
9
|
/**
|
|
17
10
|
* 测量工具栏组件
|
|
18
11
|
*/
|
|
19
|
-
declare const MeasurementToolbar: ({
|
|
12
|
+
declare const MeasurementToolbar: ({ position, lengthUnit, areaUnit, precision, style, className, onStartMeasurement, onEndMeasurement, onMeasurementChange, }: Omit<MeasurementToolbarProps, "visible" | "showMeasurements">) => null;
|
|
20
13
|
export default MeasurementToolbar;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* 地块编辑工具栏组件
|
|
3
3
|
*/
|
|
4
4
|
import type { PlotEditToolbarProps } from '../../types';
|
|
5
|
-
declare const PlotEditToolbar: ({ visible, selectedPlotId, currentMode, enabledButtons, hintMessage, showHint, warningHint, color, size, iconOnly, children, onEdit, onRedraw, onClip, onMove, onCreate, onCancel, onSave, onDelete, }: PlotEditToolbarProps) =>
|
|
5
|
+
declare const PlotEditToolbar: ({ visible, selectedPlotId, currentMode, enabledButtons, hintMessage, showHint, warningHint, color, size, iconOnly, children, onEdit, onRedraw, onClip, onMove, onCreate, onCancel, onSave, onDelete, }: PlotEditToolbarProps) => JSX.Element;
|
|
6
6
|
export default PlotEditToolbar;
|
|
@@ -28,5 +28,5 @@ interface UsePlotDataResult {
|
|
|
28
28
|
/** 当前高亮分组 ref */
|
|
29
29
|
highlightedGroupRef: React.MutableRefObject<string | null>;
|
|
30
30
|
}
|
|
31
|
-
export declare function usePlotData({ fieldNames, dataSource, groupKey }: UsePlotDataOptions): UsePlotDataResult;
|
|
31
|
+
export declare function usePlotData({ fieldNames, dataSource, groupKey, }: UsePlotDataOptions): UsePlotDataResult;
|
|
32
32
|
export {};
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* 道路编辑工具栏组件
|
|
3
3
|
*/
|
|
4
4
|
import type { RoadEditToolbarProps } from '../../types';
|
|
5
|
-
declare const RoadEditToolbar: ({ visible, selectedRoadId, currentMode, enabledButtons, pointCount, hintMessage, showHint, color, size, iconOnly, children, onEdit, onRedraw, onCreate, onCancel, onSave, onDelete, }: RoadEditToolbarProps) =>
|
|
5
|
+
declare const RoadEditToolbar: ({ visible, selectedRoadId, currentMode, enabledButtons, pointCount, hintMessage, showHint, color, size, iconOnly, children, onEdit, onRedraw, onCreate, onCancel, onSave, onDelete, }: RoadEditToolbarProps) => JSX.Element;
|
|
6
6
|
export default RoadEditToolbar;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @module components/Track/ClusterView
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import L from 'leaflet';
|
|
7
|
-
import Supercluster from 'supercluster';
|
|
6
|
+
import type L from 'leaflet';
|
|
7
|
+
import type Supercluster from 'supercluster';
|
|
8
8
|
import type { ClusterIconConfig } from '../../types';
|
|
9
9
|
import type { MiniMapProps } from '../../types';
|
|
10
10
|
interface ClusterViewProps {
|
|
@@ -14,10 +14,10 @@ interface TrackViewProps {
|
|
|
14
14
|
getStyles: (state: number, isSelected: boolean, isHovered: boolean) => any;
|
|
15
15
|
handleTrackClick: (trackKey: string) => void;
|
|
16
16
|
handleTrackHover: (trackKey: string, isHovered: boolean) => void;
|
|
17
|
-
renderStartEndMarkers: (trackKey: string, points:
|
|
17
|
+
renderStartEndMarkers: (trackKey: string, points: {
|
|
18
18
|
position: [number, number];
|
|
19
19
|
state: number;
|
|
20
|
-
}
|
|
20
|
+
}[]) => React.ReactNode | null;
|
|
21
21
|
polylineRefs: React.MutableRefObject<Map<string, any>>;
|
|
22
22
|
}
|
|
23
23
|
declare const _default: React.NamedExoticComponent<TrackViewProps>;
|
|
@@ -32,9 +32,9 @@ export declare function computeTrackStats<T extends {
|
|
|
32
32
|
/**
|
|
33
33
|
* 从轨迹列表中提取 bounds 并安全构建 latLngBounds
|
|
34
34
|
*/
|
|
35
|
-
export declare function safeLatLngBounds(tracks:
|
|
35
|
+
export declare function safeLatLngBounds(tracks: {
|
|
36
36
|
bounds?: any;
|
|
37
|
-
}
|
|
37
|
+
}[]): L.LatLngBounds | null;
|
|
38
38
|
/**
|
|
39
39
|
* 飞行到指定 bounds(带动画时长计算)
|
|
40
40
|
*/
|
|
@@ -23,13 +23,13 @@ export interface TrackPointProperties {
|
|
|
23
23
|
}
|
|
24
24
|
/** 筛选结果类型 */
|
|
25
25
|
export interface FilterResult {
|
|
26
|
-
tracks:
|
|
26
|
+
tracks: {
|
|
27
27
|
key: string;
|
|
28
28
|
imei: string;
|
|
29
29
|
date: string;
|
|
30
30
|
bounds: any;
|
|
31
31
|
pointCount: number;
|
|
32
|
-
}
|
|
32
|
+
}[];
|
|
33
33
|
imeis: string[];
|
|
34
34
|
dates: string[];
|
|
35
35
|
totalTracks: number;
|
|
@@ -18,6 +18,8 @@ export interface ToolbarButtonProps extends React.ButtonHTMLAttributes<HTMLButto
|
|
|
18
18
|
iconOnly?: boolean;
|
|
19
19
|
/** 类名前缀(可选,默认从 Context 获取) */
|
|
20
20
|
classPrefix?: string;
|
|
21
|
+
/** 提示文本(Tooltip) */
|
|
22
|
+
tooltip?: string;
|
|
21
23
|
/** 子元素 */
|
|
22
24
|
children?: React.ReactNode;
|
|
23
25
|
}
|
|
@@ -43,6 +45,11 @@ export interface ToolbarButtonProps extends React.ButtonHTMLAttributes<HTMLButto
|
|
|
43
45
|
* <ToolbarButton variant="danger" icon={<DeleteIcon />}>
|
|
44
46
|
* 删除
|
|
45
47
|
* </ToolbarButton>
|
|
48
|
+
*
|
|
49
|
+
* // 带 Tooltip
|
|
50
|
+
* <ToolbarButton variant="primary" tooltip="提示信息">
|
|
51
|
+
* 按钮
|
|
52
|
+
* </ToolbarButton>
|
|
46
53
|
* ```
|
|
47
54
|
*/
|
|
48
55
|
declare const ToolbarButton: import("react").ForwardRefExoticComponent<ToolbarButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 共享组件导出
|
|
3
3
|
*/
|
|
4
|
-
export { default as BaseEditToolbar, type BaseEditToolbarProps, type BaseEditToolbarRef, type ButtonVariant, type ToolbarColor, type ToolbarPresetColors, type ToolbarSize, ToolbarContext, useToolbarContext } from './BaseEditToolbar';
|
|
4
|
+
export { default as BaseEditToolbar, type BaseEditToolbarProps, type BaseEditToolbarRef, type ButtonVariant, type ToolbarColor, type ToolbarPresetColors, type ToolbarSize, ToolbarContext, useToolbarContext, } from './BaseEditToolbar';
|
|
5
5
|
export { default as ToolbarButton, type ToolbarButtonProps } from './ToolbarButton';
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* - styles.ts: 默认 PathOptions 样式常量
|
|
13
13
|
*/
|
|
14
14
|
export { PlotType, PlotStatus, PLOT_TYPE_COLORS, getPlotTypeColor, type PlotTypeColorConfig, } from './plot';
|
|
15
|
-
export { RoadType, ROAD_TYPE_STYLES
|
|
16
|
-
export { DeviceType, DEVICE_TYPE_COLORS
|
|
17
|
-
export { DEFAULT_MAP_CONFIG
|
|
18
|
-
export { UNIT_CONVERSION
|
|
15
|
+
export { RoadType, ROAD_TYPE_STYLES } from './road';
|
|
16
|
+
export { DeviceType, DEVICE_TYPE_COLORS } from './device';
|
|
17
|
+
export { DEFAULT_MAP_CONFIG } from './map';
|
|
18
|
+
export { UNIT_CONVERSION } from './unit';
|
|
19
19
|
export { THEME_CONFIG, THEME_CSS_VARS, getThemeColors, type ThemeMode, type ThemeColors, } from './theme';
|
|
20
20
|
export { PLOT_DEFAULT_PATH, PLOT_DEFAULT_SELECTED_PATH, PLOT_DEFAULT_EDIT_PATH, PLOT_DEFAULT_HIGHLIGHT_PATH, PLOT_FALLBACK_PATH, PLOT_PM_CREATE_OPTIONS, PLOT_CLIP_FRAGMENT_DEFAULT, PLOT_CLIP_FRAGMENT_SELECTED, ROAD_DEFAULT_PATH, ROAD_DEFAULT_SELECTED_PATH, ROAD_PM_PATH_OPTIONS, IRRIGATION_DEFAULT_PATH, IRRIGATION_DEFAULT_SELECTED_PATH, IRRIGATION_PM_PATH_OPTIONS, PM_TEMPLATE_LINE_STYLE, PM_HINT_LINE_STYLE, PM_DRAW_COMMON_OPTIONS, } from './styles';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { useEditMode, type EditModeConfig, type EditModeResult } from './useEdit
|
|
|
6
6
|
export { useTheme } from './useTheme';
|
|
7
7
|
export { usePolylineRenderer } from './usePolylineRenderer';
|
|
8
8
|
export { usePolylineEditor, usePolylineSave } from './usePolylineEditor';
|
|
9
|
+
export { useLoadingOverlay, type UseLoadingOverlayOptions } from './useLoadingOverlay';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Loading 覆盖层 Hook
|
|
3
|
+
* @description 提取各组件中重复的 Loading 覆盖层逻辑
|
|
4
|
+
*/
|
|
5
|
+
import type L from 'leaflet';
|
|
6
|
+
import type { LoadingMaskConfig } from '../types';
|
|
7
|
+
import type { LoadingIconName, LoadingSize } from '../types/loading';
|
|
8
|
+
export interface UseLoadingOverlayOptions {
|
|
9
|
+
/** 是否显示加载状态 */
|
|
10
|
+
loading: boolean;
|
|
11
|
+
/** Loading 遮罩配置 */
|
|
12
|
+
loadingMask?: LoadingMaskConfig;
|
|
13
|
+
/** Leaflet 地图实例 */
|
|
14
|
+
map: L.Map;
|
|
15
|
+
/** Loading 覆盖层的 CSS 类名 */
|
|
16
|
+
className: string;
|
|
17
|
+
/** 自定义 Loading 图标名称,默认为 'loading-spinner' */
|
|
18
|
+
icon?: LoadingIconName;
|
|
19
|
+
/** 自定义 Loading 尺寸,默认为 'large' */
|
|
20
|
+
size?: LoadingSize;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Loading 覆盖层 Hook
|
|
24
|
+
*
|
|
25
|
+
* @description
|
|
26
|
+
* 提取各图层组件中重复的 Loading 覆盖层逻辑,包括:
|
|
27
|
+
* - PlotLayer / PlotGroupLayer
|
|
28
|
+
* - Road / Irrigation
|
|
29
|
+
* - Marker
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const loadingOverlay = useLoadingOverlay({
|
|
34
|
+
* loading,
|
|
35
|
+
* loadingMask,
|
|
36
|
+
* map,
|
|
37
|
+
* className: 'agri-plot-loading-overlay',
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <>
|
|
42
|
+
* {/* 其他内容 *}
|
|
43
|
+
* {loadingOverlay}
|
|
44
|
+
* </>
|
|
45
|
+
* );
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function useLoadingOverlay(options: UseLoadingOverlayOptions): React.ReactNode | null;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 线要素通用逻辑 Hook
|
|
3
|
+
* @description 提取 Road 和 Irrigation 组件的共享逻辑:
|
|
4
|
+
* - 样式合并(default/selected/editing)
|
|
5
|
+
* - 编辑态顶点颜色处理
|
|
6
|
+
* - 创建/编辑模式下的地图类名和 CSS 变量管理
|
|
7
|
+
* - 工具栏按钮处理框架
|
|
8
|
+
*/
|
|
9
|
+
import type L from 'leaflet';
|
|
10
|
+
import type { PathOptions } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* 线要素类型
|
|
13
|
+
*/
|
|
14
|
+
export type PolylineType = 'road' | 'irrigation';
|
|
15
|
+
/**
|
|
16
|
+
* 编辑模式类型
|
|
17
|
+
*/
|
|
18
|
+
export type PolylineEditMode = 'idle' | 'create' | 'edit';
|
|
19
|
+
/**
|
|
20
|
+
* 样式配置接口
|
|
21
|
+
*/
|
|
22
|
+
export interface PolylineStyleConfig {
|
|
23
|
+
/** 默认样式 */
|
|
24
|
+
defaultPath: PathOptions;
|
|
25
|
+
/** 选中样式 */
|
|
26
|
+
selectedPath: PathOptions;
|
|
27
|
+
/** 编辑样式 */
|
|
28
|
+
editingPath: PathOptions;
|
|
29
|
+
/** 编辑态顶点颜色(可选,用于覆盖默认颜色) */
|
|
30
|
+
editingVertexColor?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 模式样式常量接口
|
|
34
|
+
*/
|
|
35
|
+
export interface ModeStyleConstants {
|
|
36
|
+
/** 默认路径样式常量 */
|
|
37
|
+
defaultPathConstant: PathOptions;
|
|
38
|
+
/** 选中路径样式常量 */
|
|
39
|
+
selectedPathConstant: PathOptions;
|
|
40
|
+
/** 编辑路径样式常量 */
|
|
41
|
+
editingPathConstant: PathOptions;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* usePolylineCommon Options
|
|
45
|
+
*/
|
|
46
|
+
export interface UsePolylineCommonOptions {
|
|
47
|
+
/** 线要素类型:'road' | 'irrigation' */
|
|
48
|
+
type: PolylineType;
|
|
49
|
+
/** 组件 props 中的 options */
|
|
50
|
+
optionsProp?: {
|
|
51
|
+
default?: PathOptions;
|
|
52
|
+
selected?: PathOptions;
|
|
53
|
+
editing?: PathOptions & {
|
|
54
|
+
vertexColor?: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/** 旧版 path prop(仅 irrigation 需要) */
|
|
58
|
+
pathProp?: PathOptions;
|
|
59
|
+
/** 旧版 selectedPath prop(仅 irrigation 需要) */
|
|
60
|
+
selectedPathProp?: PathOptions;
|
|
61
|
+
/** 样式常量 */
|
|
62
|
+
constants: ModeStyleConstants;
|
|
63
|
+
/** Leaflet 地图实例 */
|
|
64
|
+
map: L.Map | null;
|
|
65
|
+
/** 当前编辑模式 */
|
|
66
|
+
currentMode: PolylineEditMode;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* usePolylineCommon Return
|
|
70
|
+
*/
|
|
71
|
+
export interface UsePolylineCommonReturn {
|
|
72
|
+
/** 合并后的默认样式 */
|
|
73
|
+
defaultPath: L.PathOptions;
|
|
74
|
+
/** 合并后的选中样式 */
|
|
75
|
+
selectedPath: L.PathOptions;
|
|
76
|
+
/** 合并后的编辑样式 */
|
|
77
|
+
editingPath: L.PathOptions;
|
|
78
|
+
/** 编辑态顶点颜色 */
|
|
79
|
+
editingVertexColor: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 线要素通用逻辑 Hook
|
|
83
|
+
*
|
|
84
|
+
* @description
|
|
85
|
+
* 提取 Road 和 Irrigation 组件的共享逻辑,包括:
|
|
86
|
+
* 1. 三态样式合并(options prop > 旧 prop > 默认常量)
|
|
87
|
+
* 2. 编辑态顶点颜色处理
|
|
88
|
+
* 3. 创建/编辑模式下的地图类名和 CSS 变量管理
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const { defaultPath, selectedPath, editingPath, editingVertexColor } = usePolylineCommon({
|
|
93
|
+
* type: 'road',
|
|
94
|
+
* optionsProp,
|
|
95
|
+
* constants: {
|
|
96
|
+
* defaultPathConstant: ROAD_DEFAULT_PATH,
|
|
97
|
+
* selectedPathConstant: ROAD_DEFAULT_SELECTED_PATH,
|
|
98
|
+
* editingPathConstant: ROAD_DEFAULT_EDIT_PATH,
|
|
99
|
+
* },
|
|
100
|
+
* map,
|
|
101
|
+
* currentMode,
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function usePolylineCommon(options: UsePolylineCommonOptions): UsePolylineCommonReturn;
|