tg-map-vue3 3.7.9 → 3.7.11
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/CHANGELOG.md +2 -0
- package/dist/src/components/TgMap.vue.d.ts +4 -16
- package/dist/src/components/extra/TgHeatmap.vue.d.ts +37 -0
- package/dist/src/components/index.d.ts +3 -0
- package/dist/src/map/lat-lng.d.ts +4 -0
- package/dist/src/map/map/baidu-map.d.ts +2 -0
- package/dist/src/map/map/extra/heatmap.d.ts +72 -0
- package/dist/src/map/map/google-map.d.ts +2 -0
- package/dist/src/map/map/here-map.d.ts +2 -0
- package/dist/src/map/map/map.d.ts +2 -0
- package/dist/src/utils/vue-utils.d.ts +9 -2
- package/dist/tg-map.js +1972 -1432
- package/dist/tg-map.js.map +1 -1
- package/dist/tg-map.umd.cjs +7 -7
- package/dist/tg-map.umd.cjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
- feat: 添加[IconSequence]到[TgPolyline]中
|
|
6
6
|
- fix: 多个地图同时载入时报错的问题
|
|
7
7
|
- feat: [TgMarker]添加`autoAddToClusterer`属性, 可以不被点聚合管理
|
|
8
|
+
- feat: 添加[热力图][TgHeatmap]功能
|
|
8
9
|
- ***BREAKING CHANGE***: [MapStyle]简化成纯对象, 方便使用
|
|
9
10
|
- ***BREAKING CHANGE***: 增加[TgStreetViewControl], 默认关闭google的街景控制按钮
|
|
10
11
|
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
[TgMarker]: src/components/overlays/TgMarker.vue
|
|
61
62
|
[TgInfoBox]: src/components/overlays/TgInfoBox.vue
|
|
62
63
|
[TgInfoWindow]: src/components/overlays/TgInfoWindow.vue
|
|
64
|
+
[TgHeatmap]: src/components/extra/TgHeatmap.vue "热力图"
|
|
63
65
|
[TgStreetViewControl]: src/components/controls/TgStreetViewControl.vue
|
|
64
66
|
[Icon]: src/map/map/overlay/icon.ts#L18 "图标"
|
|
65
67
|
[SymbolIcon]: src/map/map/overlay/icon.ts#L139 "Svg图标"
|
|
@@ -69,10 +69,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
69
69
|
type: PropType<"single" | "multi">;
|
|
70
70
|
};
|
|
71
71
|
gestureHandling: {
|
|
72
|
-
type: PropType<StringEnumValue<typeof GestureHandlingOptions>>;
|
|
73
|
-
* 仅用来获取center的值, 需要设置center的值请使用`center`属性
|
|
74
|
-
* @see center
|
|
75
|
-
* */
|
|
72
|
+
type: PropType<StringEnumValue<typeof GestureHandlingOptions>>;
|
|
76
73
|
};
|
|
77
74
|
minZoom: {
|
|
78
75
|
type: PropType<number>;
|
|
@@ -84,10 +81,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
84
81
|
type: PropType<MapStyle>;
|
|
85
82
|
};
|
|
86
83
|
mapTypeId: {
|
|
87
|
-
type: PropType<StringEnumValue<typeof BuildInMapTypeId>>;
|
|
88
|
-
* 仅用来获取center的值, 需要设置center的值请使用`center`属性
|
|
89
|
-
* @see center
|
|
90
|
-
* */
|
|
84
|
+
type: PropType<StringEnumValue<typeof BuildInMapTypeId>>;
|
|
91
85
|
};
|
|
92
86
|
/** 地图类型对象, 优先级比mapTypeId高 */
|
|
93
87
|
mapType: {
|
|
@@ -169,10 +163,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
169
163
|
type: PropType<"single" | "multi">;
|
|
170
164
|
};
|
|
171
165
|
gestureHandling: {
|
|
172
|
-
type: PropType<StringEnumValue<typeof GestureHandlingOptions>>;
|
|
173
|
-
* 仅用来获取center的值, 需要设置center的值请使用`center`属性
|
|
174
|
-
* @see center
|
|
175
|
-
* */
|
|
166
|
+
type: PropType<StringEnumValue<typeof GestureHandlingOptions>>;
|
|
176
167
|
};
|
|
177
168
|
minZoom: {
|
|
178
169
|
type: PropType<number>;
|
|
@@ -184,10 +175,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
184
175
|
type: PropType<MapStyle>;
|
|
185
176
|
};
|
|
186
177
|
mapTypeId: {
|
|
187
|
-
type: PropType<StringEnumValue<typeof BuildInMapTypeId>>;
|
|
188
|
-
* 仅用来获取center的值, 需要设置center的值请使用`center`属性
|
|
189
|
-
* @see center
|
|
190
|
-
* */
|
|
178
|
+
type: PropType<StringEnumValue<typeof BuildInMapTypeId>>;
|
|
191
179
|
};
|
|
192
180
|
/** 地图类型对象, 优先级比mapTypeId高 */
|
|
193
181
|
mapType: {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createEmptyVNode } from '../../utils/vue-utils';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
maxIntensity: {
|
|
4
|
+
type: import("vue").PropType<number>;
|
|
5
|
+
};
|
|
6
|
+
gradient: {
|
|
7
|
+
type: import("vue").PropType<any>;
|
|
8
|
+
};
|
|
9
|
+
opacity: {
|
|
10
|
+
type: import("vue").PropType<number>;
|
|
11
|
+
};
|
|
12
|
+
radius: {
|
|
13
|
+
type: import("vue").PropType<number>;
|
|
14
|
+
};
|
|
15
|
+
data: {
|
|
16
|
+
type: import("vue").PropType<import("../../map/map/extra/heatmap").HeatmapData>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}, typeof createEmptyVNode, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
maxIntensity: {
|
|
21
|
+
type: import("vue").PropType<number>;
|
|
22
|
+
};
|
|
23
|
+
gradient: {
|
|
24
|
+
type: import("vue").PropType<any>;
|
|
25
|
+
};
|
|
26
|
+
opacity: {
|
|
27
|
+
type: import("vue").PropType<number>;
|
|
28
|
+
};
|
|
29
|
+
radius: {
|
|
30
|
+
type: import("vue").PropType<number>;
|
|
31
|
+
};
|
|
32
|
+
data: {
|
|
33
|
+
type: import("vue").PropType<import("../../map/map/extra/heatmap").HeatmapData>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
}>>, {}, {}>;
|
|
37
|
+
export default _default;
|
|
@@ -10,12 +10,14 @@ export default TgMapPlugin;
|
|
|
10
10
|
export { type Tg } from '../map/event';
|
|
11
11
|
export * from '../map/lat-lng';
|
|
12
12
|
export * from '../map/map-factory';
|
|
13
|
+
export { loadCachedMap } from '../map/map-loader';
|
|
13
14
|
export * from '../map/map/controls/control';
|
|
14
15
|
export * from '../map/map/controls/map-type.control';
|
|
15
16
|
export * from '../map/map/controls/scale.control';
|
|
16
17
|
export * from '../map/map/controls/street-view.control';
|
|
17
18
|
export * from '../map/map/controls/zoom.control';
|
|
18
19
|
export * from '../map/map/extra/autocomplete';
|
|
20
|
+
export * from '../map/map/extra/heatmap';
|
|
19
21
|
export * from '../map/map/extra/map-urls';
|
|
20
22
|
export * from '../map/map/extra/marker-clusterer';
|
|
21
23
|
export * from '../map/map/extra/places-service';
|
|
@@ -50,6 +52,7 @@ export { default as TgMapTypeControl } from './controls/TgMapTypeControl.vue';
|
|
|
50
52
|
export { default as TgScaleControl } from './controls/TgScaleControl.vue';
|
|
51
53
|
export { default as TgStreetViewControl } from './controls/TgStreetViewControl.vue';
|
|
52
54
|
export { default as TgZoomControl } from './controls/TgZoomControl.vue';
|
|
55
|
+
export { default as TgHeatmap } from './extra/TgHeatmap.vue';
|
|
53
56
|
export { default as TgMarkerClusterer } from './extra/TgMarkerClusterer.vue';
|
|
54
57
|
export { default as TgTrafficLayer } from './layers/TgTrafficLayer.vue';
|
|
55
58
|
export * from './map-hooks';
|
|
@@ -6,6 +6,7 @@ import { BaiduScaleControl } from './controls/scale.control';
|
|
|
6
6
|
import { BaiduStreetViewControl } from './controls/street-view.control';
|
|
7
7
|
import { BaiduZoomControl } from './controls/zoom.control';
|
|
8
8
|
import { type Autocomplete, type AutocompleteOptions } from './extra/autocomplete';
|
|
9
|
+
import { type Heatmap, type HeatmapOptions } from './extra/heatmap';
|
|
9
10
|
import { type MapUrls, type MapUrlsOptions } from './extra/map-urls';
|
|
10
11
|
import { BaiduMarkerClusterer, type MarkerClustererOptions } from './extra/marker-clusterer';
|
|
11
12
|
import { type PlacesService, type PlacesServiceOptions } from './extra/places-service';
|
|
@@ -73,6 +74,7 @@ export declare class BaiduMap extends AbstractMap {
|
|
|
73
74
|
createStreetViewControl: typeof BaiduStreetViewControl.create;
|
|
74
75
|
createScaleControl: typeof BaiduScaleControl.create;
|
|
75
76
|
createMarkerClusterer(options: MarkerClustererOptions): BaiduMarkerClusterer;
|
|
77
|
+
createHeatmap(options: HeatmapOptions): Heatmap;
|
|
76
78
|
createAutocomplete(options: AutocompleteOptions): Autocomplete;
|
|
77
79
|
createSearchBox(options: SearchBoxOptions): SearchBox;
|
|
78
80
|
createPlacesService(options: PlacesServiceOptions): PlacesService;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import BHeatMapOverlay from 'bmaplib.heatmap';
|
|
3
|
+
import type { LatLng, WeightedLatLng } from '../../lat-lng';
|
|
4
|
+
import type { BaiduMap } from '../baidu-map';
|
|
5
|
+
import type { GoogleMap } from '../google-map';
|
|
6
|
+
import type { AbstractMap } from '../map';
|
|
7
|
+
type BHeatMapOverlay = InstanceType<typeof BHeatMapOverlay>;
|
|
8
|
+
export interface HeatmapOptions {
|
|
9
|
+
data: HeatmapData;
|
|
10
|
+
/**
|
|
11
|
+
* 透明度
|
|
12
|
+
*
|
|
13
|
+
* ## 不同效果
|
|
14
|
+
* - google: 正常
|
|
15
|
+
* - baidu: 设置透明度后模糊效果有问题, 感觉是bug
|
|
16
|
+
*/
|
|
17
|
+
opacity?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 半径
|
|
20
|
+
*
|
|
21
|
+
* ## 默认半径的区别
|
|
22
|
+
* - google: 默认半径是10
|
|
23
|
+
* - baidu: 默认半径是40
|
|
24
|
+
*
|
|
25
|
+
* 这里统一成默认半径{@link RADIUS_DEFAULT}
|
|
26
|
+
*/
|
|
27
|
+
radius?: number;
|
|
28
|
+
/**
|
|
29
|
+
* ## 不同实现
|
|
30
|
+
* - google: 接收颜色数组, 不能设置插值的位置
|
|
31
|
+
* - baidu: 接收`{.1: 'red', .9: 'green'}`形式的颜色对象, 可以指定插值的位置
|
|
32
|
+
*/
|
|
33
|
+
gradient?: Record<number, string>;
|
|
34
|
+
maxIntensity?: number;
|
|
35
|
+
}
|
|
36
|
+
export type HeatmapData = (LatLng | WeightedLatLng)[];
|
|
37
|
+
export declare abstract class Heatmap {
|
|
38
|
+
abstract inner: google.maps.visualization.HeatmapLayer | BHeatMapOverlay;
|
|
39
|
+
abstract map: AbstractMap;
|
|
40
|
+
/** 只更新data */
|
|
41
|
+
abstract setData(data: HeatmapData): void;
|
|
42
|
+
/** 一次性更新所有options */
|
|
43
|
+
abstract setOptions(options: HeatmapOptions): void;
|
|
44
|
+
/**
|
|
45
|
+
* 从地图上移除
|
|
46
|
+
* 创建之后会被立即添加到地图上, 故只有remove方法
|
|
47
|
+
* */
|
|
48
|
+
abstract remove(): void;
|
|
49
|
+
}
|
|
50
|
+
export declare class GoogleHeatmap extends Heatmap {
|
|
51
|
+
map: GoogleMap;
|
|
52
|
+
inner: google.maps.visualization.HeatmapLayer;
|
|
53
|
+
constructor(map: GoogleMap, options: HeatmapOptions);
|
|
54
|
+
setData(data: HeatmapData): void;
|
|
55
|
+
setOptions(options: HeatmapOptions): void;
|
|
56
|
+
remove(): void;
|
|
57
|
+
}
|
|
58
|
+
export declare class BaiduHeatmap extends Heatmap {
|
|
59
|
+
map: BaiduMap;
|
|
60
|
+
inner: BHeatMapOverlay;
|
|
61
|
+
/**
|
|
62
|
+
* 当前的最大值
|
|
63
|
+
* 直接读取/修改`inner.data.max`, 实现类似google那种, 可以直接设置最大值的效果
|
|
64
|
+
* */
|
|
65
|
+
private get innerDataMax();
|
|
66
|
+
private set innerDataMax(value);
|
|
67
|
+
constructor(map: BaiduMap, options: HeatmapOptions);
|
|
68
|
+
setData(data: HeatmapData): void;
|
|
69
|
+
setOptions(options: HeatmapOptions): void;
|
|
70
|
+
remove(): void;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -7,6 +7,7 @@ import { GoogleScaleControl } from './controls/scale.control';
|
|
|
7
7
|
import { GoogleStreetViewControl } from './controls/street-view.control';
|
|
8
8
|
import { GoogleZoomControl } from './controls/zoom.control';
|
|
9
9
|
import { Autocomplete, type AutocompleteOptions } from './extra/autocomplete';
|
|
10
|
+
import { type Heatmap, type HeatmapOptions } from './extra/heatmap';
|
|
10
11
|
import { type MapUrls, type MapUrlsOptions } from './extra/map-urls';
|
|
11
12
|
import { GoogleMarkerClusterer, type MarkerClustererOptions } from './extra/marker-clusterer';
|
|
12
13
|
import { type PlacesService, type PlacesServiceOptions } from './extra/places-service';
|
|
@@ -73,6 +74,7 @@ export declare class GoogleMap extends AbstractMap {
|
|
|
73
74
|
createStreetViewControl: typeof GoogleStreetViewControl.create;
|
|
74
75
|
createScaleControl: typeof GoogleScaleControl.create;
|
|
75
76
|
createMarkerClusterer(options: MarkerClustererOptions): GoogleMarkerClusterer;
|
|
77
|
+
createHeatmap(options: HeatmapOptions): Heatmap;
|
|
76
78
|
createAutocomplete(options: AutocompleteOptions): Autocomplete;
|
|
77
79
|
createSearchBox(options: SearchBoxOptions): SearchBox;
|
|
78
80
|
createPlacesService(options: PlacesServiceOptions): PlacesService;
|
|
@@ -7,6 +7,7 @@ import type { ScaleControlOptions } from './controls/scale.control';
|
|
|
7
7
|
import type { StreetViewControl, StreetViewControlOptions } from './controls/street-view.control';
|
|
8
8
|
import type { ZoomControl, ZoomControlOptions } from './controls/zoom.control';
|
|
9
9
|
import type { Autocomplete, AutocompleteOptions } from './extra/autocomplete';
|
|
10
|
+
import type { Heatmap, HeatmapOptions } from './extra/heatmap';
|
|
10
11
|
import type { MapUrls, MapUrlsOptions } from './extra/map-urls';
|
|
11
12
|
import type { MarkerClusterer, MarkerClustererOptions } from './extra/marker-clusterer';
|
|
12
13
|
import type { PlacesService, PlacesServiceOptions } from './extra/places-service';
|
|
@@ -57,6 +58,7 @@ export declare class HereMap extends AbstractMap {
|
|
|
57
58
|
removeOverlay(overlay: Overlay<unknown>): void;
|
|
58
59
|
createMarker(options: MarkerOptions): MarkerOverlay;
|
|
59
60
|
createMarkerClusterer(options: MarkerClustererOptions): MarkerClusterer;
|
|
61
|
+
createHeatmap(options: HeatmapOptions): Heatmap;
|
|
60
62
|
createAutocomplete(options: AutocompleteOptions): Autocomplete;
|
|
61
63
|
createSearchBox(options: SearchBoxOptions): SearchBox;
|
|
62
64
|
createPlacesService(options: PlacesServiceOptions): PlacesService;
|
|
@@ -10,6 +10,7 @@ import type { ScaleControlOptions } from './controls/scale.control';
|
|
|
10
10
|
import type { StreetViewControl, StreetViewControlOptions } from './controls/street-view.control';
|
|
11
11
|
import type { ZoomControl, ZoomControlOptions } from './controls/zoom.control';
|
|
12
12
|
import type { Autocomplete, AutocompleteOptions } from './extra/autocomplete';
|
|
13
|
+
import type { Heatmap, HeatmapOptions } from './extra/heatmap';
|
|
13
14
|
import type { MapUrls, MapUrlsOptions } from './extra/map-urls';
|
|
14
15
|
import type { MarkerClusterer, MarkerClustererOptions } from './extra/marker-clusterer';
|
|
15
16
|
import type { PlacesService, PlacesServiceOptions } from './extra/places-service';
|
|
@@ -136,6 +137,7 @@ export declare abstract class AbstractMap implements CoordTypeSupplier, Tg.Event
|
|
|
136
137
|
abstract removeOverlay(overlay: Overlay): void;
|
|
137
138
|
abstract createMarker(options: MarkerOptions): MarkerOverlay;
|
|
138
139
|
abstract createMarkerClusterer(options: MarkerClustererOptions): MarkerClusterer;
|
|
140
|
+
abstract createHeatmap(options: HeatmapOptions): Heatmap;
|
|
139
141
|
abstract createAutocomplete(options: AutocompleteOptions): Autocomplete;
|
|
140
142
|
abstract createSearchBox(options: SearchBoxOptions): SearchBox;
|
|
141
143
|
abstract createPlacesService(options: PlacesServiceOptions): PlacesService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Component, type ComponentOptions, type ComponentPublicInstance, type Prop, type PropType, type RendererElement, type RendererNode, type Slots, type VNode, type WritableComputedOptions } from 'vue';
|
|
1
|
+
import { type Component, type ComponentOptions, type ComponentPublicInstance, type ComputedRef, type Prop, type PropType, type Ref, type RendererElement, type RendererNode, type Slots, type VNode, type WritableComputedOptions } from 'vue';
|
|
2
2
|
import type { AbstractConstructor, KeysMatching, StringEnumLike, StringEnumValue, Thing } from './mapped-types';
|
|
3
3
|
/** 组件选项中的hook名 */
|
|
4
4
|
export type VueHookName = ExcludeSubtype<KeysMatching<OmitStartsWith<RemoveIndex<ComponentOptions>, '_'>, {
|
|
@@ -149,7 +149,7 @@ export declare function splitAttrs(attrs: Record<string, unknown>, props?: Recor
|
|
|
149
149
|
listenerProps: Record<string, unknown>;
|
|
150
150
|
};
|
|
151
151
|
/** 响应式的{@link splitAttrs} */
|
|
152
|
-
export declare function useSplittedAttrs(attrs: Record<string, unknown>, props?: Record<string, unknown>):
|
|
152
|
+
export declare function useSplittedAttrs(attrs: Record<string, unknown>, props?: Record<string, unknown>): ComputedRef<{
|
|
153
153
|
/** class/style/未声明的属性 等 */
|
|
154
154
|
binds: Record<string, unknown>;
|
|
155
155
|
/** 未声明的事件 */
|
|
@@ -180,4 +180,11 @@ export declare const useEventLogMethods: () => {
|
|
|
180
180
|
eventLog: (event: Thing | null | undefined) => void;
|
|
181
181
|
eventLogLess: (this: any, event: Thing | null | undefined) => void;
|
|
182
182
|
};
|
|
183
|
+
/**
|
|
184
|
+
* 值可能是Ref的对象
|
|
185
|
+
* 可以用来给{@link reactive}的参数做类型约束
|
|
186
|
+
* */
|
|
187
|
+
export type MaybeWrapRefs<T> = {
|
|
188
|
+
[P in keyof T]: Ref<T[P]> | T[P] | ComputedRef<T[P]>;
|
|
189
|
+
};
|
|
183
190
|
export {};
|