@antv/l7-component 2.21.0 → 2.21.2

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 (83) hide show
  1. package/es/assets/iconfont/iconfont.js +6 -6
  2. package/es/constants/index.js +2 -2
  3. package/es/control/baseControl/buttonControl.js +109 -144
  4. package/es/control/baseControl/control.js +212 -258
  5. package/es/control/baseControl/popperControl.js +67 -95
  6. package/es/control/baseControl/selectControl.js +132 -178
  7. package/es/control/exportImage.js +59 -142
  8. package/es/control/fullscreen.js +69 -100
  9. package/es/control/geoLocate.js +37 -84
  10. package/es/control/layerSwitch.js +111 -154
  11. package/es/control/logo.js +43 -69
  12. package/es/control/mapTheme.js +57 -98
  13. package/es/control/mouseLocation.js +37 -69
  14. package/es/control/scale.js +107 -135
  15. package/es/control/swipe.js +297 -393
  16. package/es/control/zoom.js +80 -112
  17. package/es/css/index.css +10 -7
  18. package/es/index.js +667 -1
  19. package/es/marker-layer.js +274 -326
  20. package/es/marker.d.ts +0 -2
  21. package/es/marker.js +394 -453
  22. package/es/popup/layerPopup.js +277 -321
  23. package/es/popup/popup.js +422 -482
  24. package/es/utils/anchor.js +6 -6
  25. package/es/utils/icon.js +4 -4
  26. package/es/utils/popper.js +180 -196
  27. package/es/utils/screenfull.js +29 -51
  28. package/lib/assets/iconfont/iconfont.js +6 -6
  29. package/lib/constants/index.d.ts +60 -0
  30. package/lib/constants/index.js +2 -2
  31. package/lib/control/baseControl/buttonControl.d.ts +60 -0
  32. package/lib/control/baseControl/buttonControl.js +110 -143
  33. package/lib/control/baseControl/control.d.ts +112 -0
  34. package/lib/control/baseControl/control.js +213 -257
  35. package/lib/control/baseControl/index.d.ts +4 -0
  36. package/lib/control/baseControl/index.js +5 -5
  37. package/lib/control/baseControl/popperControl.d.ts +28 -0
  38. package/lib/control/baseControl/popperControl.js +68 -94
  39. package/lib/control/baseControl/selectControl.d.ts +53 -0
  40. package/lib/control/baseControl/selectControl.js +133 -177
  41. package/lib/control/exportImage.d.ts +19 -0
  42. package/lib/control/exportImage.js +60 -141
  43. package/lib/control/fullscreen.d.ts +20 -0
  44. package/lib/control/fullscreen.js +70 -99
  45. package/lib/control/geoLocate.d.ts +17 -0
  46. package/lib/control/geoLocate.js +38 -83
  47. package/lib/control/layerSwitch.d.ts +27 -0
  48. package/lib/control/layerSwitch.js +112 -153
  49. package/lib/control/logo.d.ts +14 -0
  50. package/lib/control/logo.js +44 -69
  51. package/lib/control/mapTheme.d.ts +11 -0
  52. package/lib/control/mapTheme.js +58 -97
  53. package/lib/control/mouseLocation.d.ts +16 -0
  54. package/lib/control/mouseLocation.js +38 -68
  55. package/lib/control/scale.d.ts +35 -0
  56. package/lib/control/scale.js +108 -134
  57. package/lib/control/swipe.d.ts +66 -0
  58. package/lib/control/swipe.js +298 -392
  59. package/lib/control/zoom.d.ts +39 -0
  60. package/lib/control/zoom.js +81 -111
  61. package/lib/css/index.css +10 -7
  62. package/lib/index.d.ts +19 -0
  63. package/lib/index.js +683 -17
  64. package/lib/interface.d.ts +18 -0
  65. package/lib/marker-layer.d.ts +55 -0
  66. package/lib/marker-layer.js +276 -324
  67. package/lib/marker.d.ts +58 -0
  68. package/lib/marker.js +395 -452
  69. package/lib/popup/layerPopup.d.ts +99 -0
  70. package/lib/popup/layerPopup.js +278 -320
  71. package/lib/popup/popup.d.ts +142 -0
  72. package/lib/popup/popup.js +423 -481
  73. package/lib/utils/anchor.d.ts +22 -0
  74. package/lib/utils/anchor.js +6 -6
  75. package/lib/utils/icon.d.ts +1 -0
  76. package/lib/utils/icon.js +6 -5
  77. package/lib/utils/popper.d.ts +76 -0
  78. package/lib/utils/popper.js +184 -196
  79. package/lib/utils/screenfull.d.ts +2 -0
  80. package/lib/utils/screenfull.js +29 -52
  81. package/package.json +16 -20
  82. package/CHANGELOG.md +0 -325
  83. package/LICENSE.md +0 -21
