@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.
Files changed (80) 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 -389
  16. package/es/control/zoom.js +80 -112
  17. package/es/css/index.css +10 -7
  18. package/es/index.js +675 -1
  19. package/es/marker-layer.js +275 -326
  20. package/es/marker.js +394 -446
  21. package/es/popup/layerPopup.js +277 -321
  22. package/es/popup/popup.js +422 -482
  23. package/es/utils/anchor.js +6 -6
  24. package/es/utils/icon.js +4 -4
  25. package/es/utils/popper.js +180 -196
  26. package/es/utils/screenfull.js +29 -51
  27. package/lib/assets/iconfont/iconfont.js +6 -6
  28. package/lib/constants/index.d.ts +60 -0
  29. package/lib/constants/index.js +2 -2
  30. package/lib/control/baseControl/buttonControl.d.ts +60 -0
  31. package/lib/control/baseControl/buttonControl.js +110 -143
  32. package/lib/control/baseControl/control.d.ts +112 -0
  33. package/lib/control/baseControl/control.js +213 -257
  34. package/lib/control/baseControl/index.d.ts +4 -0
  35. package/lib/control/baseControl/index.js +5 -5
  36. package/lib/control/baseControl/popperControl.d.ts +28 -0
  37. package/lib/control/baseControl/popperControl.js +68 -94
  38. package/lib/control/baseControl/selectControl.d.ts +53 -0
  39. package/lib/control/baseControl/selectControl.js +133 -177
  40. package/lib/control/exportImage.d.ts +19 -0
  41. package/lib/control/exportImage.js +60 -141
  42. package/lib/control/fullscreen.d.ts +20 -0
  43. package/lib/control/fullscreen.js +70 -99
  44. package/lib/control/geoLocate.d.ts +17 -0
  45. package/lib/control/geoLocate.js +38 -83
  46. package/lib/control/layerSwitch.d.ts +27 -0
  47. package/lib/control/layerSwitch.js +112 -153
  48. package/lib/control/logo.d.ts +14 -0
  49. package/lib/control/logo.js +44 -69
  50. package/lib/control/mapTheme.d.ts +11 -0
  51. package/lib/control/mapTheme.js +58 -97
  52. package/lib/control/mouseLocation.d.ts +16 -0
  53. package/lib/control/mouseLocation.js +38 -68
  54. package/lib/control/scale.d.ts +35 -0
  55. package/lib/control/scale.js +108 -134
  56. package/lib/control/swipe.d.ts +66 -0
  57. package/lib/control/swipe.js +298 -388
  58. package/lib/control/zoom.d.ts +39 -0
  59. package/lib/control/zoom.js +81 -111
  60. package/lib/css/index.css +10 -7
  61. package/lib/index.d.ts +19 -0
  62. package/lib/index.js +691 -17
  63. package/lib/interface.d.ts +18 -0
  64. package/lib/marker-layer.d.ts +55 -0
  65. package/lib/marker-layer.js +277 -324
  66. package/lib/marker.d.ts +58 -0
  67. package/lib/marker.js +395 -445
  68. package/lib/popup/layerPopup.d.ts +99 -0
  69. package/lib/popup/layerPopup.js +278 -320
  70. package/lib/popup/popup.d.ts +142 -0
  71. package/lib/popup/popup.js +423 -481
  72. package/lib/utils/anchor.d.ts +22 -0
  73. package/lib/utils/anchor.js +6 -6
  74. package/lib/utils/icon.d.ts +1 -0
  75. package/lib/utils/icon.js +6 -5
  76. package/lib/utils/popper.d.ts +76 -0
  77. package/lib/utils/popper.js +184 -196
  78. package/lib/utils/screenfull.d.ts +2 -0
  79. package/lib/utils/screenfull.js +29 -52
  80. 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
+ }