@antv/l7-component 2.21.1 → 2.21.3
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/es/assets/iconfont/iconfont.js +6 -6
- package/es/constants/index.js +2 -2
- package/es/control/baseControl/buttonControl.js +109 -144
- package/es/control/baseControl/control.js +212 -258
- package/es/control/baseControl/popperControl.js +67 -95
- package/es/control/baseControl/selectControl.js +132 -178
- package/es/control/exportImage.js +59 -142
- package/es/control/fullscreen.js +69 -100
- package/es/control/geoLocate.js +37 -84
- package/es/control/layerSwitch.js +111 -154
- package/es/control/logo.js +43 -69
- package/es/control/mapTheme.js +57 -98
- package/es/control/mouseLocation.js +37 -69
- package/es/control/scale.js +107 -135
- package/es/control/swipe.js +297 -389
- package/es/control/zoom.js +80 -112
- package/es/css/index.css +10 -7
- package/es/index.js +675 -1
- package/es/marker-layer.js +275 -326
- package/es/marker.js +394 -446
- package/es/popup/layerPopup.js +277 -321
- package/es/popup/popup.js +422 -482
- package/es/utils/anchor.js +6 -6
- package/es/utils/icon.js +4 -4
- package/es/utils/popper.js +180 -196
- package/es/utils/screenfull.js +29 -51
- package/lib/assets/iconfont/iconfont.js +6 -6
- package/lib/constants/index.d.ts +60 -0
- package/lib/constants/index.js +2 -2
- package/lib/control/baseControl/buttonControl.d.ts +60 -0
- package/lib/control/baseControl/buttonControl.js +110 -143
- package/lib/control/baseControl/control.d.ts +112 -0
- package/lib/control/baseControl/control.js +213 -257
- package/lib/control/baseControl/index.d.ts +4 -0
- package/lib/control/baseControl/index.js +5 -5
- package/lib/control/baseControl/popperControl.d.ts +28 -0
- package/lib/control/baseControl/popperControl.js +68 -94
- package/lib/control/baseControl/selectControl.d.ts +53 -0
- package/lib/control/baseControl/selectControl.js +133 -177
- package/lib/control/exportImage.d.ts +19 -0
- package/lib/control/exportImage.js +60 -141
- package/lib/control/fullscreen.d.ts +20 -0
- package/lib/control/fullscreen.js +70 -99
- package/lib/control/geoLocate.d.ts +17 -0
- package/lib/control/geoLocate.js +38 -83
- package/lib/control/layerSwitch.d.ts +27 -0
- package/lib/control/layerSwitch.js +112 -153
- package/lib/control/logo.d.ts +14 -0
- package/lib/control/logo.js +44 -69
- package/lib/control/mapTheme.d.ts +11 -0
- package/lib/control/mapTheme.js +58 -97
- package/lib/control/mouseLocation.d.ts +16 -0
- package/lib/control/mouseLocation.js +38 -68
- package/lib/control/scale.d.ts +35 -0
- package/lib/control/scale.js +108 -134
- package/lib/control/swipe.d.ts +66 -0
- package/lib/control/swipe.js +298 -388
- package/lib/control/zoom.d.ts +39 -0
- package/lib/control/zoom.js +81 -111
- package/lib/css/index.css +10 -7
- package/lib/index.d.ts +19 -0
- package/lib/index.js +691 -17
- package/lib/interface.d.ts +18 -0
- package/lib/marker-layer.d.ts +55 -0
- package/lib/marker-layer.js +277 -324
- package/lib/marker.d.ts +58 -0
- package/lib/marker.js +395 -445
- package/lib/popup/layerPopup.d.ts +99 -0
- package/lib/popup/layerPopup.js +278 -320
- package/lib/popup/popup.d.ts +142 -0
- package/lib/popup/popup.js +423 -481
- package/lib/utils/anchor.d.ts +22 -0
- package/lib/utils/anchor.js +6 -6
- package/lib/utils/icon.d.ts +1 -0
- package/lib/utils/icon.js +6 -5
- package/lib/utils/popper.d.ts +76 -0
- package/lib/utils/popper.js +184 -196
- package/lib/utils/screenfull.d.ts +2 -0
- package/lib/utils/screenfull.js +29 -52
- package/package.json +16 -20
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ILayer, IPopupOption, L7Container } from '@antv/l7-core';
|
|
2
|
+
import { DOM } from '@antv/l7-utils';
|
|
3
|
+
import Popup from './popup';
|
|
4
|
+
type ElementType = DOM.ElementType;
|
|
5
|
+
export type LayerField = {
|
|
6
|
+
field: string;
|
|
7
|
+
formatField?: ElementType | ((field: string, feature: any) => ElementType);
|
|
8
|
+
formatValue?: ElementType | ((value: any, feature: any) => ElementType);
|
|
9
|
+
getValue?: (feature: any) => any;
|
|
10
|
+
};
|
|
11
|
+
export type LayerPopupConfigItem = {
|
|
12
|
+
layer: ILayer | string;
|
|
13
|
+
fields?: Array<LayerField | string>;
|
|
14
|
+
title?: ElementType | ((feature: any) => ElementType);
|
|
15
|
+
customContent?: ElementType | ((feature: any) => ElementType);
|
|
16
|
+
};
|
|
17
|
+
export interface ILayerPopupOption extends IPopupOption {
|
|
18
|
+
config?: LayerPopupConfigItem[];
|
|
19
|
+
items?: LayerPopupConfigItem[];
|
|
20
|
+
trigger: 'hover' | 'click';
|
|
21
|
+
}
|
|
22
|
+
type LayerMapInfo = {
|
|
23
|
+
onMouseMove?: (layer: ILayer, e: any) => void;
|
|
24
|
+
onMouseOut?: (layer: ILayer, e: any) => void;
|
|
25
|
+
onClick?: (layer: ILayer, e: any) => void;
|
|
26
|
+
onSourceUpdate?: (layer: ILayer) => void;
|
|
27
|
+
} & Partial<LayerPopupConfigItem>;
|
|
28
|
+
export { LayerPopup };
|
|
29
|
+
export default class LayerPopup extends Popup<ILayerPopupOption> {
|
|
30
|
+
/**
|
|
31
|
+
* 用于统计当前帧当中,layer 被点击的次数
|
|
32
|
+
*/
|
|
33
|
+
protected layerClickCountByFrame: number;
|
|
34
|
+
/**
|
|
35
|
+
* 用于保存图层对应的事件回调以及配置信息
|
|
36
|
+
* @protected
|
|
37
|
+
*/
|
|
38
|
+
protected layerConfigMap: WeakMap<ILayer, LayerMapInfo>;
|
|
39
|
+
/**
|
|
40
|
+
* 当期正在展示的图层以及对应元素 id 的信息
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
43
|
+
protected displayFeatureInfo?: {
|
|
44
|
+
layer: ILayer;
|
|
45
|
+
featureId: number;
|
|
46
|
+
};
|
|
47
|
+
protected get layerConfigItems(): LayerPopupConfigItem[];
|
|
48
|
+
addTo(scene: L7Container): this;
|
|
49
|
+
remove(): this;
|
|
50
|
+
setOptions(option: Partial<ILayerPopupOption>): this;
|
|
51
|
+
protected getDefault(option: Partial<ILayerPopupOption>): ILayerPopupOption;
|
|
52
|
+
/**
|
|
53
|
+
* 绑定对应的图层事件
|
|
54
|
+
* @protected
|
|
55
|
+
*/
|
|
56
|
+
protected bindLayerEvent(): void;
|
|
57
|
+
/**
|
|
58
|
+
* 解绑对应的图层事件
|
|
59
|
+
* @protected
|
|
60
|
+
*/
|
|
61
|
+
protected unbindLayerEvent(): void;
|
|
62
|
+
protected onLayerMouseMove(layer: ILayer, e: any): void;
|
|
63
|
+
protected onLayerMouseOut(layer: ILayer, e: any): void;
|
|
64
|
+
protected onLayerClick: (layer: ILayer, e: any) => void;
|
|
65
|
+
protected onSceneClick: () => void;
|
|
66
|
+
protected onSourceUpdate(): void;
|
|
67
|
+
/**
|
|
68
|
+
* 通过当前图层和对应选中的元素获取气泡展示的 HTML 内容
|
|
69
|
+
* @param layer
|
|
70
|
+
* @param e
|
|
71
|
+
* @protected
|
|
72
|
+
*/
|
|
73
|
+
protected getLayerInfoFrag(layer: ILayer, e: any): {
|
|
74
|
+
title: DocumentFragment | undefined;
|
|
75
|
+
content: DocumentFragment;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 通过 Layer 配置访问到真实的 Layer 实例
|
|
79
|
+
* @param configItem
|
|
80
|
+
* @protected
|
|
81
|
+
*/
|
|
82
|
+
protected getLayerByConfig(configItem: LayerPopupConfigItem): ILayer | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* 判断当前展示的 Feature 是否和上一次查看的一致
|
|
85
|
+
* @param layer
|
|
86
|
+
* @param featureId
|
|
87
|
+
* @protected
|
|
88
|
+
*/
|
|
89
|
+
protected isSameFeature(layer: ILayer, featureId: number): boolean | undefined;
|
|
90
|
+
protected setDisplayFeatureInfo(displayFeatureInfo?: {
|
|
91
|
+
layer: ILayer;
|
|
92
|
+
featureId: number;
|
|
93
|
+
}): void;
|
|
94
|
+
protected onLayerHide: () => void;
|
|
95
|
+
/**
|
|
96
|
+
* 覆盖 Popup 中的默认的 closeOnClick 行为
|
|
97
|
+
*/
|
|
98
|
+
protected updateCloseOnClick: () => void;
|
|
99
|
+
}
|