@@ -0,0 +1,142 @@
1
+ import type { ILayerService, ILngLat, IMapService, IPopup, IPopupOption, ISceneService, L7Container } from '@antv/l7-core';
2
+ import { DOM } from '@antv/l7-utils';
3
+ import { EventEmitter } from 'eventemitter3';
4
+ type ElementType = DOM.ElementType;
5
+ export { Popup };
6
+ export default class Popup<O extends IPopupOption = IPopupOption> extends EventEmitter implements IPopup {
7
+ /**
8
+ * 配置
9
+ * @protected
10
+ */
11
+ protected popupOption: O;
12
+ protected mapsService: IMapService;
13
+ protected sceneService: ISceneService;
14
+ protected layerService: ILayerService;
15
+ protected scene: L7Container;
16
+ /**
17
+ * 关闭按钮对应的 DOM
18
+ * @protected
19
+ */
20
+ protected closeButton?: HTMLElement | SVGElement;
21
+ /**
22
+ * Popup 的总容器 DOM,包含 content 和 tip
23
+ * @protected
24
+ */
25
+ protected container: HTMLElement;
26
+ /**
27
+ * popup 气泡容器
28
+ * @protected
29
+ */
30
+ protected content: HTMLElement;
31
+ /**
32
+ * popup 气泡标题
33
+ * @protected
34
+ */
35
+ protected contentTitle?: HTMLElement;
36
+ /**
37
+ * popup 内容容器
38
+ * @protected
39
+ */
40
+ protected contentPanel: HTMLElement;
41
+ /**
42
+ * 气泡箭头对应的 DOM
43
+ * @protected
44
+ */
45
+ protected tip: HTMLElement;
46
+ /**
47
+ * 当前是否展示
48
+ * @protected
49
+ */
50
+ protected isShow: boolean;
51
+ protected get lngLat(): ILngLat;
52
+ protected set lngLat(newLngLat: ILngLat);
53
+ constructor(cfg?: Partial<O>);
54
+ getIsShow(): boolean;
55
+ addTo(scene: L7Container): this;
56
+ remove(): this | undefined;
57
+ /**
58
+ * 获取 option 配置
59
+ */
60
+ getOptions(): O;
61
+ setOptions(option: Partial<O>): this;
62
+ open(): this;
63
+ close(): this;
64
+ show(): this | undefined;
65
+ hide(): this | undefined;
66
+ /**
67
+ * 设置 HTML 内容
68
+ * @param html
69
+ */
70
+ setHTML(html: ElementType): this;
71
+ /**
72
+ * 设置 Popup 展示文本
73
+ * @param text
74
+ */
75
+ setText(text: string): this;
76
+ setTitle(title?: ElementType): void;
77
+ /**
78
+ * 将地图自动平移到气泡位置
79
+ */
80
+ panToPopup(): this;
81
+ setLngLat(lngLat: ILngLat | [number, number]): this;
82
+ /**
83
+ * 设置 Popup 所在经纬度
84
+ * @param lngLat
85
+ */
86
+ setLnglat(lngLat: ILngLat | [number, number]): this;
87
+ /**
88
+ * 获取 Popup 所在经纬度
89
+ */
90
+ getLnglat(): ILngLat;
91
+ /**
92
+ * 设置 Popup 最大宽度
93
+ * @param maxWidth
94
+ */
95
+ setMaxWidth(maxWidth: string): this;
96
+ isOpen(): boolean;
97
+ protected onMouseMove: (e: MouseEvent) => void;
98
+ /**
99
+ * 将经纬度转换成对应的像素偏移位置
100
+ * @protected
101
+ */
102
+ protected updateLngLatPosition: () => void;
103
+ protected updateLngLatPositionWhenZoom: (ev: any) => void;
104
+ protected getDefault(option: Partial<O>): O;
105
+ /**
106
+ * 设置 Popup 内容 HTML
107
+ * @param element
108
+ */
109
+ protected setDOMContent(element: ElementType): this;
110
+ /**
111
+ * 绑定地图点击事件触发销毁 Popup
112
+ * @protected
113
+ */
114
+ protected updateCloseOnClick(onlyClear?: boolean): void;
115
+ protected updateCloseOnEsc(onlyClear?: boolean): void;
116
+ protected updateFollowCursor(onlyClear?: boolean): void;
117
+ protected onKeyDown: (e: KeyboardEvent) => void;
118
+ /**
119
+ * 创建 Popup 内容容器的 DOM (在每次 setHTML 或 setText 时都会被调用)
120
+ * @protected
121
+ */
122
+ protected createContent(): void;
123
+ protected onCloseButtonClick: (e: Event) => void;
124
+ private updatePosition;
125
+ protected updateWhenZoom: (ev: any) => void;
126
+ protected update: () => void;
127
+ /**
128
+ * 设置 Popup 相对于地图容器的 Position
129
+ * @param {Number} left
130
+ * @param {Number} top
131
+ * @param {Boolean} [useTransition=false] 是否使用过度效果
132
+ * @protected
133
+ */
134
+ protected setPopupPosition(left: number, top: number, useTransition?: boolean): void;
135
+ /**
136
+ * 检查当前传入 option 是否包含 keys 字段
137
+ * @param option
138
+ * @param keys
139
+ * @protected
140
+ */
141
+ protected checkUpdateOption(option: Partial<O>, keys: Array<keyof O>): boolean;
142
+ }