tg-map-vue3 3.7.4 → 3.7.5

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 CHANGED
@@ -3,6 +3,7 @@
3
3
  ## 3.7.x
4
4
 
5
5
  - feat: 添加[IconSequence]到[TgPolyline]中
6
+ - fix: 多个地图同时载入时报错的问题
6
7
  - ***BREAKING CHANGE***: [MapStyle]简化成纯对象, 方便使用
7
8
 
8
9
  ## 3.6.x
@@ -1,7 +1,8 @@
1
+ import { type PropType } from 'vue';
1
2
  import { LatLng } from '../map/lat-lng';
2
3
  import { TgMapType } from '../map/map-factory';
3
4
  import type { AbstractMap, AbstractMapEventMap } from '../map/map/map';
4
- import { GestureHandlingOptions } from '../map/map/map-options';
5
+ import { GestureHandlingOptions, type MapStyle } from '../map/map/map-options';
5
6
  import { BuildInMapTypeId, MapType } from '../map/map/map-type';
6
7
  import { type StringEnumValue } from '../utils/mapped-types';
7
8
  import { type EventEmits } from '../utils/vue-utils';
@@ -18,7 +19,7 @@ type TgMapEmits = {
18
19
  declare const _default: import("vue").DefineComponent<{
19
20
  /** type没做响应式, 但外部可以把type作为tg-map的key, 让type修改时完全重建tg-map */
20
21
  type: {
21
- type: import("vue").PropType<StringEnumValue<typeof TgMapType>>;
22
+ type: PropType<StringEnumValue<typeof TgMapType>>;
22
23
  default: TgMapType;
23
24
  };
24
25
  /**
@@ -30,7 +31,7 @@ declare const _default: import("vue").DefineComponent<{
30
31
  * @see AbstractMapEventMap.center-changed
31
32
  * */
32
33
  center: {
33
- type: import("vue").PropType<LatLng>;
34
+ type: PropType<LatLng>;
34
35
  required: true;
35
36
  };
36
37
  /**
@@ -39,7 +40,7 @@ declare const _default: import("vue").DefineComponent<{
39
40
  * @see center
40
41
  */
41
42
  centerSyncDelay: {
42
- type: import("vue").PropType<number>;
43
+ type: PropType<number>;
43
44
  default: number;
44
45
  };
45
46
  /**
@@ -47,17 +48,17 @@ declare const _default: import("vue").DefineComponent<{
47
48
  * @see center
48
49
  * */
49
50
  currentCenter: {
50
- type: import("vue").PropType<LatLng>;
51
+ type: PropType<LatLng>;
51
52
  };
52
53
  /**
53
54
  * 仅用于获取tg-map销毁时的最后的center的值
54
55
  * @see center
55
56
  */
56
57
  lastCenter: {
57
- type: import("vue").PropType<LatLng>;
58
+ type: PropType<LatLng>;
58
59
  };
59
60
  zoom: {
60
- type: import("vue").PropType<number>;
61
+ type: PropType<number>;
61
62
  required: true;
62
63
  };
63
64
  /**
@@ -65,29 +66,35 @@ declare const _default: import("vue").DefineComponent<{
65
66
  * @see MapOptions.infoWindowMode
66
67
  */
67
68
  infoWindowMode: {
68
- type: import("vue").PropType<"single" | "multi">;
69
+ type: PropType<"single" | "multi">;
69
70
  };
70
71
  gestureHandling: {
71
- type: import("vue").PropType<StringEnumValue<typeof GestureHandlingOptions>>;
72
+ type: PropType<StringEnumValue<typeof GestureHandlingOptions>>; /**
73
+ * 仅用来获取center的值, 需要设置center的值请使用`center`属性
74
+ * @see center
75
+ * */
72
76
  };
73
77
  minZoom: {
74
- type: import("vue").PropType<number>;
78
+ type: PropType<number>;
75
79
  };
76
80
  maxZoom: {
77
- type: import("vue").PropType<number>;
81
+ type: PropType<number>;
78
82
  };
79
83
  mapStyle: {
80
- type: import("vue").PropType<any>;
84
+ type: PropType<MapStyle>;
81
85
  };
82
86
  mapTypeId: {
83
- type: import("vue").PropType<StringEnumValue<typeof BuildInMapTypeId>>;
87
+ type: PropType<StringEnumValue<typeof BuildInMapTypeId>>; /**
88
+ * 仅用来获取center的值, 需要设置center的值请使用`center`属性
89
+ * @see center
90
+ * */
84
91
  };
85
92
  /** 地图类型对象, 优先级比mapTypeId高 */
86
93
  mapType: {
87
- type: import("vue").PropType<any>;
94
+ type: PropType<any>;
88
95
  };
89
96
  hideLogo: {
90
- type: import("vue").PropType<boolean>;
97
+ type: PropType<boolean>;
91
98
  };
92
99
  onLoad: import("vue").Prop<import("../utils/vue-utils").EventCallback<AbstractMap>>;
93
100
  'onUpdate:center': import("vue").Prop<import("../utils/vue-utils").EventCallback<LatLng>>;
@@ -112,7 +119,7 @@ declare const _default: import("vue").DefineComponent<{
112
119
  }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, EventEmits<AbstractMapEventMap & TgMapEmits>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
113
120
  /** type没做响应式, 但外部可以把type作为tg-map的key, 让type修改时完全重建tg-map */
114
121
  type: {
115
- type: import("vue").PropType<StringEnumValue<typeof TgMapType>>;
122
+ type: PropType<StringEnumValue<typeof TgMapType>>;
116
123
  default: TgMapType;
117
124
  };
118
125
  /**
@@ -124,7 +131,7 @@ declare const _default: import("vue").DefineComponent<{
124
131
  * @see AbstractMapEventMap.center-changed
125
132
  * */
126
133
  center: {
127
- type: import("vue").PropType<LatLng>;
134
+ type: PropType<LatLng>;
128
135
  required: true;
129
136
  };
130
137
  /**
@@ -133,7 +140,7 @@ declare const _default: import("vue").DefineComponent<{
133
140
  * @see center
134
141
  */
135
142
  centerSyncDelay: {
136
- type: import("vue").PropType<number>;
143
+ type: PropType<number>;
137
144
  default: number;
138
145
  };
139
146
  /**
@@ -141,17 +148,17 @@ declare const _default: import("vue").DefineComponent<{
141
148
  * @see center
142
149
  * */
143
150
  currentCenter: {
144
- type: import("vue").PropType<LatLng>;
151
+ type: PropType<LatLng>;
145
152
  };
146
153
  /**
147
154
  * 仅用于获取tg-map销毁时的最后的center的值
148
155
  * @see center
149
156
  */
150
157
  lastCenter: {
151
- type: import("vue").PropType<LatLng>;
158
+ type: PropType<LatLng>;
152
159
  };
153
160
  zoom: {
154
- type: import("vue").PropType<number>;
161
+ type: PropType<number>;
155
162
  required: true;
156
163
  };
157
164
  /**
@@ -159,29 +166,35 @@ declare const _default: import("vue").DefineComponent<{
159
166
  * @see MapOptions.infoWindowMode
160
167
  */
161
168
  infoWindowMode: {
162
- type: import("vue").PropType<"single" | "multi">;
169
+ type: PropType<"single" | "multi">;
163
170
  };
164
171
  gestureHandling: {
165
- type: import("vue").PropType<StringEnumValue<typeof GestureHandlingOptions>>;
172
+ type: PropType<StringEnumValue<typeof GestureHandlingOptions>>; /**
173
+ * 仅用来获取center的值, 需要设置center的值请使用`center`属性
174
+ * @see center
175
+ * */
166
176
  };
167
177
  minZoom: {
168
- type: import("vue").PropType<number>;
178
+ type: PropType<number>;
169
179
  };
170
180
  maxZoom: {
171
- type: import("vue").PropType<number>;
181
+ type: PropType<number>;
172
182
  };
173
183
  mapStyle: {
174
- type: import("vue").PropType<any>;
184
+ type: PropType<MapStyle>;
175
185
  };
176
186
  mapTypeId: {
177
- type: import("vue").PropType<StringEnumValue<typeof BuildInMapTypeId>>;
187
+ type: PropType<StringEnumValue<typeof BuildInMapTypeId>>; /**
188
+ * 仅用来获取center的值, 需要设置center的值请使用`center`属性
189
+ * @see center
190
+ * */
178
191
  };
179
192
  /** 地图类型对象, 优先级比mapTypeId高 */
180
193
  mapType: {
181
- type: import("vue").PropType<any>;
194
+ type: PropType<any>;
182
195
  };
183
196
  hideLogo: {
184
- type: import("vue").PropType<boolean>;
197
+ type: PropType<boolean>;
185
198
  };
186
199
  onLoad: import("vue").Prop<import("../utils/vue-utils").EventCallback<AbstractMap>>;
187
200
  'onUpdate:center': import("vue").Prop<import("../utils/vue-utils").EventCallback<LatLng>>;
@@ -1,4 +1,4 @@
1
- import type { TgMapConfig } from './map-config';
1
+ import { type TgMapConfig } from './map-config';
2
2
  import { TgMapType } from './map-factory';
3
3
  /**
4
4
  * 使用类型映射的方式`TgMapConfig[T]`, 确定`type`的类型之后, 不会自动推断`config`的类型,
@@ -8,6 +8,10 @@ type LoadMapOptions<T extends TgMapType> = {
8
8
  type: T;
9
9
  config: TgMapConfig[T];
10
10
  };
11
+ /**
12
+ * 加载缓存的地图, 保证一种地图只加载一次
13
+ */
14
+ export declare function loadCachedMap(type: TgMapType): Promise<unknown>;
11
15
  /** 载入地图库 */
12
16
  export declare function loadMap<T extends TgMapType>(options: LoadMapOptions<T>): Promise<unknown>;
13
17
  export declare function loadJsonp(url: string, callbackParamName?: string): Promise<unknown>;
@@ -8,10 +8,20 @@ export declare namespace Objects {
8
8
  function toJsonSafely(value: any): string;
9
9
  /** 删除obj中纯对象上的值为undefined的属性 */
10
10
  function deleteUndefinedPropertyOnPlainObjectDeeply(obj: any): void;
11
+ /** 存在则返回, 不存在则新建 */
12
+ function putIfAbsent<K extends keyof any, V>(obj: Record<K, V>, key: K, ifAbsent: () => Exclude<V, undefined>): Exclude<V, undefined>;
11
13
  /** @see Omit */
12
14
  function omit<T, K extends keyof any>(obj: T, ...keys: K[]): Omit<T, K>;
13
15
  /** @see Pick */
14
16
  function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
17
+ /**
18
+ * 使用{@link keyPath}读取`obj`的字段
19
+ *
20
+ * @param keyPath `.`分隔的字段名 或 字段名数组
21
+ * @returns 若字段不存在, 则返回`undefined`
22
+ */
23
+ function get(obj: any, keyPath: string | string[]): any;
24
+ function del(obj: any, keyPath: string | string[]): any;
15
25
  }
16
26
  /** 用于替代Vue2中的filter, 直接交给模板使用 */
17
27
  export declare const stringify: typeof Objects.toJsonSafely;
@@ -14,3 +14,7 @@ export declare function isDef<T>(v: T | undefined | null): v is T;
14
14
  * @see isDef
15
15
  */
16
16
  export declare function isEntryValueDef<K, V>(entry: [K, V]): entry is [K, NonNullable<V>];
17
+ /**
18
+ * 创建一个异步初始化的单例, 保证只初始化成功一次
19
+ */
20
+ export declare function createAsyncSingleton<T>(creator: () => Promise<T>): () => Promise<T>;